MeshEditManagerCreateBodyWithMesh Method (Int32, String, ListVertex3D, ListVector3D, Color) |
Namespace: VIZCore3D.NET.Manager
public int CreateBodyWithMesh( int nodeIndex, string name, List<Vertex3D> coords, List<Vector3D> normals, Color color )
// VIZCore3D.NET Control private VIZCore3D.NET.VIZCore3DControl vizcore3d; private void Example() { string assemblyName = string.Format("Assembly #{0}", vizcore3d.Object3D.GetNodeCount()); VIZCore3D.NET.Data.Node assembly = vizcore3d.MeshEdit.CreateNode(0, VIZCore3D.NET.Data.NodeKind.ASSEMBLY, assemblyName); if (assembly == null) return; string partName = string.Format("Part #{0}", vizcore3d.Object3D.GetNodeCount()); VIZCore3D.NET.Data.Node part = vizcore3d.MeshEdit.CreateNode(assembly.Index, VIZCore3D.NET.Data.NodeKind.PART, partName); if (part == null) return; string bodyName = string.Format("Body #{0}", vizcore3d.Object3D.GetNodeCount()); List<VIZCore3D.NET.Data.Vertex3D> coords = new List<VIZCore3D.NET.Data.Vertex3D>(); List<VIZCore3D.NET.Data.Vector3D> normals = new List<VIZCore3D.NET.Data.Vector3D>(); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0)); coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0)); coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, -1.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(-1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 1.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(1.0, 0.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, -1.0, 0.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); normals.Add(new Data.Vector3D(0.0, 0.0, 1.0)); int id = vizcore3d.MeshEdit.CreateBodyWithMesh(part.Index, bodyName, coords, normals, Color.Orange); if (id == -1) MessageBox.Show("NG", "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Error); else MessageBox.Show(string.Format("Body ID : {0}", id), "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Information); }