コード例 #1
0
        public static void Flange(Model model)
        {
            CompositeCurve cc1 = new CompositeCurve(
                new Line(Plane.XZ, 15, 40, 29, 40),
                new Arc(Plane.XZ, new Point2D(29, 39), 1, 0, Utility.DegToRad(90)),
                new Line(Plane.XZ, 30, 39, 30, 16),
                new Arc(Plane.XZ, new Point2D(36, 16), 6, Math.PI, Utility.DegToRad(270)),
                new Line(Plane.XZ, 36, 10, 79, 10),
                new Arc(Plane.XZ, new Point2D(79, 9), 1, 0, Utility.DegToRad(90)),
                new Line(Plane.XZ, 80, 9, 80, 6),
                new Arc(Plane.XZ, new Point2D(86, 6), 6, Utility.DegToRad(180), Utility.DegToRad(270)),
                new Line(Plane.XZ, 86, 0, 130, 0));

            Region reg = cc1.OffsetToRegion(5, 0, false);

            Brep rev1 = reg.RevolveAsBrep(Math.PI * 2, Vector3D.AxisZ, Point3D.Origin);

            model.Entities.Add(rev1, System.Drawing.Color.Aqua);

            Region cssr1 = Region.CreateCircularSlot(0, Utility.DegToRad(30), 60, 8);

            rev1.ExtrudeRemovePattern(cssr1, new Interval(0, 50), Point3D.Origin, Utility.DegToRad(360) / 3, 3);

            Region rr1 = Region.CreateRectangle(90, -40, 50, 80);

            rev1.ExtrudeRemovePattern(rr1, new Interval(0, 50), Point3D.Origin, Utility.DegToRad(360) / 2, 2);

            Region cr1 = Region.CreateCircle(110, 0, 10);

            const int numHoles = 8;

            rev1.ExtrudeRemovePattern(cr1, 50, Point3D.Origin, Utility.DegToRad(360) / numHoles, numHoles);

            model.Entities.Regen();
        }
コード例 #2
0
        public static void Bracket(Model model)
        {
            CompositeCurve rrscc1 = CompositeCurve.CreateRoundedRectangle(Plane.YZ, 40, 120, 12, true);

            CompositeCurve sscc1 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true);

            sscc1.Translate(0, 0, 43);

            CompositeCurve sscc2 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true);

            sscc2.Rotate(Utility.DegToRad(90), Vector3D.AxisX, Point3D.Origin);

            sscc2.Translate(0, 0, -40);

            Circle c1 = new Circle(Plane.YZ, 4.25);

            Region r1 = new Region(rrscc1, sscc1, sscc2, c1);

            Brep ext1 = r1.ExtrudeAsBrep(-4);

            model.Entities.Add(ext1, "Default", Color.YellowGreen);

            CompositeCurve cc1 = new CompositeCurve(
                new Line(Plane.YZ, 8, -10, 11, -10),
                new Arc(Plane.YZ, new Point2D(11, -5), 5, Utility.DegToRad(270), Utility.DegToRad(360)),
                new Line(Plane.YZ, 16, -5, 16, +5),
                new Arc(Plane.YZ, new Point2D(11, +5), 5, Utility.DegToRad(0), Utility.DegToRad(90)),
                new Line(Plane.YZ, 11, 10, -11, 10),
                new Arc(Plane.YZ, new Point2D(-11, +5), 5, Utility.DegToRad(90), Utility.DegToRad(180)),
                new Line(Plane.YZ, -16, +5, -16, -5),
                new Arc(Plane.YZ, new Point2D(-11, -5), 5, Utility.DegToRad(180), Utility.DegToRad(270)),
                new Line(Plane.YZ, -11, -10, -8, -10));

            Region r2 = cc1.OffsetToRegion(-2.5, 0, false);

            ext1.ExtrudeAdd(r2, 275);

            Region ssr2 = Region.CreateSlot(Plane.XY, 12, 5.25);

            ssr2.Translate(9, 0, 0);

            ext1.ExtrudeRemovePattern(ssr2, 10, 35, 8, 0, 1);

            model.Entities.Regen();
        }