Get model coordinate from 3D view point

Get model coordinate from 3D view point

Anonymous
Not applicable
1,377 Views
4 Replies
Message 1 of 5

Get model coordinate from 3D view point

Anonymous
Not applicable

How can I get model coordinates from a 3D view using UIDocument.Selection.PickPoint?  I know that PickPoint will provide the XYZ point based on the current work plane - the work plane I setup as normal to the active view and through the project base point.  How can I translate the work plane point into a model coordinate?  I'm guessing that this is a simple transform process but I cannot figure this out.  Thanks.

0 Likes
1,378 Views
4 Replies
Replies (4)
Message 2 of 5

aignatovich
Advisor
Advisor

Hi!

 

Perhaps, I didn't understand the question, but this method allows user to select point in active work plane only and returns XYZ already in model coordinates.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks for your response.  However, as you note, PickPoint provides XYZ coordinates relative to the active workplane which, in general, is not in model coordinates.  For example, in a plan view with the workplane at the project base point elevation and used on a line with one end at +500' above the project base point elevation and the other end at -500 feet below the project base point elevation, the coordinates have valid X and Y values but the Z value is zero (this assumes that the workplane has not been rotated or something).  The coordinates provided are workplane coordinates and are not true model coordinates.  For this example, given how pickpoint works, it would be impossible to determine the true 3D model coordinates, there is not enough information.  However, when used in a 3D view, there should be a way to convert the workplane XYZ coordinates to true 3D model coordinates.  I believe that this is just vector mathematics but I don't know vector mathematics well enough.

0 Likes
Message 4 of 5

jeremytammik
Autodesk
Autodesk

Alexander already answered your question and suggested a better solution in another thread:

 

https://forums.autodesk.com/t5/revit-api-forum/referenceintersector-working-weird/m-p/7409123

 

"PickPoint prompts the user to pick a point on the active work plane. Perhaps you should prompt user to select model line instead."

 

Just as he says, PickPoint returns model coordinates on the current work plane.

 

If you insist on picking a point in 3D, here is a solution to do so:

 

http://thebuildingcoder.typepad.com/blog/2011/11/pick-a-point-in-3d.html

 

Alexander's suggestion to create a model line in 3D space sounds like a better idea for most purposes to me, though.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 5

aignatovich
Advisor
Advisor

PickPoint provides coordinates relative to project origin, not the active workplane

pickpoint.png

0 Likes