Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Change Global Co-ordinates to Local Co-ordinates using NXOpen?

Status
Not open for further replies.

biw01

Automotive
Dec 31, 2011
152
Hi All,

I have a program which works on a part and retrieves its edge vertices, However the code retrieves the co-ordinate values in global co-ordinates rather than local co-ordinates.

For Each objEdge As Edge In CType(objFeat, Extrude).GetEdges()
Dim objPoint1 As Point3d
Dim objPoint2 As Point3d
objEdge.GetVertices(objPoint1, objPoint2)
next

How can i retrieve the values in Local Co-ordinates system?

Please Help !!!

Regards,
Amitabh
 
Replies continue below

Recommended for you

Here is a code snippet from GTAC that will convert global coordinates to local:

Code:
'Date:  11/18/2010
'Subject:  Sample NX Open .NET Visual Basic routine : map point from absolute to wcs
'
'Note:  GTAC provides programming examples for illustration only, and
'assumes that you are familiar with the programming language being
'demonstrated and the tools used to create and debug procedures.  GTAC
'support professionals can help explain the functionality of a particular
'procedure, but we will not modify these examples to provide added
'functionality or construct procedures to meet your specific needs.

    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

And here is the related function that converts local to global:

Code:
'Date:  06/14/2011
'Subject:  Sample NX Open .NET Visual Basic routine : map point from WCS to absolute
'
'Note:  GTAC provides programming examples for illustration only, and
'assumes that you are familiar with the programming language being
'demonstrated and the tools used to create and debug procedures.  GTAC
'support professionals can help explain the functionality of a particular
'procedure, but we will not modify these examples to provide added
'functionality or construct procedures to meet your specific needs.

    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

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor