-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBrowser Rename.txt
More file actions
52 lines (34 loc) · 1.39 KB
/
Browser Rename.txt
File metadata and controls
52 lines (34 loc) · 1.39 KB
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
44
45
46
47
48
49
50
51
52
Sub Main()
SharedVariable("LogVar") = "Browser Rename"
iLogicVB.RunExternalRule("Write SV to Log.iLogicVB")
'Grab the Assembly Document
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
'Grab the Active Assembly Component Definition
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
' Get the model browser
Dim oPane As BrowserPane
oPane = oDoc.BrowserPanes.Item("Model")
' Grab the occurrence of the object
Dim oOcc As ComponentOccurrence
For i = 1 to oDoc.ComponentDefinition.Occurrences.Count
oOcc = oDoc.ComponentDefinition.Occurrences.Item(i)
'Grab Document from Occurrence
Dim oOccDoc As Document
oOccDoc = oOcc.Definition.Document
'get design properties set'
Dim invDesignInfo As PropertySet
invDesignInfo = oOccDoc.PropertySets.Item("Design Tracking Properties")
' Get the part number property.
Dim invPartNumberProperty As Inventor.Property
invPartNumberProperty = invDesignInfo.Item("Part Number")
' Get the browser node that corresponds to the new item
Dim oSubAssyNode As BrowserNode
oSubAssyNode = oPane.GetBrowserNodeFromObject(oOcc)
If oSubAssyNode.NativeObject.Name <> invPartNumberProperty.Value Then
'Set The name
oSubAssyNode.NativeObject.Name = (invPartNumberProperty.Value & ":" & i)
End If
Next
End Sub