Inventor Customization

Inventor Customization

Reply
Valued Contributor
andrewwhiteinc
Posts: 65
Registered: ‎02-02-2011
Message 1 of 2 (150 Views)
Accepted Solution

Add Currently Selected Parts to an ObjectCollection

150 Views, 1 Replies
01-21-2013 06:09 PM

Hey Guys, I thought this might have been straight forward but I'm having a bit of trouble. I want the user to have a set of occurrences selected and click a button to run code on them but I can't seem to find a method of getting the names or anything else on the actively selected parts. Any direction on this would be appreciated plz.

 

Cheers!

P. Andrew White, P.Eng
Manufacturing Engineering Manager
Silent-Aire Manufacturing

As it was straight forward. For future reference of anyone searching here it is:

 

        Dim oDoc As AssemblyDocument
        Dim oCol As New Collection
        oDoc = oINV.ActiveDocument
        For i = 1 To oDoc.SelectSet.Count
            oCol.Add(oDoc.SelectSet.Item(i))
        Next
        For Each part In oCol
            oINV.Documents.Open(part.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName, True)
        Next 

Valued Contributor
andrewwhiteinc
Posts: 65
Registered: ‎02-02-2011
Message 2 of 2 (146 Views)

Re: Add Currently Selected Parts to an ObjectCollection

01-21-2013 06:32 PM in reply to: andrewwhiteinc

As it was straight forward. For future reference of anyone searching here it is:

 

        Dim oDoc As AssemblyDocument
        Dim oCol As New Collection
        oDoc = oINV.ActiveDocument
        For i = 1 To oDoc.SelectSet.Count
            oCol.Add(oDoc.SelectSet.Item(i))
        Next
        For Each part In oCol
            oINV.Documents.Open(part.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName, True)
        Next 

P. Andrew White, P.Eng
Manufacturing Engineering Manager
Silent-Aire Manufacturing
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.