// main Box
devDept.Eyeshot.Entities.Region rectReg1 = devDept.Eyeshot.Entities.Region.CreateRectangle(150, 60, true);
Brep ext1 = rectReg1.ExtrudeAsBrep(70);
ext1.Translate(-75, 0, -25);
// lower cut
Plane pln1 = (Plane)Plane.XZ.Clone();
pln1.Translate(0, -50, -25);
devDept.Eyeshot.Entities.Region circReg1 = devDept.Eyeshot.Entities.Region.CreateCircle(pln1, new Point2D(-90, -Math.Sqrt(100 * 100 - 60 * 60)), 100);
ext1.ExtrudeRemove(circReg1, -100);
// slice cut
devDept.Eyeshot.Entities.Region rectReg2 = devDept.Eyeshot.Entities.Region.CreateRectangle(Plane.XZ, 100, 100);
rectReg2.Translate(-170, 0, -40);
ext1.RevolveRemove(rectReg2, Utility.DegToRad(-15), Utility.DegToRad(30), Vector3D.AxisZ, new Point3D(-70, 0));
// upper toroidal cut
devDept.Eyeshot.Entities.Region circReg2 = devDept.Eyeshot.Entities.Region.CreateCircle(Plane.YZ, 60);
circReg2.Rotate(Math.PI / 2, Vector3D.AxisX);
circReg2.Translate(-50, 0, -25);
Brep torus1 = circReg2.RevolveAsBrep(Utility.TWO_PI, Vector3D.AxisY, new Point3D(-50, 0, -175));
Brep int1 = Brep.Intersection(ext1, torus1)[0];
design1.Entities.Add(int1, Color.DeepSkyBlue);
// knob
Line line1 = new Line(0, -15, 20, -15);
Line line2 = new Line(20, -15, 20, -25);
Line line3 = new Line(20, -25, 50, -25);
Line line4 = new Line(40, 0, 40, -30);
Curve.Fillet(line3, line4, 5, true, false, true, true, out Arc fillet1);
CompositeCurve cc1 = new CompositeCurve(line1, line2, line3, fillet1, line4);
int1.RevolveAdd(new devDept.Eyeshot.Entities.Region(cc1, Plane.XY, false), Utility.TWO_PI, Vector3D.AxisX, Point3D.Origin);
design1.Entities.Regen();
Manufacture
Now we introduce the machining phase using the Manufacture workspace. The main steps are also described here.
Preparation
// Adds the geometry on screen
manufacture1.Entities.Add(int1, Color.DeepSkyBlue);
// Creates the machining stock and the setup
Stock stock = Stock.CreateBox(Plane.XY, -150, -30, 150, 60, new devDept.Geometry.Interval(-25, 60 - 25));
Setup setup = new Setup("Top", linearUnitsType.Millimeters, new Plane(new Point3D(0, 0, 60 - 25), Vector3D.AxisX, Vector3D.AxisY), stock);
// Set the Manufacture workspace properties for stock and setup display
manufacture1.SimulationSetup = setup;
manufacture1.SimulationStock = stock.GetSimulationStock();
// displays the setup coordinate system icon
manufacture1.AddUserInterfaceElementFor(setup1);
Machining computation and simulation
// Creates the tool
EndMill em = new EndMill(20, 7.5);
// Finds the faces to machine by radius
List<IFace> topSurfs = new List<IFace>();
foreach (Brep.Face f in int1.Faces)
{
if (f.Surface is RevolvedSurf rs)
{
if (rs.Generatrix is Circle cr)
{
if (cr.Radius == 60)
{
topSurfs.AddRange(f.ConvertToSurface());
}
}
}
}
// Creates the machining geometry with topSurfs and tolerance 0.01
Geometry3D g = new Geometry3D(topSurfs, 0.01);
// Creates the machining
Parallel3D p3d = new Parallel3D(setup, em, g, 3, Utility.DegToRad(45), 1);
p3d.DoWork();
// Changes the resulting toolpath color before simulation
Toolpath tp = p3d.Result;
tp.ColorMethod = colorMethodType.byEntity;
tp.Color = Color.Blue;
// Set the Manufacture workspace properties for interactive simulation
manufacture1.SimulationTool = em;
manufacture1.SimulationToolpath = tp;
Comments
Please sign in to leave a comment.