Пример #1
0
        //Скетч внешнего кольца
        public PlanarSketch OutsideRing()
        {
            PlanarSketch sketch  = partCompDef.Sketches.Add(partCompDef.WorkPlanes[3]);
            SketchPoints points_ = sketch.SketchPoints;
            SketchArcs   arcs_   = sketch.SketchArcs;
            SketchLines  lines_  = sketch.SketchLines;

            points_.Add(transGeom.CreatePoint2d(0, D / 2));
            points_.Add(transGeom.CreatePoint2d(B / 2 - r, D / 2));
            points_.Add(transGeom.CreatePoint2d(B / 2 - r, D / 2 - r));
            points_.Add(transGeom.CreatePoint2d(B / 2, D / 2 - r));
            points_.Add(transGeom.CreatePoint2d(B / 2, D / 2 - r - 0.3 * D / 6.2));
            points_.Add(transGeom.CreatePoint2d(B / 2 - 0.1 * B / 2, D / 2 - r - 0.4 * D / 6.2));
            points_.Add(transGeom.CreatePoint2d(Dw / 2, (D / 2 - d / 2) / 2 + d / 2 + Dw / 2));
            points_.Add(transGeom.CreatePoint2d(-Dw / 2, (D / 2 - d / 2) / 2 + d / 2 + Dw / 2));
            lines_.AddByTwoPoints(points_[1], points_[2]);
            arcs_.AddByCenterStartEndPoint(points_[3], points_[2], points_[4], false);
            for (int i = 4; i < 6; i++)
            {
                lines_.AddByTwoPoints(points_[i], points_[i + 1]);
            }
            arcs_.AddByCenterStartEndPoint(transGeom.CreatePoint2d(0, 0), points_[8], points_[6], false);
            lines_[3].EndSketchPoint.Merge(arcs_[2].StartSketchPoint);
            lines_.AddByTwoPoints(arcs_[2].EndSketchPoint, points_[1]);
            center_line = sketch.SketchLines.AddByTwoPoints(transGeom.CreatePoint2d(-1, 0), transGeom.CreatePoint2d(1, 0));
            return(sketch);
        }
Пример #2
0
        public PlanarSketch Separator(double direction)
        {
            PlanarSketch sketch       = partCompDef.Sketches.Add(partCompDef.WorkPlanes[3]);
            SketchPoints points_      = sketch.SketchPoints;
            SketchArcs   arcs_        = sketch.SketchArcs;
            SketchLines  lines_       = sketch.SketchLines;
            Point2d      center_point = transGeom.CreatePoint2d(Dw / 2 * direction, (D / 2 - d / 2) / 2 + d / 2);
            SketchPoint  points       = sketch.SketchPoints.Add(transGeom.CreatePoint2d(Dw * direction, (D / 2 - d / 2) / 2 + d / 2));
            SketchPoint  points2      = sketch.SketchPoints.Add(transGeom.CreatePoint2d(0, (D / 2 - d / 2) / 2 + d / 2));

            center_line = sketch.SketchLines.AddByTwoPoints(points, points2);
            SketchArc      arc      = sketch.SketchArcs.AddByCenterStartEndPoint(center_point, points, points2, true);
            RevolveFeature revolve1 = Create_Revolve(sketch, PartFeatureOperationEnum.kNewBodyOperation);

            Create_Circular_Array(revolve1);
            sketch  = partCompDef.Sketches.Add(partCompDef.WorkPlanes[3]);
            points_ = sketch.SketchPoints;
            lines_  = sketch.SketchLines;
            points_.Add(transGeom.CreatePoint2d((Dw / 2 + 0.25) * direction, (D / 2 - d / 2) / 2 + d / 2 + 0.15));
            points_.Add(transGeom.CreatePoint2d(0, (D / 2 - d / 2) / 2 + d / 2 + 0.3));
            points_.Add(transGeom.CreatePoint2d(0, (D / 2 - d / 2) / 2 + d / 2 - 0.15));
            points_.Add(transGeom.CreatePoint2d(Dw / 2 * direction, (D / 2 - d / 2) / 2 + d / 2 - 0.1));
            for (int i = 1; i < 4; i++)
            {
                lines_.AddByTwoPoints(points_[i], points_[i + 1]);
            }
            ObjectCollection obj_collection = InventorApplication.TransientObjects.CreateObjectCollection();

            obj_collection.Add(sketch.SketchEntities[5]);
            obj_collection.Add(sketch.SketchEntities[6]);
            obj_collection.Add(sketch.SketchEntities[7]);
            sketch.OffsetSketchEntitiesUsingDistance(obj_collection, 0.1 * direction, false);
            lines_.AddByTwoPoints(sketch.SketchLines[1].StartSketchPoint, sketch.SketchLines[4].StartSketchPoint);
            lines_.AddByTwoPoints(sketch.SketchLines[3].EndSketchPoint, sketch.SketchLines[6].EndSketchPoint);
            center_line = sketch.SketchLines.AddByTwoPoints(transGeom.CreatePoint2d(-1, 0), transGeom.CreatePoint2d(1, 0));
            RevolveFeature revolve2 = Create_Revolve(sketch, PartFeatureOperationEnum.kNewBodyOperation);

            obj_collection = InventorApplication.TransientObjects.CreateObjectCollection();
            obj_collection.Add(revolve1.SurfaceBodies[1]);
            CombineFeature combine = partCompDef.Features.CombineFeatures.Add(revolve2.SurfaceBodies[1], obj_collection, PartFeatureOperationEnum.kCutOperation);

            return(sketch);
        }
Пример #3
0
        public PlanarSketch InsideRing()
        {
            PlanarSketch sketch  = partCompDef.Sketches.Add(partCompDef.WorkPlanes[3]);
            SketchPoints points_ = sketch.SketchPoints;
            SketchArcs   arcs_   = sketch.SketchArcs;
            SketchLines  lines_  = sketch.SketchLines;

            points_.Add(transGeom.CreatePoint2d(0, d / 2));
            points_.Add(transGeom.CreatePoint2d(B / 2 - r, d / 2));
            points_.Add(transGeom.CreatePoint2d(B / 2 - r, d / 2 + r));
            points_.Add(transGeom.CreatePoint2d(B / 2, d / 2 + r));
            points_.Add(transGeom.CreatePoint2d(B / 2, d / 2 + r + 0.25 * d / 3));
            points_.Add(transGeom.CreatePoint2d(B / 2 - 0.15 * B / 2, d / 2 + r + 0.40 * d / 3));
            points_.Add(transGeom.CreatePoint2d(B / 2 - 0.4 * B / 2, d / 2 + r + 0.40 * d / 3));
            points_.Add(transGeom.CreatePoint2d(0.2 * B / 2, d / 2 + r + 0.40 * d / 3));
            points_.Add(transGeom.CreatePoint2d(0, d / 2 + r + 0.40 * d / 3));
            points_.Add(transGeom.CreatePoint2d(Dw / 2, (D / 2 - d / 2) / 2 + d / 2));
            lines_.AddByTwoPoints(points_[1], points_[2]);
            arcs_.AddByCenterStartEndPoint(points_[3], points_[2], points_[4], true);
            for (int i = 4; i < 7; i++)
            {
                lines_.AddByTwoPoints(points_[i], points_[i + 1]);
            }
            lines_.AddByTwoPoints(points_[8], points_[9]);
            lines_.AddByTwoPoints(points_[9], points_[1]);
            arcs_.AddByCenterStartEndPoint(points_[10], points_[7], points_[8], false);
            sketch.GeometricConstraints.AddGround(sketch.SketchEntities[10]);
            arcs_[2].StartSketchPoint.Merge(points_[8]);
            arcs_[2].CenterSketchPoint.Merge(points_[10]);
            for (int i = 1; i < 6; i++)
            {
                sketch.GeometricConstraints.AddGround(sketch.SketchEntities[i]);
            }
            SketchEntity entity = sketch.SketchEntities[19];

            sketch.DimensionConstraints.AddRadius(entity, points_[1].Geometry);
            sketch.DimensionConstraints[1].Parameter.Value = Dw / 2;
            center_line = sketch.SketchLines.AddByTwoPoints(transGeom.CreatePoint2d(-1, 0), transGeom.CreatePoint2d(1, 0));
            return(sketch);
        }