The following lines allow you to draw this model in the above picture from scratch:
// Body
GCompositeCurve bodyProfile = new GCompositeCurve(
new GLine(-92, 0, -10, 0),
new GArc(-10, 10, 0, 10, Math.PI * 1.5, Math.PI * 2),
new GLine(0, 10, 0, 77),
new GArc(-10, 77, 0, 10, 0, Math.PI / 2),
new GLine(-10, 87, -92, 87),
new GLine(-92, 87, -92, 75),
new GLine(-92, 75, -22, 75),
new GArc(-22, 65, 0, 10, 0, Math.PI / 2),
new GLine(-12, 65, -12, 22),
new GArc(-22, 22, 0, 10, Math.PI * 1.5, Math.PI * 2),
new GLine(-22, 12, -92, 12),
new GLine(-92, 12, -92, 0)
);
GRegion bodyRegion = new GRegion(bodyProfile);
bodyRegion.Rotate(Math.PI / 2, Vector3D.AxisX);
GBrep body = bodyRegion.ExtrudeAsBrep(74);
// Vertical Holes
GRegion
verticalHoleA = new GRegion(new GCircle(-77, -37, 0, 7.5)),
verticalHoleB = new GRegion(new GCircle(-32, -37, 75, 7.5));
// Curvy side
GRegion curvyRemovalRegion = new GRegion(new IGCurve[]{
new GCircle(new Point3D(37, -37, 87), 200),
new GCircle(new Point3D(37, -37, 87), 90)
});
body.ExtrudeRemove(curvyRemovalRegion, -12);
body.ExtrudeRemove(verticalHoleA, 12);
body.ExtrudeRemove(verticalHoleB, 12);
// Horn
GCompositeCurve hornProfile = new GCompositeCurve(
new GLine(0, 50.75, 65, 50.75),
new GLine(65, 50.75, 65, 63),
new GLine(65, 63, 63.5, 64.5),
new GLine(63.5, 64.5, 5, 64.5),
new GArc(5, 69.5, 0, 5, Math.PI, Math.PI * 1.5),
new GLine(0, 69.5, 0, 47)
);
GRegion hornRegion = new GRegion(hornProfile);
hornRegion.Rotate(Math.PI / 2, Vector3D.AxisX);
hornRegion.Translate(new Vector3D(0, -37, 0));
body.RevolveAdd(hornRegion, Math.PI * 2, Vector3D.AxisX, new Point3D(0, -37, 47));
design1.Entities.Add(new Brep(body), Color.DarkOrange);
design1.SetView(viewType.Trimetric);
design1.ZoomFit();
Now then, let us generate the corresponding STL file:
WriteSTL ws = new WriteSTL(design1, "drawings_125.stl");
ws.DoWork();
Comments
Please sign in to leave a comment.