Inventor Customization

Reply
Active Contributor
WHassan
Posts: 32
Registered: ‎07-17-2012
Message 1 of 2 (335 Views)
Accepted Solution

Selecting (SelectSet) an Item from the Model Browser in a DrawingDocument

335 Views, 1 Replies
01-10-2013 11:45 AM

Hello All,

 

Please look at the image (also Attached)DrawingSelectSet.png

 

I want to fetch either,

 

<> The name of the item selected OR

<> The componentOccurrence.Name of the referenced Assembly OR

<> (the best) The DrawingCurve(s) selected in the Window

 

Keep in mind that the idea is it to allow the user to make more than one selection (i.e. multiple components in browser window)

 

I have an alternative to make the user to manually select the drawingCurves in the Window, but that is not an elegnt solution to hat I am trying to achive.

 

If anyone can give me a heads up on what is the object type of the item I am selecting (I tried ComponentOccurrence but failed), even that would be very helpful.

 

Thanking you all,

Wajih

 

ADN Support Specialist
adam.nagy
Posts: 545
Registered: ‎03-26-2007
Message 2 of 2 (310 Views)

Re: Selecting (SelectSet) an Item from the Model Browser in a DrawingDocument

01-16-2013 02:52 AM in reply to: WHassan

Hi Wajih,

 

If I understand you correctly then the following VBA code should be of help:

Function GetSelectedItems(nodes As BrowserNodesEnumerator) As String
    Dim node As BrowserNode
    For Each node In nodes
        If node.Selected Then
            GetSelectedItems = GetSelectedItems + vbCrLf + node.BrowserNodeDefinition.Label
        End If
        
        GetSelectedItems = GetSelectedItems + GetSelectedItems(node.BrowserNodes)
    Next
End Function

Sub GetSelectedItemsInBrowser()
    Dim bp As BrowserPane
    Set bp = ThisApplication.ActiveDocument.BrowserPanes("DlHierarchy")
    
    Dim items As String
    items = GetSelectedItems(bp.TopNode.BrowserNodes)
    
    MsgBox items
End Sub

Cheers,



Adam Nagy
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube