private void btnMakeModel_Click(object sender, EventArgs e) { int colorIndex = 8; vizcore3d.Primitive.Clear(); // Automation //vizcore3d.Primitive.OpenWeldLine( // string.Format("{0} WELD", wdl.INTRO_BLOCK) // , colorIndex // , 20 // , ckUnit.Checked == true ? Manager.PrimitiveManager.PrimitiveGenerationUnit.BUNDLE : Manager.PrimitiveManager.PrimitiveGenerationUnit.SEGMENTATION // , wdl.JL_DATA.Values.ToList() // ); // API VIZCore3D.NET.Manager.PrimitiveObject root = vizcore3d.Primitive.AddNode("WELD"); foreach (Importer.ShxWdlJLData item in wdl.JL_DATA.Values.ToList()) { VIZCore3D.NET.Manager.PrimitiveObject node = root.AddNode(item.Part, colorIndex); if (ckUnit.Checked == true) { foreach (Importer.ShxWdlJLDataPoint point in item.WeldLine) { VIZCore3D.NET.Manager.PrimitiveCylinder cylinder = new VIZCore3D.NET.Manager.PrimitiveCylinder(); cylinder.Set2Point(point.StartPoint, point.EndPoint, 5); node.AddPrimitive(cylinder); } } else { for (int i = 0; i < item.WeldLine.Count; i++) { string name = string.Format("WELDLINE {0} of {1}", i + 1, item.Part); VIZCore3D.NET.Manager.PrimitiveObject part = node.AddNode(name, colorIndex); Importer.ShxWdlJLDataPoint point = item.WeldLine[i]; VIZCore3D.NET.Manager.PrimitiveCylinder cylinder = new VIZCore3D.NET.Manager.PrimitiveCylinder(); cylinder.Set2Point(point.StartPoint, point.EndPoint, 5); part.AddPrimitive(cylinder); } } } string output = string.Format("{0}{1} WELD.rev", System.IO.Path.GetTempPath(), wdl.INTRO_BLOCK); bool result = vizcore3d.Primitive.Export(output); if (result == false) { return; } vizcore3d.Model.Add(new string[] { output }); }
private void MakeDashboard() { float contentsColumn = Convert.ToSingle(txtContentsColumn.Text); // 4.0f; float contentsRow = Convert.ToSingle(txtContentsRow.Text); // 5.0f; float titleHeight = Convert.ToSingle(txtTitleHeight.Text); // 3000.0f; float subTitleHeight = Convert.ToSingle(txtSubTitleHeight.Text); // 2000.0f; float contentsWidth = Convert.ToSingle(txtContentsWidth.Text); // 15000.0f; float contentsHeight = Convert.ToSingle(txtContentsHeight.Text); // 15000.0f; vizcore3d.Model.Close(); SpaceManager.Clear(); VIZCore3D.NET.Manager.PrimitiveObject root = vizcore3d.Primitive.AddNode("DASHBOARD"); VIZCore3D.NET.Manager.PrimitiveObject title = root.AddNode("TITLE", 3); { VIZCore3D.NET.Manager.PrimitiveBox box = new VIZCore3D.NET.Manager.PrimitiveBox(); VIZCore3D.NET.Data.Vertex3D min = new VIZCore3D.NET.Data.Vertex3D(0, 0, -500); VIZCore3D.NET.Data.Vertex3D max = new VIZCore3D.NET.Data.Vertex3D(contentsColumn * contentsWidth, -titleHeight, 0); VIZCore3D.NET.Data.BoundBox3D boundbox = new VIZCore3D.NET.Data.BoundBox3D(min, max); SpaceManager.Add("TITLE", boundbox); box.SetMinMaxPoints(boundbox); title.AddPrimitive(box); } VIZCore3D.NET.Manager.PrimitiveObject contents = root.AddNode("CONTENTS", 10); VIZCore3D.NET.Manager.PrimitiveObject group = contents.AddNode("GROUP", 4); VIZCore3D.NET.Manager.PrimitiveObject model = contents.AddNode("MODEL", 10); { int ID = 1; for (int i = 0; i < contentsRow; i++) { for (int j = 0; j < contentsColumn; j++) { { VIZCore3D.NET.Manager.PrimitiveObject groupItem = group.AddNode(string.Format("GROUP_{0:D2}", ID), 4); // Title VIZCore3D.NET.Manager.PrimitiveBox groupTitleBox = new Manager.PrimitiveBox(); VIZCore3D.NET.Data.Vertex3D min = new VIZCore3D.NET.Data.Vertex3D( j * contentsWidth , -titleHeight - (i * (subTitleHeight + contentsHeight)) , -500 ); VIZCore3D.NET.Data.Vertex3D max = new VIZCore3D.NET.Data.Vertex3D( (j + 1) * contentsWidth , -titleHeight - (i * (subTitleHeight + contentsHeight)) - subTitleHeight , 0 ); VIZCore3D.NET.Data.BoundBox3D groupBoundBox = new VIZCore3D.NET.Data.BoundBox3D(min, max); SpaceManager.Add(string.Format("GROUP_{0:D2}", ID), groupBoundBox); groupTitleBox.SetMinMaxPoints(groupBoundBox); groupItem.AddPrimitive(groupTitleBox); } { VIZCore3D.NET.Manager.PrimitiveObject modelItem = model.AddNode(string.Format("MODEL_{0:D2}", ID), 10); // Thumbnail VIZCore3D.NET.Manager.PrimitiveBox thumbnailBox = new VIZCore3D.NET.Manager.PrimitiveBox(); VIZCore3D.NET.Data.Vertex3D min = new VIZCore3D.NET.Data.Vertex3D( j * contentsWidth , -titleHeight - (i * (subTitleHeight + contentsHeight)) - subTitleHeight , -500 ); VIZCore3D.NET.Data.Vertex3D max = new VIZCore3D.NET.Data.Vertex3D( (j + 1) * contentsWidth , -titleHeight - ((i + 1) * (subTitleHeight + contentsHeight)) , 0 ); VIZCore3D.NET.Data.BoundBox3D thumbnailBoundBox = new VIZCore3D.NET.Data.BoundBox3D(min, max); SpaceManager.Add(string.Format("MODEL_{0:D2}", ID), thumbnailBoundBox); thumbnailBox.SetMinMaxPoints(thumbnailBoundBox); modelItem.AddPrimitive(thumbnailBox); } ID++; } } } { vizcore3d.TextDrawing.Clear(); { VIZCore3D.NET.Data.BoundBox3D boundbox = SpaceManager["TITLE"]; VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D(); center.X = boundbox.MinX + (boundbox.LengthX * 0.5f); center.Y = boundbox.MinY + (boundbox.LengthY * 0.5f); center.Z = boundbox.MaxZ; vizcore3d.TextDrawing.Add( center , new VIZCore3D.NET.Data.Vertex3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */ , new VIZCore3D.NET.Data.Vertex3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */ , 2000 , Color.Black , txtTitle.Text ); } { foreach (KeyValuePair <string, Data.BoundBox3D> item in SpaceManager) { if (item.Key.Contains("GROUP_") == false) { continue; } VIZCore3D.NET.Data.Vertex3D center = new VIZCore3D.NET.Data.Vertex3D(); center.X = item.Value.MinX + (contentsWidth * 0.5f); center.Y = item.Value.MinY + (item.Value.LengthY * 0.5f); center.Z = item.Value.MaxZ; vizcore3d.TextDrawing.Add( center , new VIZCore3D.NET.Data.Vertex3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */ , new VIZCore3D.NET.Data.Vertex3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */ , 1000 , Color.Black , item.Key.Replace("GROUP", "MODEL") ); } } } vizcore3d.Primitive.OpenModel("BAY_BLOCK"); if (Models.Count != 0) { PlaceModel(); } else { vizcore3d.View.MoveCamera(VIZCore3D.NET.Data.CameraDirection.Z_PLUS); vizcore3d.View.Navigation = VIZCore3D.NET.Data.NavigationModes.PAN; vizcore3d.View.SetRenderMode(VIZCore3D.NET.Data.RenderModes.SMOOTH_EDGE); vizcore3d.View.FitToView(); } }