Hi,
Yes this should be possible. I am not finding a complete example that does what you want to do however.
The VBA procedure QueryModelTree() in the help file iterates through the browser model tree of an open part or assembly document, printing the node labels to the VBA debug screen (the "Immediate" window in VBA, if enabled).
Your code would need to do something similar. When it finds a node that you want to rename you would have to get the native object and change the DisplayName or name property for proxies. You can't just change the label.
This is from from the API help:
>> >>
BrowserNodeDefinition Object
Label
Property that gets the label of the BrowserNode. This is the string that is displayed to the user. In the case of BuiltIns, this Label is really a reflection of the corresponding name held by the underlying data - for example, a Sketch or a WorkPlane object. In order to set the Label of a ClientBrowserNodeDefinition, see SetLabel on that object.
<< <<
I tried a quick example. Here is a VBA code snippet. This is just to show what objects in the API you could use to get the native object that needs to change the display. (recurse is part of the QueryModelTree() VBA example in the help)
Sub recurse(node As BrowserNode)
If (node.Visible = True) Then
' Debug.Print node.BrowserNodeDefinition.Label
Dim oNativeObj As Object
Set oNativeObj = node.NativeObject
Debug.Print TypeName(oNativeObj)
Dim oDoc As Document
Dim oAsmCompDef As AssemblyComponentDefinition
Dim oCompOcc As ComponentOccurrence
Dim oCompOccproxy As ComponentOccurrenceProxy
If TypeName(oNativeObj) = "AssemblyComponentDefinition" Then
Set oAsmCompDef = node.NativeObject
Set oDoc = oAsmCompDef.Document
oDoc.DisplayName = "WB"
End If
If TypeName(oNativeObj) = "ComponentOccurrenceProxy" Then
Set oCompOccproxy = node.NativeObject
oCompOccproxy.name = "WB_Test"
End If
Once you have the VBA code working you can move it to .NET and then to iLogic. This is what I usually do. Prototyping in VBA is a way to quickly get things working. Pasting VBA code to a VB.NET module removes the Set statements and gets you closer to what iLogic will want the code to be. (iLogic rules can run VB.NET code).
Thanks,
Wayne
Wayne Brill
Developer Technical Services
Autodesk Developer Network