private void BuildShapesAndTransformations() { inners = new LinearPath[2]; startOrientation = new Quaternion[2]; finalOrientation = new Quaternion[2]; // Hexagon CompositeCurve c = CompositeCurve.CreateHexagon(5); c.Regen(0); inners[0] = new LinearPath(c.Vertices); inners[0].Reverse(); startOrientation[0] = new Quaternion(Vector3D.AxisZ, 180 / 2.0); Transformation transf = new Translation(7, 0, 0) * new Rotation(Math.PI / 2, Vector3D.AxisZ); inners[0].TransformBy(transf); // Triangle inners[1] = new LinearPath(new Point3D[] { new Point3D(0, 0, 0), new Point3D(7, 0, 0), new Point3D(3.5, 7, 0), new Point3D(0, 0, 0) }); inners[1].Reverse(); transf = new Translation(23, 0, 0) * new Rotation(Math.PI / 3, Vector3D.AxisZ); startOrientation[1] = new Quaternion(Vector3D.AxisZ, 180 / 3.0); inners[1].TransformBy(transf); // Extrude the 2 inner profiles to build 2 shapes shapes = new Entity[2]; devDept.Eyeshot.Entities.Region firstInnerReg = new devDept.Eyeshot.Entities.Region(inners[0], Plane.XY, false); shapes[0] = firstInnerReg.ExtrudeAsMesh(4, 0.1, Mesh.natureType.Plain); shapes[0].ColorMethod = colorMethodType.byEntity; shapes[0].Color = System.Drawing.Color.Green; devDept.Eyeshot.Entities.Region secondInnerReg = new devDept.Eyeshot.Entities.Region(inners[1], Plane.XY, false); shapes[1] = secondInnerReg.ExtrudeAsMesh(4, 0.1, Mesh.natureType.Plain); shapes[1].ColorMethod = colorMethodType.byEntity; shapes[1].Color = System.Drawing.Color.Gainsboro; // Save the original shapes for the animation originalShapes = new Entity[] { (Entity)shapes[0].Clone(), (Mesh)shapes[1].Clone() }; LinearPath outer = new LinearPath(new Point3D[] { new Point3D(0, -10, 0), new Point3D(30, -10, 0), new Point3D(30, 10, 0), new Point3D(0, 10, 0), new Point3D(0, -10, 0) }); devDept.Eyeshot.Entities.Region plate = new devDept.Eyeshot.Entities.Region(new ICurve[] { outer, inners[0], inners[1] }, Plane.XY, false); // Build a mesh with 2 holes Mesh m = plate.ExtrudeAsMesh(3, 0.1, Mesh.natureType.Plain); // Transform the mesh and the the 2 inner profiles, to position them in the exact place of the holes transf = new Translation(0, 3, 10) * new Rotation(Math.PI / 2, Vector3D.AxisX); m.TransformBy(transf); model1.Entities.Add(m, System.Drawing.Color.Brown); inners[0].TransformBy(transf); inners[1].TransformBy(transf); // Rotation quaternion of the 2 inners Quaternion q = new Quaternion(Vector3D.AxisX, 90); finalOrientation[0] = q * startOrientation[0]; finalOrientation[1] = q * startOrientation[1]; // Define a Transformation for the 2 shapes, and store the rotation Quaternion transf = new Translation(20, -25, 0) * new Rotation(Math.PI / 9, Vector3D.AxisZ); startOrientation[0] = new Quaternion(Vector3D.AxisZ, 180 / 9.0) * startOrientation[0]; shapesTransform = new Transformation[2]; shapesTransform[0] = transf; transf = new Translation(-10, -44, 0) * new Rotation(Math.PI / 5, Vector3D.AxisZ); shapesTransform[1] = transf; startOrientation[1] = new Quaternion(Vector3D.AxisZ, 180 / 5.0) * startOrientation[1]; if (comboBoxAnimation.SelectedIndex == 1) { // Block Reference Animation // Add the Blocks to the viewport and create the BlockReferences for the animation AddBlockDefinition(new Block("B1"), 0); AddBlockDefinition(new Block("B2"), 1); } else { // Transform the shapes shapes[0].TransformBy(shapesTransform[0]); shapes[1].TransformBy(shapesTransform[1]); } // Add the entities to the viewport model1.Entities.Add(shapes[0]); model1.Entities.Add(shapes[1]); }