Modeling Practice Drawings 153

Result3D.png

// Basic shape 
Line ln1 = new Line(Plane.YZ, 50, 90, 50, 0);
Line ln2 = new Line(Plane.YZ, 50, 0, 0, 0);
Line ln3 = new Line(Plane.YZ, 0, 0, 0, 90);
Line ln4 = new Line(Plane.YZ, 0, 90, 50, 90);

Arc arc = new Arc(Plane.YZ, new Point2D(25, 60), 30, 0, Math.PI);

Point3D[] ps = Curve.Intersection(arc, ln1);
ln1.TrimBy(ps[0], true);
arc.TrimBy(ps[0], true);

ps = Curve.Intersection(arc, ln3);
ln3.TrimBy(ps[0], false);
arc.TrimBy(ps[0], false);

CompositeCurve cc1 = new CompositeCurve(ln1, arc, ln2, ln3);

// Base brep
Brep ext1 = new devDept.Eyeshot.Entities.Region(cc1, Plane.YZ).ExtrudeAsBrep(50);

// Rounded rectangle to create the wings by removing the volume in the middle.
Line rectLine1 = new Line(Plane.XZ, 10, 15, 40, 15);
Line rectLine2 = new Line(Plane.XZ, 40, 15, 40, 100);
Line rectLine3 = new Line(Plane.XZ, 40, 100, 10, 100);
Line rectLine4 = new Line(Plane.XZ, 10, 100, 10, 15);
Arc fillet1, fillet2;
Curve.Fillet(rectLine1, rectLine2, 1.5, false, false, true, true, out fillet1);
Curve.Fillet(rectLine1, rectLine4, 1.5, true, true, true, true, out fillet2);

CompositeCurve cc2 = new CompositeCurve(rectLine1, rectLine2, fillet1, rectLine3, rectLine4, fillet2);
devDept.Eyeshot.Entities.Region reg1 = new devDept.Eyeshot.Entities.Region(cc2, Plane.ZX);

// Move reg1 below the brep and extrude it until above it, to be sure the operation will be successful
reg1.Translate(0, -2, 0);
ext1.ExtrudeRemove(reg1, 55);

// Smaller circle at the base, below the brep. Avoiding overlapping faces helps reducing the risk of failure of the extrudeRemove operation
devDept.Eyeshot.Entities.Region reg2 = devDept.Eyeshot.Entities.Region.CreateCircle(Plane.XY, new Point2D(25, 25), 10);
reg2.Translate(0, 0, -2);
ext1.ExtrudeRemove(reg2, 20);

// Bigger circle at the base
devDept.Eyeshot.Entities.Region reg3 = devDept.Eyeshot.Entities.Region.CreateCircle(Plane.XY, new Point2D(25, 25), 17.5);
ext1.ExtrudeRemove(reg3, 2);

// Smaller lateral circle
devDept.Eyeshot.Entities.Region reg4 = devDept.Eyeshot.Entities.Region.CreateCircle(Plane.YZ, new Point2D(17.5, 25), 2.5);
ext1.ExtrudeRemove(reg4, 50);

// Bigger lateral circle
devDept.Eyeshot.Entities.Region reg5 = devDept.Eyeshot.Entities.Region.CreateCircle(Plane.YZ, new Point2D(25, 65), 11);
ext1.ExtrudeRemove(reg5, 50);

// Shape to remove lateral volume, it exceeds the wing area for a small amount for the extrudeRemove operation
double z = 26 + 50 * Math.Sin(UtilityEx.DegToRad(20));

CompositeCurve cc3 = new CompositeCurve(
    new Line(Plane.YZ, 51, 25, -1, z+1),
    new Line(Plane.YZ, -1, z+1, 0, 100),
    new Line(Plane.YZ, -1, 100, 51, 100),
    new Line(Plane.YZ, 51, 100, 51, 25)
);

devDept.Eyeshot.Entities.Region reg6 = new devDept.Eyeshot.Entities.Region(cc3);

// Translation and extrudeRemove
reg6.Translate(-2, 0, 0);
ext1.ExtrudeRemove(reg6, 6);

// Translated above the other wing and extruded going down
reg6.Translate(54, 0, 0);
ext1.ExtrudeRemove(reg6, -6);

// Coloring some faces. The indices can be obtained by picking the faces from the GUI and using the dump button to find info on each face
ext1.Faces[0].Color = Color.LightGray;
ext1.Faces[7].Color = Color.LightGray;
ext1.Faces[18].Color = Color.LightGray;
ext1.Faces[19].Color = Color.LightGray;
ext1.Faces[20].Color = Color.LightGray;
ext1.Faces[21].Color = Color.LightGray;
ext1.Faces[22].Color = Color.LightGray;

// Added the brep to the entities, the colors of the faces we set are not overridden
model1.Entities.Add(ext1, Color.LightSlateGray);
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.