public static void Bracket(Model model) { CompositeCurve rrscc1 = CompositeCurve.CreateRoundedRectangle(Plane.YZ, 40, 120, 12, true); CompositeCurve sscc1 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true); sscc1.Translate(0, 0, 43); CompositeCurve sscc2 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true); sscc2.Rotate(Utility.DegToRad(90), Vector3D.AxisX, Point3D.Origin); sscc2.Translate(0, 0, -40); Circle c1 = new Circle(Plane.YZ, 4.25); Region r1 = new Region(rrscc1, sscc1, sscc2, c1); Brep ext1 = r1.ExtrudeAsBrep(-4); model.Entities.Add(ext1, "Default", Color.YellowGreen); CompositeCurve cc1 = new CompositeCurve( new Line(Plane.YZ, 8, -10, 11, -10), new Arc(Plane.YZ, new Point2D(11, -5), 5, Utility.DegToRad(270), Utility.DegToRad(360)), new Line(Plane.YZ, 16, -5, 16, +5), new Arc(Plane.YZ, new Point2D(11, +5), 5, Utility.DegToRad(0), Utility.DegToRad(90)), new Line(Plane.YZ, 11, 10, -11, 10), new Arc(Plane.YZ, new Point2D(-11, +5), 5, Utility.DegToRad(90), Utility.DegToRad(180)), new Line(Plane.YZ, -16, +5, -16, -5), new Arc(Plane.YZ, new Point2D(-11, -5), 5, Utility.DegToRad(180), Utility.DegToRad(270)), new Line(Plane.YZ, -11, -10, -8, -10)); Region r2 = cc1.OffsetToRegion(-2.5, 0, false); ext1.ExtrudeAdd(r2, 275); Region ssr2 = Region.CreateSlot(Plane.XY, 12, 5.25); ssr2.Translate(9, 0, 0); ext1.ExtrudeRemovePattern(ssr2, 10, 35, 8, 0, 1); model.Entities.Regen(); }
public static void Medal(Model model) { // materials Material alu = Material.Aluminium; alu.Diffuse = Color.White; alu.Environment = 0.4f; string medalMatName = "Alu"; alu.Name = medalMatName; model.Materials.Add(alu); string woodMatName = "Wood"; Material wood = new Material(woodMatName, new Bitmap(MainWindow.GetAssetsPath() + "Textures/Wenge.jpg")); model.Materials.Add(wood); // medal Solid sphere = Solid.CreateSphere(200, 120, 60); sphere.Rotate(Math.PI / 2, Vector3D.AxisY); sphere.Translate(0, 0, -190); Solid cylinder = Region.CreateCircle(Plane.XY, 0, 0, 50).ExtrudeAsSolid(100, 0.1); Solid[] intersection = Solid.Intersection(sphere, cylinder); Solid lens = intersection[0]; Text eyeshotText = new Text(-45.5, -8, 0, "eyeshot", 19); eyeshotText.Translate(0, 0, 2); List <Solid> solidItems = new List <Solid>(); solidItems.Add(lens); solidItems.AddRange(model.ExtrudeText(eyeshotText, 0.01, new Vector3D(0, 0, 10), true)); Solid medal = Solid.Union(solidItems.ToArray())[0]; medal.ColorMethod = colorMethodType.byEntity; medal.MaterialName = "alu"; medal.Translate(0, 0, 2); model.Entities.Add(medal, Color.White); // jewel case Solid b1 = Solid.CreateBox(140, 140, 12); b1.Translate(-70, -70, 0); Solid b2 = Solid.CreateBox(108, 108, 12); b2.Translate(-54, -54, 2); Solid[] diff1 = Solid.Difference(b1, b2); Plane pln = Plane.YZ; Line ln1 = new Line(pln, 0, 0, 4, 0); Line ln2 = new Line(pln, 4, 0, 4, 4); Line ln3 = new Line(pln, 4, 4, 8, 4); Arc a1 = new Arc(pln, new Point2D(12, 4), 4, Math.PI / 2, Math.PI); Line ln4 = new Line(pln, 12, 8, 12, 12); Line ln5 = new Line(pln, 12, 12, 0, 12); Line ln6 = new Line(pln, 0, 12, 0, 0); CompositeCurve sect = new CompositeCurve(ln1, ln2, ln3, a1, ln4, ln5, ln6); sect.Translate(0, -70, 0); devDept.Eyeshot.Entities.Region sectReg = new devDept.Eyeshot.Entities.Region(sect); LinearPath rail = new LinearPath(new Point3D[] { new Point3D(0, -70, 0), new Point3D(70, -70, 0), new Point3D(70, +70, 0), new Point3D(-70, +70, 0), new Point3D(-70, -70, 0), new Point3D(0, -70, 0) }); Solid frame = sectReg.SweepAsSolid(rail, 0.1); Solid[] diff2 = Solid.Difference(diff1[0], frame); Solid jewelCase = diff2[0]; jewelCase.ApplyMaterial(woodMatName, textureMappingType.Cubic, 1, 1); model.Entities.Add(jewelCase, Color.FromArgb(32, 0, 0)); }