图示:延长曲线
代码:正值延长负值缩短
var cl = workPart.Features.CreateCurvelengthBuilder(null);
cl.CurvelengthData.ExtensionMethod = NXOpen.GeometricUtilities.ExtensionMethod.Incremental;
cl.CurvelengthData.ExtensionSide = NXOpen.GeometricUtilities.ExtensionSide.StartEnd;
cl.CurvelengthData.ExtensionDirection = NXOpen.GeometricUtilities.ExtensionDirection.Natural;
//修改公差会报警
//cl.DistanceTolerance = 0.01;
NXOpen.Section section = workPart.Sections.CreateSection(0.00095, 0.001, 0.01);
section.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.OnlyCurves);
section.AllowSelfIntersection(true);
cl.Section = section;
NXOpen.IBaseCurve[] curves = curve.ToArrayBySingle();
NXOpen.CurveDumbRule curveDumbRule = workPart.ScRuleFactory.CreateRuleBaseCurveDumb(curves);
NXOpen.SelectionIntentRule[] rules = curveDumbRule.ToArrayBySingle();
NXOpen.Point3d helpPoint = position;
section.AddToSection(rules, curve, null, null, helpPoint, NXOpen.Section.Mode.Create, false);
cl.CurvelengthData.SetStartDistance("0");
cl.CurvelengthData.SetEndDistance("0");
cl.CurvelengthData.SetStartDistance($"{startLength}");
cl.CurvelengthData.SetEndDistance($"{endLength}");
var nxObject = cl.Commit();