public virtual Snap.NX.Curve[] Divide(params double[] parameters) { Snap.NX.Curve curve = this.Copy(); Snap.NX.Part workPart = Globals.WorkPart; DivideCurveBuilder builder = workPart.NXOpenPart.BaseFeatures.CreateDivideCurveBuilder(null); builder.Type = DivideCurveBuilder.Types.ByBoundingObjects; BoundingObjectBuilder[] builderArray = new BoundingObjectBuilder[parameters.Length]; Snap.NX.Point[] nxObjects = new Snap.NX.Point[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { builderArray[i] = workPart.NXOpenPart.CreateBoundingObjectBuilder(); builderArray[i].BoundingPlane = null; builderArray[i].BoundingObjectMethod = BoundingObjectBuilder.Method.ProjectPoint; nxObjects[i] = Create.Point(curve.Position(parameters[i])); builderArray[i].BoundingProjectPoint = (NXOpen.Point)nxObjects[i]; builder.BoundingObjects.Append(builderArray[i]); } View workView = workPart.NXOpenPart.ModelingViews.WorkView; builder.DividingCurve.SetValue((NXOpen.Curve)curve, workView, (Point3d)curve.StartPoint); builder.Commit(); NXOpen.NXObject[] committedObjects = builder.GetCommittedObjects(); builder.Destroy(); Snap.NX.Curve[] curveArray = new Snap.NX.Curve[committedObjects.Length]; for (int j = 0; j < curveArray.Length; j++) { curveArray[j] = CreateCurve((NXOpen.Curve)committedObjects[j]); } Snap.NX.NXObject.Delete(nxObjects); return(curveArray); }
public Snap.NX.Spline[] Divide() { Snap.NX.Spline spline = this.Copy(); Snap.NX.Part workPart = Globals.WorkPart; DivideCurveBuilder builder = workPart.NXOpenPart.BaseFeatures.CreateDivideCurveBuilder(null); builder.Type = DivideCurveBuilder.Types.AtKnotpoints; builder.KnotPointMethod = DivideCurveBuilder.KnotPointOption.AllKnotpoints; builder.DividingCurve.SetValue(spline.NXOpenCurve, workPart.NXOpenPart.Views.WorkView, (Point3d)spline.StartPoint); builder.Commit(); NXOpen.NXObject[] committedObjects = builder.GetCommittedObjects(); builder.Destroy(); Snap.NX.Spline[] splineArray = new Snap.NX.Spline[committedObjects.Length]; for (int i = 0; i < committedObjects.Length; i++) { NXOpen.NXObject obj1 = committedObjects[i]; splineArray[i] = (NXOpen.Spline)committedObjects[i]; } return(splineArray); }