forked from 454a1/CATIA_VBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCATIA二次开发中production获取路径.txt
43 lines (35 loc) · 1.44 KB
/
CATIA二次开发中production获取路径.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Sub CATMain()
Dim oStiEngine As StiEngine
Set oStiEngine = CATIA.GetItem( "CAIEngine" )
Dim oStiDBItem As StiDBItem
Set oStiDBItem = oStiEngine.GetStiDBItemFromAnyObject(CATIA.ActiveDocument)
Dim oStiDBChildren As StiDBChildren
Set oStiDBChildren = oStiDBItem.GetChildren
Dim oStiDBItem2 As StiDBItem
Dim temp_pathname As String
Set the_product = CATIA.ActiveDocument
Set the_reference_of_product = CATIA.ActiveDocument.Product
Set colection_of_products = CATIA.ActiveDocument.Product.Products
Set the_first_product = CATIA.ActiveDocument.Product.Products.Item(1)
Set the_reference_of_the_first_product = CATIA.ActiveDocument.Product.Products.Item(1).ReferenceProduct
Set the_parent_of_the_first_product = CATIA.ActiveDocument.Product.Products.Item(1).ReferenceProduct.Parent
Dim fullName as String
Dim part1 as Part
Set part1 = CATIA.ActiveDocument
Dim product1 as Product
Set product1 = CATIA.ActiveDocument
Path = the_parent_of_the_first_product.Path
msgbox Path
fullName=product1.fullName
Msgbox fullName
For i = 1 To oStiDBChildren.Count
Set oStiDBItem2 = oStiDBChildren.Item(i)
On Error Resume Next
temp_pathname = oStiDBItem2.GetDocumentFullPath
If Err.Number = 0 Then
MsgBox temp_pathname
Else
On Error GoTo 0
End If
Next
End Sub