🌶️ Modeling Practice Drawings 110

// Main polygon
CompositeCurve cc1 = new CompositeCurve(
    new Line(-34, 0, 34, 0),
    new Line(34, 0, 34, 59.4),
    new Arc(Plane.XY, new Point2D(0, 59.4), 34, Utility.DegToRad(0), Utility.DegToRad(180)),
    new Line(-34, 59.4, -34, 0));

devDept.Eyeshot.Entities.Region reg1 = new devDept.Eyeshot.Entities.Region(cc1);
Brep ext1 = reg1.ExtrudeAsBrep(new Interval(0, 26));

// Borders
devDept.Eyeshot.Entities.Region reg2 = devDept.Eyeshot.Entities.Region.CreateSlot(Plane.YX, 0, 0, 118.8, 24, 0, true);
reg2.FlipNormal();
ext1.ExtrudeRemove(reg2, new Interval(12, 27));

// Cylinder
devDept.Eyeshot.Entities.Region reg3 = devDept.Eyeshot.Entities.Region.CreateCircle(0, 59.4, 17);  
ext1.ExtrudeAdd(reg3, new Interval(12, 42));

// Hole
devDept.Eyeshot.Entities.Region reg4 = devDept.Eyeshot.Entities.Region.CreateCircle(0, 59.4, 6);            
ext1.ExtrudeRemove(reg4, new Interval(0, 42));

// Sketch 1
var sk1 = new devDept.Geometry.ConstraintSolver.Sketch();

// Add origin point
SketchPoint origin1 = sk1.AddOrigin();

// Lines
var l1 = sk1.AddLine(-34, 0, 34, 0);
var l2 = sk1.AddLine(34, 0, 0, -46);
var l3 = sk1.AddLine(0, -46, -40, -30);
var l4 = sk1.AddLine(-40, -30, -34, 0);
var l5 = sk1.AddLine(0, 0, -30, -15, false, true);

// Mid point
var p1 = sk1.AddPoint(0, 0);
sk1.AddConstraintMidPoint(p1, l1);

// Circles
var cir1 = sk1.AddCircle(-20, -30, 12, true);

// Hor/Ver constraints
sk1.AddConstraintHorizontal(l1);

// Join constraints
sk1.AddConstraintJoin(l1, l2);
sk1.AddConstraintJoin(l2, l3);
sk1.AddConstraintJoin(l3, l4);
sk1.AddConstraintJoin(l4, l1);
sk1.AddConstraintJoin(p1, origin1);
sk1.AddConstraintJoin(cir1.Center, l5.EndPoint);
sk1.AddConstraintJoin(l5.StartPoint, origin1);

// Parallel/Perperdicular constraints
sk1.AddConstraintParallel(l2, l4);
sk1.AddConstraintParallel(l2, l5);
sk1.AddConstraintPerpendicular(l2, l3);

// Angle constraint
sk1.AddConstraintAngle(l1, l2, Utility.DegToRad(60));

// Length constraints
sk1.AddConstraintLength(l1, 68);
sk1.AddConstraintLength(l5, 36);
sk1.AddConstraintDistance(origin1, l3, 56);

ext1.ExtrudeAdd(sk1, new Interval(0, 12));

// Central hole
devDept.Eyeshot.Entities.Region reg5 = devDept.Eyeshot.Entities.Region.CreateCircle(0, 0, 14);
ext1.ExtrudeRemove(reg5, new Interval(0, 12));

design1.Entities.Add(ext1, design1.Layers[0].Name, Color.SteelBlue);

image (3).png

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Articles in this section