×
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

NXOpen Angle measurement

NXOpen Angle measurement

NXOpen Angle measurement

(OP)
I am writing a macro to re-link wave linked faces, and to ensure the orientations align I am trying to measure the angle between the existing face and the new face.
I am getting an error on this line of code:

CODE --> C#

MeasureAngle ang = workPart.MeasureManager.NewAngle((Unit)workPart.UnitCollection.FindObject("Degrees"), oldface,MeasureManager.EndpointType.StartPoint, face1, MeasureManager.EndpointType.EndPoint, false); 

the error says:
NXOpen.NXException: Third parameter is invalid at NXOpen.MeasureManager.NewAngle(Unit units, DisplayableObject object1, EndpointType qualifier1, DisplayableObject object2, EndpointType qualifier2, Boolean minorAngle)

but I have tried all three options for the MeasureManager.EndpointType (StartPoint, None, and EndPoint). The documentation says that the qualifiers are only used for lines and edges though, so I dont' know why they affect anything when measuring two surfaces.

Any tips, or examples?

RE: NXOpen Angle measurement

I created a new part file with 2 datum planes and wrote a quick journal to measure the angle between them. It seems to work correctly no matter the EndpointType option that is used. Code below is VB, not that it should matter...

CODE

Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        If IsNothing(theSession.Parts.Work) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work

        Dim datumPlane1 As DatumPlane = CType(workPart.Datums.FindObject("DATUM_PLANE(1)"), DatumPlane)
        Dim datumPlane2 As DatumPlane = CType(workPart.Datums.FindObject("DATUM_PLANE(2)"), DatumPlane)

        Dim ang As MeasureAngle = workPart.MeasureManager.NewAngle(workPart.UnitCollection.FindObject("Degrees"), datumPlane1, MeasureManager.EndpointType.None, datumPlane2, MeasureManager.EndpointType.None, False)
        MsgBox(ang.Value)

    End Sub

End Module 

www.nxjournaling.com

RE: NXOpen Angle measurement

(OP)
do you think it could be something wrong with my surfaces then?
I am getting the "oldface" like this (TopSkinSurface is a broken wave linked face feature):

CODE --> C#

NXOpen.Features.ExtractFace topSurfaceFeature = (NXOpen.Features.ExtractFace)Utilities.GetNamedFeature(workPart, "TopSkinSurface");
workPart.Features.SetEditWithRollbackFeature(topSurfaceFeature);
theSession.UpdateManager.InterpartDelay = true;
topSurfaceFeature.MakeCurrentFeature();

Face oldface = topSurfaceFeature.GetFaces().First(); 

and my "face1" is from a user selection in the displayPart (using a block UI styler dialog):

CODE --> C#

Face face1 = (Face)face_select01.GetSelectedObjects().First(); 

does the measureManager require that both objects be in the workPart?

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