Single Entity Selection

Single Entity Selection

Anonymous
Not applicable
647 Views
3 Replies
Message 1 of 4

Single Entity Selection

Anonymous
Not applicable

I'm borrowing from the samples library in the Inventor help this little gem:

Public Sub GetSingleSelection()

    ' Get a feature selection from the user
    Dim oObject As Object
    Set oObject = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Pick a feature")

    MsgBox "Picked: " & oObject.Name

End Sub

 Works fine, and is fairly simple, but the problem I'm having is if I press the escape key after starting the command, but before making my selection, I'm not able to start the command again.

  I realize from my searching that using the Selection (Simple) sample allows for an interrupt, with some modification, was just wondering if there was something similar for this simpler selection option.

0 Likes
648 Views
3 Replies
Replies (3)
Message 2 of 4

pdsa
Participant
Participant

Hi

 

I don't think the CommandManager.Pick Method has any options

 

Try to load this ivb project in the VBA editor (File > Load Project)

 

Run SelectFeature from Module1

 

This will show you hor to use the "Simple Selection" to get a Part Feature

 

 

0 Likes
Message 3 of 4

pdsa
Participant
Participant

NB. The .ivb file does not have a valid extension for an attachment i this forum, just rename it by removing .txt befor loading it

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

Thanks for the help pdsa,

 

  I'm slightly familiar with the Simple Selection, as shown in the help samples, but was more interested in the Single Entity Selection for now.

  I found that I wasn't releasing a variable properly, so the next time the program was run that variable still had a value, which causes the program to skip past the actual procedure (which it is directed to do if the variable is not equal to nothing).  Releasing that variable properly solved the problem.

 

  Vandargo

0 Likes