internal static Snap.NX.DatumAxis CreateDatumAxis(Snap.Position startPoint, Snap.Position endPoint) { NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart; NXOpen.Features.DatumAxisBuilder featureBuilder = workPart.Features.CreateDatumAxisBuilder(null); featureBuilder.Type = NXOpen.Features.DatumAxisBuilder.Types.TwoPoints; featureBuilder.IsAssociative = true; featureBuilder.IsAxisReversed = false; featureBuilder.Point1 = workPart.Points.CreatePoint((Point3d)startPoint); featureBuilder.Point2 = workPart.Points.CreatePoint((Point3d)endPoint); NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder); featureBuilder.Destroy(); return(new Snap.NX.DatumAxis((DatumAxisFeature)feature)); }
internal static Snap.NX.DatumAxis CreateDatumAxis(Snap.Position origin, Vector direction) { NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart; NXOpen.Features.DatumAxisBuilder featureBuilder = workPart.Features.CreateDatumAxisBuilder(null); featureBuilder.Type = NXOpen.Features.DatumAxisBuilder.Types.PointAndDir; NXOpen.Direction direction2 = workPart.Directions.CreateDirection((Point3d)origin, (Vector3d)direction, SmartObject.UpdateOption.WithinModeling); featureBuilder.IsAssociative = true; featureBuilder.IsAxisReversed = false; featureBuilder.Vector = direction2; featureBuilder.Point = workPart.Points.CreatePoint((Point3d)origin); NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder); featureBuilder.Destroy(); return(new Snap.NX.DatumAxis((DatumAxisFeature)feature)); }
internal static Snap.NX.DatumAxis CreateDatumAxis(Snap.NX.ICurve icurve, Snap.Number arcLength, CurveOrientations curveOrientation) { NXOpen.Features.DatumAxisBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateDatumAxisBuilder(null); featureBuilder.Type = NXOpen.Features.DatumAxisBuilder.Types.OnCurveVector; featureBuilder.ArcLength.IsPercentUsed = true; featureBuilder.ArcLength.Expression.RightHandSide = arcLength.ToString(); featureBuilder.CurveOrientation = (NXOpen.Features.DatumAxisBuilder.CurveOrientations)curveOrientation; featureBuilder.IsAssociative = true; featureBuilder.IsAxisReversed = false; featureBuilder.Curve.Value = icurve.NXOpenICurve; featureBuilder.ArcLength.Path.Value = icurve.NXOpenTaggedObject; featureBuilder.ArcLength.Update(OnPathDimensionBuilder.UpdateReason.Path); NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder); featureBuilder.Destroy(); return(new Snap.NX.DatumAxis((DatumAxisFeature)feature)); }