Add a node to the Model Browser using a ClientFeature

By Wayne Brill

Inventor allows you to create a custom browser pane and you can add browser nodes on the custom pane, even add all nodes of Model Browser Pane. However you can’t add any node directly to the node tree of Model Browser pane and the new browser node can only be added as the top node of the custom pane.

One way to add a node to the Model Browser Pane is to use a Client Feature to add the node. Below is a VB.NET example. After this code runs there will be another node added to the Model browser:

image

 

Sub addClientFeatureToModelBrowserPane()        Dim m_inventorApp As  _                    Inventor.Application = Nothing        ' Try to get an active instance of Inventor        Try            m_inventorApp = System.Runtime. _                   InteropServices.Marshal. _             GetActiveObject("Inventor.Application")        Catch ex As Exception            System.Windows.Forms.MessageBox. _            Show("Start an Inventor session")            Exit Sub        End Try             Dim oDef As PartComponentDefinition        oDef = m_inventorApp.ActiveDocument. _                             ComponentDefinition             Dim oClientDef As ClientFeatureDefinition        oClientDef = oDef.Features.ClientFeatures. _                                  CreateDefinition()             Dim oClientFeature As ClientFeature        oClientFeature = oDef.Features. _          ClientFeatures.Add(oClientDef, "My node")             oClientFeature.Name = "Testing"    End Sub

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading