예제 #1
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));
        }
예제 #2
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));
        }