Creating Leader by VB

Creating Leader by VB

NachoShaw
Advisor Advisor
1,394 Views
5 Replies
Message 1 of 6

Creating Leader by VB

NachoShaw
Advisor
Advisor

Hi

 

Anyone know how to create a leader in VB or VBA? i can create a leader to a pre selected item on the drawing sheet but i need to make it behave like the native Inventor whereas, you click 2 points and press enter to enter text. i need that but in VB 🙂

 

 

Thanks in advance for any replies

 

 

 

Nigel

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
1,395 Views
5 Replies
Replies (5)
Message 3 of 6

NachoShaw
Advisor
Advisor

Hi

 

yes i had already found those blogs. unfortunately, they assume that the leader that lesader points are already predetermined. i need to allow the user the create a leader in the standard way (i.e pick the first point then pick the second with the leader attached to the mouse pointer as the inventor built in version) and when the use has finished clicking points (usually 2 points), enter the text "REFRENCE ONLY" programatically.

 

i can add a leader with by clicking one location and a leader appears

i can add a leader by clicking 2 points (no leader attached to the mouse pointer)

 

Thanks

 

Nigel

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 4 of 6

rjay75
Collaborator
Collaborator

In order to select the points you want for leader creation you have to use intereaction events.

 

ie = appInventor.CommandManager.CreateInteractionEvents();
se = ie.SelectEvents;
ie.StatusBarText = "Select Edge";
ie.SetCursor(CursorTypeEnum.kCursorBuiltInCrosshair);
ie.OnTerminate += new InteractionEventsSink_OnTerminateEventHandler(ie_OnTerminate);
se.OnSelect += new SelectEventsSink_OnSelectEventHandler(se_OnSelect);
se.AddSelectionFilter(SelectionFilterEnum.kDrawingCurveSegmentFilter);
se.SingleSelectEnabled = true;

 Responding to the OnSelect gives you the curve and the point.

To get the next points use the mouse events.

 

ig = ie.InteractionGraphics;
ie.MouseEvents.MouseMoveEnabled = true;
ie.SetCursor(CursorTypeEnum.kCursorBuiltInCrosshair);
me = ie.MouseEvents;
me.OnMouseClick += new MouseEventsSink_OnMouseClickEventHandler(me_OnMouseClick);

 

The OnMouseClick will give you subsequent points.

 

 

0 Likes
Message 5 of 6

NachoShaw
Advisor
Advisor

Hi

 

thanks for the reply. I will try this later but i do assume i will not see the visual element of adding a leader i.e click the first point and the leader being attached to the mouse pointer until i click the second point.

 

without seeing the the leader mid process, its hard to see where the leader will be placed per se.

 

 

Thanks

 

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 6 of 6

rjay75
Collaborator
Collaborator

No you won't be able to see the 'rubberband' between points. To do that respond to the OnMouseMove event and in it modify the OverlayClientGraphics on the InteractionGraphics object to draw a line between the first point and last point. Look up ClientGraphics in the API help and look in the Advanced section in these DeveCamp classes.

 

It's not straight forward but ok when you can wrap your head around it.

0 Likes