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:
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?
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
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 Modulewww.nxjournaling.com
RE: NXOpen Angle measurement
I am getting the "oldface" like this (TopSkinSurface is a broken wave linked face feature):
CODE --> C#
and my "face1" is from a user selection in the displayPart (using a block UI styler dialog):
CODE --> C#
does the measureManager require that both objects be in the workPart?