×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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 ?

So do you want the distance between the other points to the point where you created a LCS?

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

I see at least 3 options here:
  • Temporarily move the WCS to the datum csys and use the Abs2WCS function that you already have.
  • Compute the new point location by using MapPosition in conjunction with CreateCsysMappingMatrix.
  • Use some linear algebra and create your own mapping functions.

www.nxjournaling.com

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

(OP)
No, RSilva. I want the co-ordinates of the other hole centers in the new co-ordinate system.

Thanks,
Amitabh

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

(OP)
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

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

Move the WCS to the LCS and try this :

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 ?

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.

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

Or use the .MapPosition method and let the API do all the arithmetic for you.

www.nxjournaling.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources