Public Sub TheOffsetCurveSub(ByVal inputCurve() As NXOpen.Curve, ByRef TagIndex As Integer, ByVal LinkTolerance As Double)
Dim workPart As Part = Sess.Parts.Work
Dim markId1 As Session.UndoMarkId
markId1 = Sess.SetUndoMark(Session.MarkVisibility.Visible, "Start")
Dim nullFeatures_Feature As Features.Feature = Nothing
If Not workPart.Preferences.Modeling.GetHistoryMode Then
Throw (New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free
Mode."))
End If
Dim OffsetCurveBuilder1 As Features.OffsetCurveBuilder
OffsetCurveBuilder1 = workPart.Features.CreateOffsetCurveBuilder(nullFeatures_Feature)
Dim markId2 As Session.UndoMarkId
markId2 = Sess.SetUndoMark(Session.MarkVisibility.Visible, "section mark")
Dim markId3 As Session.UndoMarkId
markId3 = Sess.SetUndoMark(Session.MarkVisibility.Visible, Nothing)
Dim curveDumbRule1 As CurveDumbRule
curveDumbRule1 = workPart.ScRuleFactory.CreateRuleCurveDumb(InputCurve)
OffsetCurveBuilder1.CurvesToOffset.AllowSelfIntersection(False)
Dim rules1(0) As SelectionIntentRule
rules1(0) = curveDumbRule1
Dim nullNXObject As NXObject = Nothing
Dim helpPoint1 As Point3d = New Point3d(0.0, 0.0, 0.0)
OffsetCurveBuilder1.CurvesToOffset.AddToSection(rules1, nullNXObject, nullNXObject, nullNXObject, helpPoint1,
NXOpen.Section.Mode.Create, True)
Sess.DeleteUndoMark(markId3, Nothing)
Dim markId4 As Session.UndoMarkId
markId4 = Sess.SetUndoMark(Session.MarkVisibility.Invisible, "Update Law Data")
Sess.DeleteUndoMarksUpToMark(markId4, "Update Law Data", False)
Sess.DeleteUndoMark(markId2, Nothing)
Dim markId5 As Session.UndoMarkId
markId5 = Sess.SetUndoMark(Session.MarkVisibility.Invisible, "Offset Curve")
Dim nXObject1 As NXObject
nXObject1 = OffsetCurveBuilder1.Commit
Dim objects1() As NXObject
objects1 = OffsetCurveBuilder1.GetCommittedObjects()
Sess.DeleteUndoMark(markId5, Nothing)
Sess.SetUndoMarkName(markId1, "Offset Curve")