Cap

Line l1 = new Line(0, 81, 8, 81);
Line l2 = new Line(8, 81, 8, 72);
Arc a1 = new Arc(0, 45, 0, 32, Utility.DegToRad(90), 0);

Curve.Trim(l2, a1, false, true);

CompositeCurve cc1 = new CompositeCurve(l1, l2, a1,
    new Line(32, 45, 32, 28.5),
    new Line(32, 28.5, 63, 28.5),
    new Line(63, 28.5, 63, 37.5),
    new Line(63, 37.5, 71, 37.5),
    new Line(71, 37.5, 71, 0),
    new Line(71, 0, 0, 0),
    new Line(0, 0, 0, 75.5),
    new Line(0, 75.5, 4, 75.5),
    new Line(4, 75.5, 4, 78.5),
    new Line(4, 78.5, 0, 78.5),
    new Line(0, 78.5, 0, 81)
    );

Region reg1 = new Region(cc1);

Solid3D rev1 = reg1.RevolveAsSolid3D(Utility.DegToRad(360), Vector3D.AxisX, Point3D.Origin);

viewportLayout.Entities.Add(rev1, 0, Color.Red);

Region ssr1 = new SlotShapedRegion(Plane.YZ, 173, 10, true);

Region c1 = new CircularRegion(Plane.YZ, -86.5, 0, 3.5);
Region c2 = new CircularRegion(Plane.YZ, +86.5, 0, 3.5);

Region diff1 = Region.Difference(ssr1, c1, c2);

diff1.Translate(8, 0, 0);

Region copy1 = (Region)diff1.Clone();

rev1.ExtrudeAdd(diff1, 7);

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

rev1.ExtrudeAdd(copy1, 7);

LinearPath lp1 = new LinearPath(Plane.XY, new Point2D[] { new Point2D(28, 22.75), new Point2D(54, 22.75), new Point2D(28, 47.5), new Point2D(28, 22.75) });

Region reg2 = new Region(lp1);

rev1.ExtrudeAddPattern(reg2, new Interval(-2.5, 2.5), Vector3D.AxisX, Point3D.Origin, Utility.DegToRad(90), 4);

CompositeCurve cc3 = new CompositeCurve(
    new Arc(Plane.XY, new Point2D(0, 45), 28, Utility.DegToRad(90), 0),
  new Line(28, 45, 28, 20),
  new Line(28, 20, 36, 20),
  new Line(36, 20, 39, 22.5),
  new Line(39, 22.5, 71, 22.5),
  new Line(71, 22.5, 71, 0),
  new Line(71, 0, 0, 0),
  new Line(0, 0, 0, 73)
  );

Region reg3 = new Region(cc3);

rev1.RevolveRemove(reg3, Utility.DegToRad(360), Vector3D.AxisX, Point3D.Origin);

CircularRegion cr3 = new CircularRegion(Plane.YZ, 32, 0, 2.5);

cr3.Rotate(Utility.DegToRad(45), Vector3D.AxisX, Point3D.Origin);

cr3.Translate(62, 0, 0);

rev1.ExtrudeRemovePattern(cr3, 20, Vector3D.AxisX, Point3D.Origin, Utility.DegToRad(90), 4);

viewportLayout.Entities.Regen();
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.