Selecting origin plane and two points

Selecting origin plane and two points

Anonymous
Not applicable
1,093 Views
6 Replies
Message 1 of 7

Selecting origin plane and two points

Anonymous
Not applicable

Is there a way to turn on the selection command from a python script, so that the user is asked to select a plane and two points? What I want to achieve is very similar to the flow for rectangle, but instead of rectangle I need my script to consume the two points for something else.

 

Is this possible?

0 Likes
Accepted solutions (1)
1,094 Views
6 Replies
Replies (6)
Message 2 of 7

BrianEkins
Mentor
Mentor
Accepted solution

You'll need to create a command.  This is described here.  In the case you described, you don't want selections.  A selection is a user picking an existing entity.  In your case, you just want to them click to specify a location on the screen.  You can do that by listening to mouse events and getting the mouse position when a click event happens.  Mouse events are accessed through the Command object.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 3 of 7

dikovm
Explorer
Explorer

One follow up question, since I have not worked with mouse events. How can I convert the  click location into 

Point3D?

0 Likes
Message 4 of 7

BrianEkins
Mentor
Mentor

Unfortunately, this isn't very straightforward.  We should have had the click event return a default 3D point.  The problem is that you're clicking on a 2D plan to specify a point in 3D space.  This means that really you're specifying a line that goes from the click point into the model and any point along that line is potentially valid.  The API is currently returning the 2D click information.  It's possible to use this along with camera information from the view to compute the direction of the bore line and then you would need to intersect that with whatever is defining the plan or surface of selection to get the actual 3D point.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 7

Anonymous
Not applicable

Yes, I came to the same conclusion. So I decided to calculate define the points relative to objects in the model.

0 Likes
Message 6 of 7

kandennti
Mentor
Mentor

Hi mdikov.

 

In the past, using MouseMoveEvent and BRepFace
I have created sample code that displays the 3D coordinates of the mouse cursor in real time.
(But it is Japanese)

http://kantoku.hatenablog.com/entry/2018/06/04/191443

 

It may be helpful for MouseClickEvent.

Message 7 of 7

MichaelT_123
Advisor
Advisor

Hio Kandennti-san,

 

 

Howevero youro ideo iso brillianto.

 

MichaelTo

 

 

 

MichaelT
0 Likes