StructureManagerGetMaxId Method |
Namespace: VIZCore3D.NET.Manager
// VIZCore3D.NET Control private VIZCore3D.NET.VIZCore3DControl vizcore3d; private void Example1() { int id = vizcore3d.Structure.GetMaxId(); int parent = vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP)[0].ID; List<VIZCore3D.NET.Data.NewNodeItem> items = new List<VIZCore3D.NET.Data.NewNodeItem>(); for (int i = 0; i < 100; i++) { VIZCore3D.NET.Data.NewNodeItem item = new VIZCore3D.NET.Data.NewNodeItem(); item.ParentId = parent; item.ID = ++id; item.Kind = Data.NodeKind.PART; item.Name = string.Format("NAME_{0}", item.ID); items.Add(item); } vizcore3d.Structure.CreateNodes(items); } private void Example2() { int id = vizcore3d.Structure.GetMaxId(); int parent = vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP)[0].ID; List<VIZCore3D.NET.Data.NewNodeItem> items = new List<VIZCore3D.NET.Data.NewNodeItem>(); for (int i = 0; i < 100; i++) { VIZCore3D.NET.Data.NewNodeItem assy = new VIZCore3D.NET.Data.NewNodeItem(); int assyId = ++id; assy.ParentId = parent; assy.ID = assyId; assy.Kind = Data.NodeKind.ASSEMBLY; assy.Name = string.Format("NAME_ASSY_{0}", assy.ID); items.Add(assy); { VIZCore3D.NET.Data.NewNodeItem part = new VIZCore3D.NET.Data.NewNodeItem(); int partId = ++id; part.ParentId = assyId; part.ID = partId; part.Kind = Data.NodeKind.PART; part.Name = string.Format("NAME_PART_{0}", part.ID); items.Add(part); { VIZCore3D.NET.Data.NewNodeItem body = new VIZCore3D.NET.Data.NewNodeItem(); int bodyId = ++id; body.ParentId = partId; body.ID = bodyId; body.Kind = Data.NodeKind.BODY; body.Name = string.Format("NAME_BODY_{0}", body.ID); items.Add(body); } } } vizcore3d.Structure.CreateNodes(items); }