Convert and report 3d points in local co-ordinate system using NXOpen ?
Convert and report 3d points in local co-ordinate system using NXOpen ?
(OP)
Hello Everyone,
I have created a Local Co-ordinate System (LCS) in the Work part / Displayed part, on one of the Hole Center points. I need to get all the other hole center points (X,Y,Z) data with respect to this newly created Co-ordinate System.
Please refer to the image below.

How can I convert the point (X,Y,Z) values to the new co-ordinate system ?
I tried using both these function but it is not working, as it does not take as input the LCS that I have created in the part.
Function Abs2WCS(ByVal inPt As Point3d) As Point3d
Dim pt1(2), pt2(2) As Double
pt1(0) = inPt.X
pt1(1) = inPt.Y
pt1(2) = inPt.Z
ufs.Csys.MapPoint(UFConstants.UF_CSYS_ROOT_COORDS, pt1, _
UFConstants.UF_CSYS_ROOT_WCS_COORDS, pt2)
Abs2WCS.X = pt2(0)
Abs2WCS.Y = pt2(1)
Abs2WCS.Z = pt2(2)
End Function
Function WCS2Abs(ByVal inPt As Point3d) As Point3d
Dim pt1(2), pt2(2) As Double
pt1(0) = inPt.X
pt1(1) = inPt.Y
pt1(2) = inPt.Z
ufs.Csys.MapPoint(UFConstants.UF_CSYS_ROOT_WCS_COORDS, pt1, _
UFConstants.UF_CSYS_ROOT_COORDS, pt2)
WCS2Abs.X = pt2(0)
WCS2Abs.Y = pt2(1)
WCS2Abs.Z = pt2(2)
End Function
Please Help!
Thank you,
Amitabh





RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
www.nxjournaling.com
RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
Thanks,
Amitabh
RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
Thank you for the pointers. I was checking on to see, if there was a ready-made API that can do the mathematical transformations which I may not be aware of.
Thank you,
Amitabh
RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
CODE --> NX
Dim WcsIni(2) As Double Dim pt_ini(2) As Double pt_ini(0) = 0 pt_ini(1) = 0 pt_ini(2) = 0 theUfSession.Csys.MapPoint(UFConstants.UF_CSYS_ROOT_COORDS, pt_ini, UFConstants.UF_CSYS_ROOT_WCS_COORDS, WcsIni) Dim pt1(2), pt2(2) As Double pt1(0) = inPt.X pt1(1) = inPt.Y pt1(2) = inPt.Z Dim WcsPt(2) As Double theUfSession.Csys.MapPoint(UFConstants.UF_CSYS_ROOT_COORDS, pt1, UFConstants.UF_CSYS_ROOT_WCS_COORDS, WcsPt) Dim Pt_final(2) As Double Pt_final(0)=WcsPt(0)-WcsIni(0) Pt_final(1)=WcsPt(1)-WcsIni(1) Pt_final(2)=WcsPt(2)-WcsIni(2)RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
Then, given a point Q, its coordinates wrt to your local csys are:
x = (P - Q) * U
y = (P - Q) * V
Here "*" denotes a dot product of vectors.
The vector arithmetic is easy using SNAP functions. Somewhat clunkier using NX/Open.
RE: Convert and report 3d points in local co-ordinate system using NXOpen ?
www.nxjournaling.com