Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 531

Add a new custom pane and add node from a default browser pane

$
0
0

By Wayne Brill

It is not possible to add a node to the default Inventor browser panes. One idea is to create a new browser pane and add a default node to the custom browser pane instead. This example adds a new browser pane and adds the top node of the active pane of the active document.

  Download Inventor_API_Add_Pane_With_Default_Node


This project creates an AddIn. To test it follow the steps in this section of the Inventor API help.

image 

Once the AddIn is loaded open an assembly and run the “Assembly Cmd” on the Assemble Tab. It should add a new browser node named myNewPane.

image 

Here is the pertinent code from the project:

Sub addMyBrowserPane()

    'Get the active document

    Dim actDoc As Inventor.Document

    actDoc = m_inventorApplication.ActiveDocument

 

    'Get the top node of the active pane

    Dim actDocBrowserNode As Inventor.BrowserNode

    actDocBrowserNode = actDoc.BrowserPanes. _

                               ActivePane.TopNode

 

    ' Get a picture to use as the icon for

    ' the new browser pane

    Dim mIPictureDisp1 AsIPictureDisp = _

        PictureDispConverter.ToIPictureDisp _

      (My.Resources.Image_For_Browser_Pane)

 

    ' Create a client node resource

    Dim clientNodeRsc AsClientNodeResource = _

    actDoc.BrowserPanes.ClientNodeResources.Add _

          ("MyNodeResorce", 2211, mIPictureDisp1)

 

    ' Create a browser node definition

    Dim clientBrowserNodeDef As  _

                  ClientBrowserNodeDefinition = _

actDoc.BrowserPanes.CreateBrowserNodeDefinition _

   ("TopNodeForNewBrowser", 11344, clientNodeRsc)

 

    ' Create the new browser pane

    Dim newBrowserPane AsBrowserPane = _

        actDoc.BrowserPanes.AddTreeBrowserPane _

       ("myNewPane", "InternalNameForNewPane", _

                           clientBrowserNodeDef)

 

    ' Add the existing browser node to the

    ' new browser pane

    newBrowserPane.TopNode.AddChild _

      (actDocBrowserNode.BrowserNodeDefinition)

EndSub


Viewing all articles
Browse latest Browse all 531

Trending Articles