Пример #1
0
        public static void Pocket(Model model)
        {
            Point2D[] pts = new Point2D[]
            {
                new Point2D(0, 0),
                new Point2D(40, 0),
                new Point2D(40, 20),
                new Point2D(60, 20),
                new Point2D(60, 10),
                new Point2D(100, 10),
                new Point2D(100, 60),
                new Point2D(60, 60),
                new Point2D(60, 30),
                new Point2D(40, 30),
                new Point2D(40, 80),
                new Point2D(0, 80),
                new Point2D(0, 0),
            };

            LinearPath outerContour = new LinearPath(Plane.XY, pts);

            outerContour.LineWeightMethod = colorMethodType.byEntity;
            outerContour.LineWeight       = 3;

            model.Entities.Add(outerContour, Color.OrangeRed);

            Circle innerContour = new Circle(20, 60, 0, 6);

            innerContour.LineWeightMethod = colorMethodType.byEntity;
            innerContour.LineWeight       = 3;

            model.Entities.Add(innerContour, Color.OrangeRed);

            Region r1 = new Region(new ICurve[] { outerContour, innerContour }, Plane.XY, true);

            ICurve[] passes = r1.Pocket(4, cornerType.Round, .1);

            const double zStep     = 2;
            const int    stepCount = 10;

            for (int i = 1; i < stepCount; i++)
            {
                foreach (Entity crv in passes)
                {
                    Entity en = (Entity)crv.Clone();
                    en.Translate(0, 0, -i * zStep);
                    model.Entities.Add(en, Color.DarkBlue);
                }
            }
        }