コード例 #1
0
        public Block CreateRocketBlock()
        {
            Block rocketBlock = new Block("Rocket");

            // missile bottom
            LinearPath lpMissileBottom = new LinearPath(
                new Point3D(0, 0, 1), new Point3D(1.5, 0, 1), new Point3D(1.5, 0, 1.5),
                new Point3D(0, 0, 1.5), new Point3D(0, 0, 1));

            Mesh missileBottom = lpMissileBottom.RevolveAsMesh(0, 2 * Math.PI, new Vector3D(0, 0, 1), new Point3D(0, 0, 1), 20, 0.1, Mesh.natureType.Smooth);

            missileBottom.ColorMethod = colorMethodType.byEntity;
            missileBottom.Color       = Color.Red;
            missileBottom.Weld();
            rocketBlock.Entities.Add(missileBottom);

            // missile body
            LinearPath lpMissileBody = new LinearPath(
                new Point3D(0, 0, 1.5), new Point3D(1.5, 0, 1.5),
                new Point3D(1.95, 0, 3.5), new Point3D(2.15, 0, 4.25),
                new Point3D(2.25, 0, 5.75), new Point3D(2.25, 0, 7.25),
                new Point3D(2.15, 0, 8.75), new Point3D(1.95, 0, 10.25),
                new Point3D(1.75, 0, 11), new Point3D(1.15, 0, 13),
                new Point3D(0, 0, 13), new Point3D(0, 0, 0)
                );

            Mesh missileBody = lpMissileBody.RevolveAsMesh(0, 2 * Math.PI, new Vector3D(0, 0, 1), new Point3D(0, 0, 1.5), 20, 0.1, Mesh.natureType.Smooth);

            missileBody.ColorMethod = colorMethodType.byEntity;
            missileBody.Color       = Color.White;
            missileBody.Weld();
            rocketBlock.Entities.Add(missileBody);

            // missile edge
            LinearPath lpMissileEdge = new LinearPath(
                new Point3D(0, 0, 13), new Point3D(1.15, 0, 13),
                new Point3D(0.85, 0, 13.5), new Point3D(0.65, 0, 13.75),
                new Point3D(0.45, 0, 13.85), new Point3D(0.25, 0, 13.92),
                new Point3D(0.05, 0, 13.992),
                new Point3D(0, 0, 14), new Point3D(0, 0, 14)
                );

            Mesh missileEdge = lpMissileEdge.RevolveAsMesh(0, 2 * Math.PI, new Vector3D(0, 0, 1), new Point3D(0, 0, 11), 50, 0.1, Mesh.natureType.Smooth);

            missileEdge.ColorMethod = colorMethodType.byEntity;
            missileEdge.Color       = Color.Red;
            missileEdge.Weld();
            rocketBlock.Entities.Add(missileEdge);

            // missile wings
            LinearPath lpMissileWing = new LinearPath(
                new Point3D(2.15, 0, 4.25), new Point3D(4, 0, 2),
                new Point3D(4, 0, 0), new Point3D(1.5, 0, 1.5),
                new Point3D(1.95, 0, 3.5), new Point3D(2.15, 0, 4.25)
                );

            devDept.Eyeshot.Entities.Region regionWing = new devDept.Eyeshot.Entities.Region(lpMissileWing, Plane.XZ);
            Mesh missileWing1 = regionWing.ExtrudeAsMesh(0.15, 0.1, Mesh.natureType.Plain);

            missileWing1.ColorMethod = colorMethodType.byEntity;
            missileWing1.Color       = Color.Red;
            missileWing1.Weld();
            rocketBlock.Entities.Add(missileWing1);

            Mesh missileWing2 = (Mesh)missileWing1.Clone();

            missileWing2.Rotate(Math.PI / 2, Vector3D.AxisZ);
            rocketBlock.Entities.Add(missileWing2);

            Mesh missileWing3 = (Mesh)missileWing2.Clone();

            missileWing3.Rotate(Math.PI / 2, Vector3D.AxisZ);
            rocketBlock.Entities.Add(missileWing3);

            Mesh missileWing4 = (Mesh)missileWing3.Clone();

            missileWing4.Rotate(Math.PI / 2, Vector3D.AxisZ);
            rocketBlock.Entities.Add(missileWing4);

            return(rocketBlock);
        }