示例#1
0
        internal static Snap.NX.Chamfer CreateChamfer(Snap.NX.Edge edge, Snap.Number distance1, Snap.Number distance2, bool offsetFaces)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ChamferBuilder featureBuilder = workPart.Features.CreateChamferBuilder(null);
            featureBuilder.Option = NXOpen.Features.ChamferBuilder.ChamferOption.TwoOffsets;
            if (offsetFaces)
            {
                featureBuilder.Method = NXOpen.Features.ChamferBuilder.OffsetMethod.FacesAndTrim;
            }
            else
            {
                featureBuilder.Method = NXOpen.Features.ChamferBuilder.OffsetMethod.EdgesAlongFaces;
            }
            featureBuilder.FirstOffset  = distance1.ToString();
            featureBuilder.SecondOffset = distance2.ToString();
            //featureBuilder.Tolerance = Globals.DistanceTolerance;
            ScCollector     collector = workPart.ScCollectors.CreateCollector();
            EdgeTangentRule rule      = workPart.ScRuleFactory.CreateRuleEdgeTangent((NXOpen.Edge)edge, null, false, Globals.AngleTolerance, false, false);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.SmartCollector = collector;
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.Chamfer)feature);
        }
示例#2
0
        internal static Snap.NX.EdgeBlend CreateEdgeBlend(Snap.Number radius, Snap.NX.Edge[] edges)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.EdgeBlendBuilder featureBuilder = workPart.Features.CreateEdgeBlendBuilder(null);
            BlendLimitsData limitsListData = featureBuilder.LimitsListData;
            ScCollector     collector      = workPart.ScCollectors.CreateCollector();

            NXOpen.Edge[] seedEdges = new NXOpen.Edge[edges.Length];
            for (int i = 0; i < seedEdges.Length; i++)
            {
                seedEdges[i] = (NXOpen.Edge)edges[i];
            }
            EdgeMultipleSeedTangentRule rule = workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(seedEdges, Globals.AngleTolerance, true);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.Tolerance              = Globals.DistanceTolerance;
            featureBuilder.AllInstancesOption     = false;
            featureBuilder.RemoveSelfIntersection = true;
            featureBuilder.ConvexConcaveY         = false;
            featureBuilder.RollOverSmoothEdge     = true;
            featureBuilder.RollOntoEdge           = true;
            featureBuilder.MoveSharpEdge          = true;
            featureBuilder.TrimmingOption         = false;
            featureBuilder.OverlapOption          = NXOpen.Features.EdgeBlendBuilder.Overlap.AnyConvexityRollOver;
            featureBuilder.BlendOrder             = NXOpen.Features.EdgeBlendBuilder.OrderOfBlending.ConvexFirst;
            featureBuilder.SetbackOption          = NXOpen.Features.EdgeBlendBuilder.Setback.SeparateFromCorner;
            featureBuilder.AddChainset(collector, radius.ToString());
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.EdgeBlend)feature);
        }
示例#3
0
 internal static Snap.NX.Sphere CreateSphere(Snap.NX.Point center, Snap.Number diameter)
 {
     NXOpen.Features.SphereBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateSphereBuilder(null);
     featureBuilder.Diameter.RightHandSide = diameter.ToString();
     featureBuilder.CenterPoint            = center.NXOpenPoint;
     featureBuilder.BooleanOption.Type     = BooleanOperation.BooleanType.Create;
     NXOpen.Features.Sphere sphere = (NXOpen.Features.Sphere)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.Sphere(sphere));
 }
示例#4
0
 internal static Snap.NX.Cylinder CreateCylinder(Snap.NX.ICurve arc, Snap.Number height)
 {
     NXOpen.Features.CylinderBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateCylinderBuilder(null);
     featureBuilder.Type = NXOpen.Features.CylinderBuilder.Types.ArcAndHeight;
     featureBuilder.BooleanOption.Type   = BooleanOperation.BooleanType.Create;
     featureBuilder.Arc.Value            = arc.NXOpenICurve;
     featureBuilder.Height.RightHandSide = height.ToString();
     NXOpen.Features.Cylinder cylinder = (NXOpen.Features.Cylinder)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.Cylinder(cylinder));
 }
示例#5
0
        internal static Snap.NX.DatumPlane CreateDatumPlane(Snap.NX.ICurve curve, Snap.Number arcLength)
        {
            NXOpen.Features.DatumPlaneBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateDatumPlaneBuilder(null);
            NXOpen.Plane plane = featureBuilder.GetPlane();
            plane.SetMethod(PlaneTypes.MethodType.Frenet);
            NXOpen.NXObject[] geom = new NXOpen.NXObject[] { (NXOpen.NXObject)curve.NXOpenICurve };
            plane.SetGeometry(geom);
            plane.SetFrenetSubtype(PlaneTypes.FrenetSubtype.Tangent);
            plane.SetPercent(true);
            plane.SetExpression(arcLength.ToString());
            plane.Evaluate();
            DatumPlaneFeature datumPlaneFeature = (DatumPlaneFeature)Snap.NX.Feature.CommitFeature(featureBuilder);

            featureBuilder.Destroy();
            return(new Snap.NX.DatumPlane(datumPlaneFeature));
        }
示例#6
0
 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));
 }
示例#7
0
 internal static Snap.NX.OffsetFace CreateOffsetFace(Snap.NX.Face[] faces, Snap.Number distance, bool direction)
 {
     NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
     NXOpen.Features.OffsetFaceBuilder featureBuilder = workPart.Features.CreateOffsetFaceBuilder(null);
     featureBuilder.Distance.RightHandSide = distance.ToString();
     SelectionIntentRule[] rules = new SelectionIntentRule[faces.Length];
     for (int i = 0; i < faces.Length; i++)
     {
         NXOpen.Face[] boundaryFaces = new NXOpen.Face[0];
         rules[i] = workPart.ScRuleFactory.CreateRuleFaceTangent((NXOpen.Face)faces[i], boundaryFaces);
     }
     featureBuilder.FaceCollector.ReplaceRules(rules, false);
     featureBuilder.Direction = direction;
     NXOpen.Features.OffsetFace offsetFace = (NXOpen.Features.OffsetFace)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.OffsetFace(offsetFace));
 }
示例#8
0
 internal static Snap.NX.Tube CreateTube(Snap.NX.Curve spine, Snap.Number outerDiameter, Snap.Number innerDiameter, bool createBsurface)
 {
     NXOpen.Features.TubeBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateTubeBuilder(null);
     featureBuilder.Tolerance = Globals.DistanceTolerance;
     featureBuilder.OuterDiameter.RightHandSide = outerDiameter.ToString();
     featureBuilder.InnerDiameter.RightHandSide = innerDiameter.ToString();
     featureBuilder.OutputOption = NXOpen.Features.TubeBuilder.Output.MultipleSegments;
     if (createBsurface)
     {
         featureBuilder.OutputOption = NXOpen.Features.TubeBuilder.Output.SingleSegment;
     }
     ((Snap.NX.Section)featureBuilder.PathSection).AddICurve(new Snap.NX.ICurve[] { spine });
     featureBuilder.BooleanOption.Type = BooleanOperation.BooleanType.Create;
     NXOpen.Features.Tube tube = (NXOpen.Features.Tube)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.Tube(tube));
 }
示例#9
0
        internal static Snap.NX.Torus CreateTorus(Snap.Position center, Snap.Orientation matrix, double majorRadius, double minorRadius, Box2d boxUV)
        {
            Vector axisX = matrix.AxisX;
            Vector axisZ = matrix.AxisZ;

            Snap.Orientation orientation = new Snap.Orientation(axisX, axisZ);
            Snap.Position    position    = center + ((Snap.Position)(majorRadius * matrix.AxisX));
            Snap.NX.Arc      arc         = Create.Arc(position, orientation, minorRadius, boxUV.MinV, boxUV.MaxV);
            Snap.NX.ICurve[] curves      = new Snap.NX.ICurve[] { arc };
            double           x           = matrix.AxisZ.X;
            double           y           = matrix.AxisZ.Y;
            double           z           = matrix.AxisZ.Z;
            string           str         = Snap.Number.ToString(boxUV.MinU);
            string           str2        = Snap.Number.ToString(boxUV.MaxU);

            Snap.Number[] angles = new Snap.Number[] { str, str2 };
            return(new Snap.NX.Torus(Create.RevolveSheet(curves, center, matrix.AxisZ, angles).NXOpenRevolve));
        }
示例#10
0
        internal static Snap.NX.Chamfer CreateChamfer(Snap.NX.Edge edge, Snap.Number distance, Snap.Number angle)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ChamferBuilder featureBuilder = workPart.Features.CreateChamferBuilder(null);
            featureBuilder.Option      = NXOpen.Features.ChamferBuilder.ChamferOption.OffsetAndAngle;
            featureBuilder.FirstOffset = distance.ToString();
            featureBuilder.Angle       = angle.ToString();
            //featureBuilder.Tolerance = Globals.DistanceTolerance;
            ScCollector     collector = workPart.ScCollectors.CreateCollector();
            EdgeTangentRule rule      = workPart.ScRuleFactory.CreateRuleEdgeTangent((NXOpen.Edge)edge, null, true, Globals.AngleTolerance, false, false);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.SmartCollector = collector;
            featureBuilder.AllInstances   = false;
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.Chamfer)feature);
        }
示例#11
0
 internal static Snap.NX.Thicken CreateThicken(Snap.NX.Body[] targetBodies, Snap.Number offset1, Snap.Number offset2)
 {
     NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
     NXOpen.Features.ThickenBuilder featureBuilder = workPart.Features.CreateThickenBuilder(null);
     featureBuilder.Tolerance = Globals.DistanceTolerance;
     featureBuilder.FirstOffset.RightHandSide  = offset1.ToString();
     featureBuilder.SecondOffset.RightHandSide = offset2.ToString();
     featureBuilder.BooleanOperation.Type      = BooleanOperation.BooleanType.Create;
     NXOpen.Body[] bodyArray = new NXOpen.Body[targetBodies.Length];
     for (int i = 0; i < targetBodies.Length; i++)
     {
         bodyArray[i] = (NXOpen.Body)targetBodies[i];
     }
     featureBuilder.BooleanOperation.SetTargetBodies(bodyArray);
     SelectionIntentRule[] rules = new SelectionIntentRule[targetBodies.Length];
     for (int j = 0; j < targetBodies.Length; j++)
     {
         rules[j] = workPart.ScRuleFactory.CreateRuleFaceBody((NXOpen.Body)targetBodies[j]);
     }
     featureBuilder.FaceCollector.ReplaceRules(rules, false);
     NXOpen.Features.Thicken thicken = (NXOpen.Features.Thicken)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.Thicken(thicken));
 }
示例#12
0
 internal static Snap.NX.OffsetCurve CreateOffsetCurve(Snap.NX.ICurve[] curves, Snap.Number distance, bool reverseDirection)
 {
     NXOpen.Features.OffsetCurveBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateOffsetCurveBuilder(null);
     featureBuilder.Type = NXOpen.Features.OffsetCurveBuilder.Types.Distance;
     featureBuilder.InputCurvesOptions.InputCurveOption = CurveOptions.InputCurve.Retain;
     featureBuilder.Tolerance  = Globals.DistanceTolerance;
     featureBuilder.TrimMethod = NXOpen.Features.OffsetCurveBuilder.TrimOption.ExtendTangents;
     featureBuilder.CurvesToOffset.DistanceTolerance = Globals.DistanceTolerance;
     featureBuilder.CurvesToOffset.AngleTolerance    = Globals.AngleTolerance;
     featureBuilder.CurvesToOffset.ChainingTolerance = (Globals.UnitType == Globals.Unit.Millimeter) ? 0.02413 : 0.00095;
     featureBuilder.CurvesToOffset.SetAllowedEntityTypes(NXOpen.SectionEx.AllowTypes.OnlyCurves);
     featureBuilder.CurvesToOffset.AllowSelfIntersection(true);
     featureBuilder.OffsetDistance.RightHandSide = distance.ToString();
     featureBuilder.ReverseDirection             = reverseDirection;
     Snap.NX.Section curvesToOffset = featureBuilder.CurvesToOffset;
     for (int i = 0; i < curves.Length; i++)
     {
         curvesToOffset.AddICurve(curves);
     }
     NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(feature as NXOpen.Features.OffsetCurve);
 }
示例#13
0
 internal static Snap.NX.Sphere CreateSphere(Position center, Snap.Number diameter)
 {
     return(CreateSphere(Snap.NX.Point.CreatePointInvisible(center), diameter));
 }
示例#14
0
 internal ExpressionNumber(string name, Snap.Number rightHandSide, Snap.NX.Unit unit)
 {
     NXOpen.Part nXOpenWorkPart = Globals.NXOpenWorkPart;
     base.nxopenExpression = nXOpenWorkPart.Expressions.CreateWithUnits(name + "=" + rightHandSide.ToString(), unit.NXOpenUnit);
 }
示例#15
0
        internal static Snap.NX.Extrude CreateExtrude(Snap.NX.Section section, Vector axis, Snap.Number[] extents, Snap.Number draftAngle, bool offset, Snap.Number[] offsetValues, bool createSheet)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ExtrudeBuilder featureBuilder = workPart.Features.CreateExtrudeBuilder(null);
            featureBuilder.DistanceTolerance     = Globals.DistanceTolerance;
            featureBuilder.BooleanOperation.Type = BooleanOperation.BooleanType.Create;
            if (createSheet)
            {
                featureBuilder.FeatureOptions.BodyType = FeatureOptions.BodyStyle.Sheet;
            }
            featureBuilder.Limits.StartExtend.Value.RightHandSide = extents[0].ToString();
            featureBuilder.Limits.EndExtend.Value.RightHandSide   = extents[1].ToString();
            featureBuilder.Offset.Option = NXOpen.GeometricUtilities.Type.NoOffset;
            if (offset)
            {
                featureBuilder.Offset.Option = NXOpen.GeometricUtilities.Type.NonsymmetricOffset;
                featureBuilder.Offset.StartOffset.RightHandSide = offsetValues[0].ToString();
                featureBuilder.Offset.EndOffset.RightHandSide   = offsetValues[1].ToString();
            }
            double num = Snap.Number.Parse(Snap.Number.NullToZero(draftAngle).ToString());

            if (System.Math.Abs(num) < 0.001)
            {
                featureBuilder.Draft.DraftOption = SimpleDraft.SimpleDraftType.NoDraft;
            }
            else
            {
                featureBuilder.Draft.DraftOption = SimpleDraft.SimpleDraftType.SimpleFromProfile;
            }
            featureBuilder.Draft.FrontDraftAngle.RightHandSide = Snap.Number.ToString(num);
            featureBuilder.Section = (NXOpen.Section)section;
            Point3d  origin = new Point3d(30.0, 0.0, 0.0);
            Vector3d vector = new Vector3d(axis.X, axis.Y, axis.Z);

            NXOpen.Direction direction = workPart.Directions.CreateDirection(origin, vector, SmartObject.UpdateOption.WithinModeling);
            featureBuilder.Direction = direction;
            NXOpen.Features.Extrude extrude = (NXOpen.Features.Extrude)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return(new Snap.NX.Extrude(extrude));
        }
示例#16
0
 internal static Snap.NX.OffsetCurve CreateOffsetCurve(Snap.NX.ICurve[] curves, Snap.Number height, Snap.Number angle, Position helpPoint, Vector helpVector)
 {
     NXOpen.Features.OffsetCurveBuilder builder = Globals.WorkPart.NXOpenPart.Features.CreateOffsetCurveBuilder(null);
     builder.Type = NXOpen.Features.OffsetCurveBuilder.Types.Draft;
     builder.InputCurvesOptions.InputCurveOption = CurveOptions.InputCurve.Retain;
     builder.Tolerance = Globals.DistanceTolerance;
     builder.DraftHeight.RightHandSide = height.ToString();
     builder.DraftAngle.RightHandSide  = angle.ToString();
     ((Snap.NX.Section)builder.CurvesToOffset).AddICurve(curves);
     builder.ReverseDirection = IsReverseDirection(builder, curves, helpPoint, helpVector);
     NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(builder);
     builder.CurvesToOffset.CleanMappingData();
     builder.Destroy();
     return(feature as NXOpen.Features.OffsetCurve);
 }
示例#17
0
 internal static Snap.NX.OffsetCurve CreateOffsetCurve(Snap.NX.ICurve[] curves, Snap.Number distance, Position helpPoint, Vector helpVector)
 {
     NXOpen.Features.OffsetCurveBuilder builder = Globals.WorkPart.NXOpenPart.Features.CreateOffsetCurveBuilder(null);
     builder.Type = NXOpen.Features.OffsetCurveBuilder.Types.Distance;
     builder.InputCurvesOptions.InputCurveOption = CurveOptions.InputCurve.Retain;
     builder.Tolerance = Globals.DistanceTolerance;
     //builder.CurveFitData.AngleTolerance = Globals.AngleTolerance;
     builder.CurvesToOffset.SetAllowedEntityTypes(NXOpen.SectionEx.AllowTypes.OnlyCurves);
     builder.CurvesToOffset.AllowSelfIntersection(true);
     builder.OffsetDistance.RightHandSide = distance.ToString();
     ((Snap.NX.Section)builder.CurvesToOffset).AddICurve(curves);
     builder.ReverseDirection = IsReverseDirection(builder, curves, helpPoint, helpVector);
     NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(builder);
     builder.Destroy();
     return(feature as NXOpen.Features.OffsetCurve);
 }
示例#18
0
        internal static Snap.NX.Cylinder CreateCylinder(Position axisPoint, Vector axisVector, Snap.Number height, Snap.Number diameter)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.CylinderBuilder featureBuilder = workPart.Features.CreateCylinderBuilder(null);
            featureBuilder.Type = NXOpen.Features.CylinderBuilder.Types.AxisDiameterAndHeight;
            featureBuilder.BooleanOption.Type     = BooleanOperation.BooleanType.Create;
            featureBuilder.Diameter.RightHandSide = diameter.ToString();
            featureBuilder.Height.RightHandSide   = height.ToString();
            Position  origin    = Position.Origin;
            Direction direction = workPart.Directions.CreateDirection((Point3d)origin, (Vector3d)axisVector, SmartObject.UpdateOption.WithinModeling);

            featureBuilder.Axis.Direction = direction;
            featureBuilder.Axis.Point     = workPart.Points.CreatePoint((Point3d)axisPoint);
            NXOpen.Features.Cylinder cylinder = (NXOpen.Features.Cylinder)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return(new Snap.NX.Cylinder(cylinder));
        }
示例#19
0
        internal static Snap.NX.FaceBlend CreateFaceBlend(Snap.NX.Face face1, Snap.NX.Face face2, Snap.Number radius)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.FaceBlendBuilder featureBuilder = workPart.Features.CreateFaceBlendBuilder(null);
            featureBuilder.Tolerance = Globals.DistanceTolerance;
            ScCollector collector = workPart.ScCollectors.CreateCollector();

            NXOpen.Face[]   boundaryFaces = new NXOpen.Face[0];
            FaceTangentRule rule          = workPart.ScRuleFactory.CreateRuleFaceTangent((NXOpen.Face)face1, boundaryFaces, 0.5);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.FirstFaceCollector     = collector;
            featureBuilder.ReverseFirstFaceNormal = true;
            ScCollector collector2 = workPart.ScCollectors.CreateCollector();

            NXOpen.Face[]   faceArray2 = new NXOpen.Face[0];
            FaceTangentRule rule2      = workPart.ScRuleFactory.CreateRuleFaceTangent((NXOpen.Face)face2, faceArray2, 0.5);

            SelectionIntentRule[] ruleArray2 = new SelectionIntentRule[] { rule2 };
            collector2.ReplaceRules(ruleArray2, false);
            featureBuilder.SecondFaceCollector     = collector2;
            featureBuilder.ReverseSecondFaceNormal = true;
            featureBuilder.CircularCrossSection.SetRadius(radius.ToString());
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.FaceBlend)feature);
        }
示例#20
0
        internal static Snap.NX.Block CreateBlock(Position origin, Orientation matrix, Snap.Number xLength, Snap.Number yLength, Snap.Number zLength)
        {
            Orientation wcsOrientation = Globals.WcsOrientation;

            Globals.WcsOrientation = matrix;
            BlockFeatureBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateBlockFeatureBuilder(null);

            featureBuilder.Type = BlockFeatureBuilder.Types.OriginAndEdgeLengths;
            featureBuilder.BooleanOption.Type = BooleanOperation.BooleanType.Create;
            featureBuilder.SetOriginAndLengths((Point3d)origin, xLength.ToString(), yLength.ToString(), zLength.ToString());
            NXOpen.Features.Block block = (NXOpen.Features.Block)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            Globals.WcsOrientation = wcsOrientation;
            return(new Snap.NX.Block(block));
        }
示例#21
0
        internal static Snap.NX.Block CreateBlock(Orientation matrix, Position originPoint, Position cornerPoint, Snap.Number height)
        {
            NXOpen.Part workPart       = (NXOpen.Part)Globals.WorkPart;
            Orientation wcsOrientation = Globals.WcsOrientation;

            Globals.WcsOrientation = matrix;
            BlockFeatureBuilder featureBuilder = workPart.Features.CreateBlockFeatureBuilder(null);

            featureBuilder.Type = BlockFeatureBuilder.Types.TwoPointsAndHeight;
            featureBuilder.BooleanOption.Type = BooleanOperation.BooleanType.Create;
            featureBuilder.SetTwoPointsAndHeight((Point3d)originPoint, (Point3d)cornerPoint, height.ToString());
            NXOpen.Features.Block block = (NXOpen.Features.Block)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            Globals.WcsOrientation = wcsOrientation;
            return(new Snap.NX.Block(block));
        }
示例#22
0
 internal static Snap.NX.OffsetCurve CreateOffsetCurve(Snap.NX.ICurve[] icurves, Snap.Number height, Snap.Number angle, bool reverseDirection)
 {
     NXOpen.Features.OffsetCurveBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateOffsetCurveBuilder(null);
     featureBuilder.Type = NXOpen.Features.OffsetCurveBuilder.Types.Draft;
     featureBuilder.InputCurvesOptions.InputCurveOption = CurveOptions.InputCurve.Retain;
     featureBuilder.Tolerance = Globals.DistanceTolerance;
     featureBuilder.DraftHeight.RightHandSide = height.ToString();
     featureBuilder.DraftAngle.RightHandSide  = angle.ToString();
     featureBuilder.ReverseDirection          = reverseDirection;
     Snap.NX.Section curvesToOffset = featureBuilder.CurvesToOffset;
     for (int i = 0; i < icurves.Length; i++)
     {
         curvesToOffset.AddICurve(icurves);
     }
     NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.CurvesToOffset.CleanMappingData();
     featureBuilder.Destroy();
     return(feature as NXOpen.Features.OffsetCurve);
 }
示例#23
0
        internal static Snap.NX.Cone CreateConeFromDiametersHeight(Position axisPoint, Vector direction, Snap.Number baseDiameter, Snap.Number topDiameter, Snap.Number height)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ConeBuilder featureBuilder = workPart.Features.CreateConeBuilder(null);
            featureBuilder.BooleanOption.Type = BooleanOperation.BooleanType.Create;
            featureBuilder.Type = NXOpen.Features.ConeBuilder.Types.DiametersAndHeight;
            Direction direction2 = workPart.Directions.CreateDirection((Point3d)axisPoint, (Vector3d)direction, SmartObject.UpdateOption.WithinModeling);

            NXOpen.Axis axis = featureBuilder.Axis;
            axis.Direction = direction2;
            axis.Point     = workPart.Points.CreatePoint((Point3d)axisPoint);
            featureBuilder.BaseDiameter.RightHandSide = baseDiameter.ToString();
            featureBuilder.TopDiameter.RightHandSide  = topDiameter.ToString();
            featureBuilder.Height.RightHandSide       = height.ToString();
            NXOpen.Features.Cone cone = (NXOpen.Features.Cone)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return(new Snap.NX.Cone(cone));
        }