GetClosestPointTo() on a BlockReference returns which coordinate system in AutoCAD using ObjectARX

By Fenton Webb

Issue

Why are the coordinates of a closest point (using GetClosestPointTo()) obtained from a block reference relative to neither WCS nor UCS?.

Solution

The points that you receive are relative to the coordinate system of the owning
AcDbBlockTableRecord. If you want to convert them to coordinate system of the
AcDbBlockTableRecord in which you have the AcDbBlockReference, you must
transform them by the AcDbBlockReference::blockTransform().

You probably first want to transform the "specified point" by the inverse of
AcDbBlockReference::blockTransform(), do the closest point calculation, then
convert the resulting point back to the original space.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading