×
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

How to retrieve the edge vertex values with respect to a component using NXOpen?

How to retrieve the edge vertex values with respect to a component using NXOpen?

How to retrieve the edge vertex values with respect to a component using NXOpen?

(OP)
Hello Everyone ,

Can someone suggest me a way to retrieve the edge vertex in terms of the associated component and not in terms of the part associated with it.

A sample of what i am able to do is mentioned below

CODE --> vb

For Each objComp As Component In FnGetAllComponentsInSession()
FnLoadPartFully(FnGetPartFromComponent(objComp))
        For Each body As Body In FnGetPartFromComponent(objComp).Bodies()
            For Each face As Face In body.GetFaces()
                For Each objEdge As Edge In face.GetEdges()
                            Dim objPoint1 As Point3d
                            Dim objPoint2 As Point3d
                            objEdge.GetVertices(objPoint1, objPoint2)
                next
            next
        next
next

 Public Function FnGetPartFromComponent(ByRef instance As NXOpen.Assemblies.Component) As NXOpen.Part
        Dim tag As NXOpen.Tag = -1
        FnGetUFSession.Part.AskTagOfDispName(instance.DisplayName, tag)
        Dim part As Part = FnGetNxSession().Parts.Work
        For Each prt As NXOpen.Part In FnGetNxSession().Parts
            If prt.Tag = tag Then
                FnGetPartFromComponent = prt
                Exit For
            End If
        Next
    End Function 

This returns me the edge vertex in terms of the associated part and not the component.

Also i tried doing the following to retrieve the rotation matrix , origin of each component using the method

CODE --> vb

For Each objComp As Component In FnGetAllComponentsInSession()
    'Position of component
     Dim dOrigin(2) As Double
    'Coordinate System Matrix
     Dim dCoOrdinateSysMat(8) As Double
     'Transformation Matrix
     Dim dTransformMatrix(3, 3) As Double
     Dim sRefSetName As String
     Dim sInstanceName As String
     'Output the rotation matrix
     ufs.Assem.AskComponentData(objComp.Tag, sCompName, sRefSetName, sInstanceName, dOrigin, dCoOrdinateSysMat, dTransformMatrix) 

How can i use the above fetched data to compute edge vertex in terms of component coordinate system ?

Please help ?

Thanks,
Amitabh

RE: How to retrieve the edge vertex values with respect to a component using NXOpen?

You can use the component rotation matrix and translation vector to transform the returned coordinates or take advantage of the fact that the display part controls the WCS. Make your assembly the display part, in turn make each component the work part; the coordinates returned will be in respect to the display part's (your assembly) coordinate system.

www.nxjournaling.com

RE: How to retrieve the edge vertex values with respect to a component using NXOpen?

(OP)
Thank you cowski for the suggestion.
I already did that to compute the data with respect to the component coordinate system , but yesterday only i found out that there is a much easier way to doing this by using the following API

CODE --> vb

Ctype(objComp.FindOccurrence(objEdge),Edge).GetVertices(objPoint1, objPoint2) 

This method provides me the data for the edge in the prototype part in the component coordinate system.

Thanks,
Amitabh

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