Use the following code to model with Solid entities an object like the one in the picture:
// materials
Material alu = Material.Aluminium;
alu.Diffuse = Color.White;
alu.Environment = 0.4f;
design1.Materials.Add(alu);
string woodMatName = "Wood";
Material wood = new Material(woodMatName, Properties.Resources.Wood.ToByteArray());
design1.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 = new devDept.Eyeshot.Entities.Region(new Circle(0, 0, 0, 50)).ExtrudeAsSolid(0, 0, 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 solidItems = new List();
solidItems.Add(lens);
solidItems.AddRange(design1.ExtrudeText(eyeshotText, 0.01, new Vector3D(0, 0, 10), true));
Solid medal = Solid.Union(solidItems.ToArray())[0];
medal.ColorMethod = colorMethodType.byEntity;
medal.MaterialName = alu.Name;
medal.Translate(0, 0, 2);
design1.Entities.Add(medal, 0, 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);
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 = sect.SweepAsSolid(rail, 0.1, sweepMethodType.RoadlikeTop);
Solid[] diff2 = Solid.Difference(diff1[0], frame);
Solid jewelCase = diff2[0];
jewelCase.ApplyMaterial(woodMatName, textureMappingType.Cubic, 1, 1);
design1.Entities.Add(jewelCase, 0, Color.FromArgb(32, 0, 0));
design1.Invalidate();
Comments
Please sign in to leave a comment.