Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert and report 3d points in local co-ordinate system using NXOpen ?

Status
Not open for further replies.

biw01

Automotive
Dec 31, 2011
152
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.
Blade_hok70l.jpg


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
 
Replies continue below

Recommended for you

So do you want the distance between the other points to the point where you created a LCS?
 
I see at least 3 options here:
[ul]
[li]Temporarily move the WCS to the datum csys and use the Abs2WCS function that you already have.[/li]
[li]Compute the new point location by using MapPosition in conjunction with CreateCsysMappingMatrix.[/li]
[li]Use some linear algebra and create your own mapping functions.[/li]
[/ul]

www.nxjournaling.com
 
No, RSilva. I want the co-ordinates of the other hole centers in the new co-ordinate system.

Thanks,
Amitabh
 
Ok, cowski. I will look into these steps and check which one works out for me.
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
 
Move the WCS to the LCS and try this :
Code:
        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)
 
Suppose your local csys has origin Q, it's x-axis is U, and it's y-axis is V.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor