Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public static void Locomotive(Model model)
        {
            Region r1 = Region.CreateRectangle(110, 38);

#if NURBS
            Region r2 = Region.CreateRectangle(0, 19, 8, 19);
#else
            Ellipse el = new Ellipse(0, 19, 0, 8, 19);
            el.Regen(1);
            Region r2 = new Region(new LinearPath(el.Vertices), Plane.XY, false);
#endif
            Region u1 = Region.Union(r1, r2)[0];

            Region r3 = Region.CreateCircle(17, -6, 9);

            Region u2 = Region.Union(u1, r3)[0];

            r3.Translate(20, 0, 0);

            Region u3 = Region.Union(u2, r3)[0];

            Region r4 = Region.CreateCircle(70, 0, 15);

            Region u4 = Region.Union(u3, r4)[0];

            Region r5 = Region.CreateCircle(50, 38, 10);

            Region u5 = Region.Union(u4, r5)[0];

            Region r6 = Region.CreateRectangle(79, 36, 44, 14);

            Region u6 = Region.Union(u5, r6)[0];

            Region r7 = Region.CreateRectangle(-11, 14, 10, 10);

            Region u7 = Region.Union(u6, r7)[0];

            Region r8 = Region.CreatePolygon(new Point2D(-15, -8), new Point2D(4, -8), new Point2D(4, 8));

            Region u8 = Region.Union(u7, r8)[0];

            Region r9 = Region.CreatePolygon(new Point2D(20, 20), new Point2D(32, 62), new Point2D(26, 72), new Point2D(14, 72), new Point2D(8, 62));

            Region u9 = Region.Union(u8, r9)[0];

            model.Entities.Add(u9, Color.IndianRed);
        }