Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

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

Status
Not open for further replies.

biw01

Automotive
Dec 31, 2011
152
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:
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:
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
 
Replies continue below

Recommended for you

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

Part and Inventory Search

Sponsor