Inventor Node Label Updates

Inventor Node Label Updates

Anonymous
Not applicable
1,359 Views
3 Replies
Message 1 of 4

Inventor Node Label Updates

Anonymous
Not applicable

Hello,

I am attempting to rename a browser node. Here is the code I'm using and I'm getting a "Property 'Label' is 'ReadOnly'" error. In the API I found a note about using SetLabel() but that seems to only have  ones for ClientMade browser nodes.

 

 oSubAssyNode.BrowserNodeDefinition.Label = "XXX"

 

Any thoughts?

Thanks

0 Likes
Accepted solutions (1)
1,360 Views
3 Replies
Replies (3)
Message 2 of 4

nagwani
Alumni
Alumni
Accepted solution

Hi,

 

You cannot definitly change the fixed nodes like Origin, X,Y,Z plane and Axes, but you can change the names of features,work geometry and sketches which were created by you.

 

Below is sample code taken from help, the sample code iterates the browser node tree changes changes the Label of Extrusion and Sketch through the Name property of native object.

 

Hope this helps!

 

-Ishwar N

Private Sub QueryModelTree()
    Dim Doc As Document
    
    If (ThisApplication.Documents.Count <> 0) Then
        Set Doc = ThisApplication.ActiveDocument
    Else
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    Dim oTopNode As BrowserNode
    Set oTopNode = Doc.BrowserPanes("Model").TopNode

 

    Call recurse(oTopNode)
End Sub
Sub recurse(node As BrowserNode)
    If (node.Visible = True) Then
        Debug.Print node.BrowserNodeDefinition.Label
        
        If node.BrowserNodeDefinition.Label = "Sketch1" Then
            node.NativeObject.Name = "MySketch"
        End If
        If node.BrowserNodeDefinition.Label = "Extrusion1" Then
            node.NativeObject.Name = "MyExtrusion"
        End If
        
        Dim bn As BrowserNode
        For Each bn In node.BrowserNodes
            Call recurse(bn)
        Next
        
    End If
End Sub

 

0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks so much. This worked perfectly.
0 Likes
Message 4 of 4

linjone09
Participant
Participant

It cannot work in that situation.

Repair body's label.

0 Likes