Rename Browser Nodes Additional properties added to selection list

Rename Browser Nodes Additional properties added to selection list

Anonymous
Not applicable
1,655 Views
5 Replies
Message 1 of 6

Rename Browser Nodes Additional properties added to selection list

Anonymous
Not applicable

Looking for a way to add additional properties to the drop-down list in Rename Browser Nodes.

 

Standard List:

Filename

Part Number

Default

 

Additional properties would be a concatenation of native inventor properties:

<Part Number>-<Description>

 

Thoughts?

Tom

 

0 Likes
1,656 Views
5 Replies
Replies (5)
Message 2 of 6

YuhanZhang
Autodesk
Autodesk

You can create an addin or VBA command to add your own controls to implement this:).



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 6

Anonymous
Not applicable

Care to elaborate?

0 Likes
Message 4 of 6

xiaodong_liang
Autodesk Support
Autodesk Support

Rocky meant you will need to create youw own drop-down list, thus you can add any properties you want to manipulate. In another word, write a code to add a combobox in the panel you want to place. The relevant method is CommandControls.AddComboBox.

 

Hope this explains.

0 Likes
Message 5 of 6

Anonymous
Not applicable

where would I find such an addin?  What I would really like is the ability to rename the browser nodes to the DESCRIPTION property.

0 Likes
Message 6 of 6

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

What we suggested is to write the add-in yourself. Probably somebody has written it out, but sorry we do not know it. 

 

In addition, the orignal question in this thread wants to add one more option to the list of [Rename Browser Nodes]. If you do not mind to add the option, you could also just create a command and run it directly. e.g. iterate the occurrences of the assembly and rename them by the Description property, by either iLogic or Inventor API. The following code  shows how to recursively traverse an assembly and get the count of leaf node components and subassemblies. 

 

Public Sub AssemblyCount()
    ' Set reference to active document.
    ' This assumes the active document is an assembly
    Dim oDoc As Inventor.AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    ' Get assembly component definition
    Dim oCompDef As Inventor.ComponentDefinition
    Set oCompDef = oDoc.ComponentDefinition

    Dim sMsg As String
    Dim iLeafNodes As Long
    Dim iSubAssemblies As Long
    
    ' Get all occurrences from component definition for Assembly document
    Dim oCompOcc As ComponentOccurrence
    For Each oCompOcc In oCompDef.Occurrences
        ' Check if it's child occurrence (leaf node)
        If oCompOcc.SubOccurrences.Count = 0 Then
            Debug.Print oCompOcc.Name ' you can change its name
            iLeafNodes = iLeafNodes + 1
        Else
            Debug.Print oCompOcc.Name
            iSubAssemblies = iSubAssemblies + 1
            Call processAllSubOcc(oCompOcc, _
                                sMsg, _
                                iLeafNodes, _
                                iSubAssemblies) ' subassembly
        End If
    Next
    
    Debug.Print "No of leaf nodes    : " + CStr(iLeafNodes)
    Debug.Print "No of sub assemblies: " + CStr(iSubAssemblies)
End Sub

' This function is called for processing sub assembly.  It is called recursively
' to iterate through the entire assembly tree.
Private Sub processAllSubOcc(ByVal oCompOcc As ComponentOccurrence, _
                             ByRef sMsg As String, _
                             ByRef iLeafNodes As Long, _
                             ByRef iSubAssemblies As Long)
    
    Dim oSubCompOcc As ComponentOccurrence
    For Each oSubCompOcc In oCompOcc.SubOccurrences
        ' Check if it's child occurrence (leaf node)
        If oSubCompOcc.SubOccurrences.Count = 0 Then
            Debug.Print oSubCompOcc.Name 
            iLeafNodes = iLeafNodes + 1
        Else
            sMsg = sMsg + oSubCompOcc.Name + vbCr
            iSubAssemblies = iSubAssemblies + 1

            Call processAllSubOcc(oSubCompOcc, _
                                  sMsg, _
                                  iLeafNodes, _
                                  iSubAssemblies)
        End If
    Next
End Sub
0 Likes