Selecting multiple edges for rule to use

Selecting multiple edges for rule to use

MTheDesigner
Advocate Advocate
402 Views
4 Replies
Message 1 of 5

Selecting multiple edges for rule to use

MTheDesigner
Advocate
Advocate

Hi all,

 

I am currently working on some code that is going to allow the user to select a bolt and then select several holes.

 

I want the code to instance the bolt as many times as there are holes and then make an insert constraint for each of them. 

However right now I am using ThisApplication.CommandManager.Pick to grab holes. This has lead to some problems. namely that i need to know how many holes are going to be picked, or i need to put a message box asking if they are done yet after every selection. It feels quite cumbersome and I would like a way to have a window that just waits until they are done. kind of like the constrains window. 

 

Does anyone know how i can make my own selection tool? 

0 Likes
Accepted solutions (2)
403 Views
4 Replies
Replies (4)
Message 2 of 5

matt_jlt
Collaborator
Collaborator
Accepted solution

I have an addin I developed that does exactly this but i use a minitoolbar with a bunch of other options.

What I did is use the Control /Shift Key to do multiple selections and have that in the command manager pick 'prompt text' That way user can decide and pressing escape key cancels any actions too.

 

Dim oEdge2 As EdgeProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Please select target occurence insert edge - Hold Control / Shift for multiple selection")

 

You can use a Do While loop or the less elegant way below aswell

Do While My.Computer.Keyboard.CtrlKeyDown
     'Do stuff here
Loop

 

' Loop if control keys are pressed (RunAgain is a shortcut / jump label)
If My.Computer.Keyboard.CtrlKeyDown = True Or My.Computer.Keyboard.ShiftKeyDown = True Then GoTo RunAgain

 

Message 3 of 5

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Take a look at API help. Search for "Interacting with the user" and read the "Interactive selection" chapter. The Interaction stays active (until explicitly shut down) and waits for next selection and then run's your placement code.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 4 of 5

MTheDesigner
Advocate
Advocate
Hey @ matt_jlt thanks for your response, this looks like an easy way to implement things.
0 Likes
Message 5 of 5

MTheDesigner
Advocate
Advocate
Hey @Anonymous Thanks for your reply, I am still learning how to code and never even thought of using the help menu that is built into the program. It looks like there is a lot of valuable information in here. Thank you for bringing this resource to my attention.
0 Likes