How can I allow the user to select multiple objects?

How can I allow the user to select multiple objects?

Anonymous
Not applicable
735 Views
1 Reply
Message 1 of 2

How can I allow the user to select multiple objects?

Anonymous
Not applicable

I have this code designed to let the user select an object.

 

'Routine to allow the user select an object within an assembly
Public Sub PickObject(oPart As ComponentOccurrence, strMessage As String)

    'Select part or assy
    Set oPart = ThisApplication.CommandManager. _
                Pick(kAssemblyLeafOccurrenceFilter, strMessage)
    
    'check if nothing was selected
    If (oPart Is Nothing) Then Exit Sub
    
    'verification print
    Debug.Print oPart.Definition.Document.FullFileName
    
End Sub

I want to be able to let the user select several occurrences and add them to a collection.  Ultimately I'm performing several operations to parts containing many solids.  Right now the user has to do all of this to the top or "close to the top" assy.  I'd rather let the user select a few items inside the top level assy so the code can ignore the areas that aren't of any concern.

 

0 Likes
736 Views
1 Reply
Reply (1)
Message 2 of 2

MechMachineMan
Advisor
Advisor
Look at select set or preselect.

Or if you are sure of the pick method, put it in a loop which add's your selected parts to an object collection.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes