예제 #1
0
        public void TestCutBySketch(ErrorCodes errorCode, Obj3dType extrusionType, Direction_Type directionType)
        {
            var appTest = new KompasApplicationTest();
            var app     = appTest.CreateKompasApplication();
            var sketch  = CreateSketchWithCirle(app);

            var extrusionParameters = new KompasExtrusionParameters(app.ScrewPart, Obj3dType.o3d_baseExtrusion, sketch, directionType, 10);
            var extrusion           = new KompasExtrusion(extrusionParameters, ExtrusionType.ByEntity);

            Assert.AreEqual(extrusion.LastErrorCode, errorCode);

            Direction_Type cutExtrusionDirection = Direction_Type.dtBoth;

            if (directionType == Direction_Type.dtNormal)
            {
                cutExtrusionDirection = Direction_Type.dtReverse;
            }
            else if (directionType == Direction_Type.dtReverse)
            {
                cutExtrusionDirection = Direction_Type.dtNormal;
            }

            extrusionParameters = new KompasExtrusionParameters(app.ScrewPart, extrusionType, sketch, cutExtrusionDirection, 10);
            var cutExtrusion = new KompasExtrusion(extrusionParameters, ExtrusionType.ByEntity);

            Assert.AreEqual(cutExtrusion.LastErrorCode, errorCode);
        }
예제 #2
0
 /// <summary>
 /// Muffler parameters
 /// </summary>
 /// <param name="document3DPart">Part with detail in 3D document</param>
 /// <param name="basePlaneAxis">Axis of base plane of muffler</param>
 /// <param name="direction">Direction type of muffler</param>
 /// <param name="basePlanePoint">Point of base plane of muffler</param>
 public MufflerParameters(ksPart document3DPart, Obj3dType basePlaneAxis, Direction_Type direction, KompasPoint2D basePlanePoint)
 {
     Document3DPart = document3DPart;
     BasePlaneAxis  = basePlaneAxis;
     Direction      = direction;
     BasePlanePoint = basePlanePoint;
 }
예제 #3
0
        /// <summary>
        /// метод создания треугольника для крестообразного шлица
        /// </summary>
        /// <param name="width">длина </param>
        /// <param name="height">высота</param>
        /// <param name="planeType">плоскость</param>
        /// <param name="type">метод выдавливания</param>
        /// <param name="extrusionHeight">высота выдавливания</param>
        /// <returns></returns>
        private ksEntity DrawTriangle(
            Double width,
            Double height,
            Obj3dType planeType,
            Direction_Type type,
            Double extrusionHeight)
        {
            var regPolySketch     = new KompasSketch(_kompasApp.ScrewPart, planeType);
            var regPolySketchEdit = regPolySketch.BeginEntityEdit();

            regPolySketchEdit.ksLineSeg(0, width, 0, -width, 1);
            regPolySketchEdit.ksLineSeg(0, width, height, 0, 1);
            regPolySketchEdit.ksLineSeg(0, -width, height, 0, 1);
            regPolySketch.EndEntityEdit();

            var extrusionParameters = new KompasExtrusionParameters
                                      (
                _kompasApp.ScrewPart,
                Obj3dType.o3d_cutExtrusion,
                regPolySketch.Entity,
                type,
                extrusionHeight
                                      );

            var regPolyExtrusion = new KompasExtrusion(extrusionParameters,
                                                       ExtrusionType.ByEntity);

            return(regPolyExtrusion.ExtrudedEntity);
        }
예제 #4
0
 /// <summary>
 /// Rounded chamfer parameters
 /// </summary>
 /// <param name="document3DPart">Part with detail in 3D document</param>
 /// <param name="regularPolygonSketch">Sketch of regular polygon -- base of rounded chamfer</param>
 /// <param name="regularPolygonParameters">Parameters of regular polygon -- base of rounded chamfer</param>
 /// <param name="basePlanePoint">2D point of base plane</param>
 /// <param name="direction">Direction of rounded chamfer</param>
 public RoundedChamferParameters(ksPart document3DPart, ksEntity regularPolygonSketch, RegularPolygonParameter regularPolygonParameters, KompasPoint2D basePlanePoint, Direction_Type direction)
 {
     Document3DPart           = document3DPart;
     RegularPolygonSketch     = regularPolygonSketch;
     RegularPolygonParameters = regularPolygonParameters;
     BasePlanePoint           = basePlanePoint;
     Direction = direction;
 }
예제 #5
0
        /// <summary>
        /// Kompas extrusion parameters for extrusion by sketches collection
        /// </summary>
        /// <param name="document3DPart">Part with detail in 3d document</param>
        /// <param name="extrusionType">Type of extrusion</param>
        /// <param name="extrudableEntity">Extrudable (выдавливаЕМЫЙ) entity</param>
        /// <param name="sketchesCollection">Collection of extrudable sketches for types
        /// such as loft, evolution etc.</param>
        public KompasExtrusionParameters(ksPart document3DPart, Obj3dType extrusionType, ksEntity extrudableEntity, ksEntityCollection sketchesCollection)
        {
            Document3DPart     = document3DPart;
            ExtrusionType      = extrusionType;
            ExtrudableEntity   = extrudableEntity;
            SketchesCollection = sketchesCollection;

            Direction = Direction_Type.dtBoth;
            Depth     = default(double);
        }
예제 #6
0
        /// <summary>
        /// Kompas extrusion parameters for extrusion by entity
        /// </summary>
        /// <param name="document3DPart">Part with detail in 3d document</param>
        /// <param name="extrusionType">Type of extrusion</param>
        /// <param name="extrudableEntity">Extrudable (выдавливаЕМЫЙ) entity</param>
        /// <param name="direction">Type of direction of extrusion</param>
        /// <param name="depth">Depth of extrusion</param>
        public KompasExtrusionParameters(ksPart document3DPart, Obj3dType extrusionType, ksEntity extrudableEntity, Direction_Type direction, double depth)
        {
            Document3DPart   = document3DPart;
            ExtrusionType    = extrusionType;
            ExtrudableEntity = extrudableEntity;
            Direction        = direction;
            Depth            = depth;

            SketchesCollection = null;
        }
예제 #7
0
        public void TestBaseBySketch(ErrorCodes errorCode, Obj3dType extrusionType, Direction_Type directionType)
        {
            var appTest = new KompasApplicationTest();
            var app     = appTest.CreateKompasApplication();
            var sketch  = CreateSketchWithCirle(app);

            var extrusionParameters = new KompasExtrusionParameters(app.ScrewPart, extrusionType, sketch, directionType, 10);
            var extrusion           = new KompasExtrusion(extrusionParameters, ExtrusionType.ByEntity);

            Assert.AreEqual(extrusion.LastErrorCode, errorCode);
        }
예제 #8
0
        /// <summary>
        /// Метод выдавливания для гладкой части и резьбы
        /// </summary>
        /// <param name="screwBase"></param>
        /// <param name="type">тип выдавливания</param>
        /// <param name="extrusionHeight">высота выдавливания</param>
        /// <returns></returns>
        private ksEntity ExtrusionScrew(KompasSketch screwBase,
                                        Direction_Type type, Double extrusionHeight)
        {
            var extrusionParameters = new KompasExtrusionParameters
                                      (
                _kompasApp.ScrewPart,
                Obj3dType.o3d_baseExtrusion,
                screwBase.Entity,
                type,
                extrusionHeight
                                      );

            var screwCarvingExtrusion = new KompasExtrusion(extrusionParameters,
                                                            ExtrusionType.ByEntity);

            screwCarvingExtrusion.BaseFaceAreaState =
                KompasFaces.BaseFaceAreaState.BaseFaceAreaLower;

            var extruded = screwCarvingExtrusion.ExtrudedEntity;

            return(extruded);
        }