private void btnCreateDock_Click(object sender, EventArgs e) { Data.Vertex3D center = new Data.Vertex3D(); if (vizcore3d.Model.IsOpen() == true) { Data.BoundBox3D boundbox = vizcore3d.Model.BoundBox; center = boundbox.GetCenter(); } else { center.X = 87614.0f; center.Y = 478.0f; center.Z = 21646.0f; } center.Z = center.Z - (center.Z * 0.9f); vizcore3d.Primitive.OpenCustomShapeDock( "DOCK_MODEL" /* MODEL NAME */ , 8 /* COLOR INDEX */ , center /* CENTER */ , new Data.Vector3D(195000, 40000, 13000) /* Axis Length */ , 40000 /* Ground Length */ , 1000 /* Thickness */ ); List <Data.Node> dock = vizcore3d.Object3D.Find.QuickSearch(new List <string>() { "DOCK", "GROUND" }, false, true, false, false, true, false); vizcore3d.Object3D.Color.SetTransparency(dock, 30); }
private List <Data.Vertex3DItemCollection> GetVertexList() { List <Data.Vertex3DItemCollection> vertex = new List <Data.Vertex3DItemCollection>(); Data.BoundBox3D boundbox = vizcore3d.Object3D.GeometryProperty.FromSelectedObject3D(false).GetBoundBox(); { Data.Vertex3DItemCollection item = new Data.Vertex3DItemCollection(); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MaxZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MaxZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MaxZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MaxZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MaxZ)); vertex.Add(item); } { Data.Vertex3DItemCollection item = new Data.Vertex3DItemCollection(); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MaxZ)); vertex.Add(item); } { Data.Vertex3DItemCollection item = new Data.Vertex3DItemCollection(); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MinZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MaxZ)); vertex.Add(item); } { Data.Vertex3DItemCollection item = new Data.Vertex3DItemCollection(); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MaxZ)); item.Add(new Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MinZ)); vertex.Add(item); } return(vertex); }
private List <VIZCore3D.NET.Data.Vertex3D> GetVertex() { List <VIZCore3D.NET.Data.Vertex3D> vertex = new List <VIZCore3D.NET.Data.Vertex3D>(); Data.BoundBox3D boundbox = vizcore3d.Object3D.GeometryProperty.FromSelectedObject3D(false).GetBoundBox(); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MinZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MinZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MinZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MinY, boundbox.MaxZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MinZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MinX, boundbox.MaxY, boundbox.MaxZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MinY, boundbox.MaxZ)); vertex.Add(new VIZCore3D.NET.Data.Vertex3D(boundbox.MaxX, boundbox.MaxY, boundbox.MaxZ)); return(vertex); }
/// <summary> /// 개체 선택 이벤트 /// </summary> /// <param name="sender">sender</param> /// <param name="e">Event Args</param> private void Object3D_OnSelectedObject3D(object sender, Event.EventManager.SelectedObject3DEventArgs e) { if (e.Node.Count > 0) { // 선택된 개체가 있음 //MessageBox.Show(e.NodeIndex.Count.ToString()); if (EnableMessage == true) { vizcore3d.BeginUpdate(); Data.Object3DProperty prop = vizcore3d.Object3D.GeometryProperty.FromIndex(e.Node[0].Index, true); vizcore3d.View.Message.Show(Data.MessageId.ID_01, string.Format("Name : {0}", e.Node[0].NodeName), 5, 5, Data.FontSize.Size_14_Bold, Color.Red); vizcore3d.View.Message.Show(Data.MessageId.ID_02, string.Format("Path : {0}", prop.AssemblyPath), 5, 20, Data.FontSize.Size_14, Color.Orange); vizcore3d.View.Message.Show(Data.MessageId.ID_03, string.Format("Center : {0}", prop.CenterPoint.ToString()), 5, 35, Data.FontSize.Size_14, Color.Yellow); vizcore3d.View.Message.Show(Data.MessageId.ID_04, string.Format("Min. : {0}", prop.MinPoint.ToString()), 5, 50, Data.FontSize.Size_14, Color.Green); vizcore3d.View.Message.Show(Data.MessageId.ID_05, string.Format("Max. : {0}", prop.MaxPoint.ToString()), 5, 65, Data.FontSize.Size_14, Color.Blue); vizcore3d.View.Message.Show(Data.MessageId.ID_06, string.Format("Mass : {0}", prop.Mass), 5, 80, Data.FontSize.Size_14, Color.Indigo); vizcore3d.View.Message.Show(Data.MessageId.ID_07, string.Format("Area : {0}", prop.SurfaceArea), 5, 95, Data.FontSize.Size_14, Color.Purple); vizcore3d.EndUpdate(); } } else { //모든 개체 선택 해제 if (EnableMessage == true) { vizcore3d.BeginUpdate(); vizcore3d.View.Message.Clear(); Data.BoundBox3D bbox = vizcore3d.Model.BoundBox; vizcore3d.View.Message.Show(Data.MessageId.ID_01, string.Format("Min. X : {0}", bbox.MinX), 5, 5, Data.FontSize.Size_14, Color.Red); vizcore3d.View.Message.Show(Data.MessageId.ID_02, string.Format("Min. Y : {0}", bbox.MinY), 5, 20, Data.FontSize.Size_14, Color.Orange); vizcore3d.View.Message.Show(Data.MessageId.ID_03, string.Format("Min. Z : {0}", bbox.MinZ), 5, 35, Data.FontSize.Size_14, Color.Yellow); vizcore3d.View.Message.Show(Data.MessageId.ID_04, string.Format("Max. X : {0}", bbox.MaxX), 5, 50, Data.FontSize.Size_14, Color.Green); vizcore3d.View.Message.Show(Data.MessageId.ID_05, string.Format("Max. Y : {0}", bbox.MaxY), 5, 65, Data.FontSize.Size_14, Color.Blue); vizcore3d.View.Message.Show(Data.MessageId.ID_06, string.Format("Max. Z : {0}", bbox.MaxZ), 5, 80, Data.FontSize.Size_14, Color.Indigo); vizcore3d.EndUpdate(); } } }
private void btnAddBox_Click(object sender, EventArgs e) { if (vizcore3d.Model.IsOpen() == false) { return; } Data.BoundBox3D box = vizcore3d.Model.BoundBox; vizcore3d.SelectionBox.Clear(); SelectionBoxID = vizcore3d.SelectionBox.Add( box , vizcore3d.SelectionBox.GetTransparencyColor(Color.White, 80) , Color.Black , String.Empty ); // SelectionBox Options vizcore3d.SelectionBox.MouseSelectionMode = true; }
private void btnSetMaterialSea_Click(object sender, EventArgs e) { vizcore3d.BeginUpdate(); Data.BoundBox3D boundbox = vizcore3d.Model.BoundBox; // SEA(바다) 커스텀 개체 추가 int customSeaId = vizcore3d.ShapeDrawing.AddSea( boundbox.MinZ - 10.0f /* 높이 : Z축 */ , true /* Visible */ ); // 기본 리소스 (SEA Material) 복사 int material = vizcore3d.Object3D.Material.Copy(VIZCore3D.NET.Data.ResourceMaterials.SEA); Color color = Color.FromArgb(127, 255, 255, 255); // 리소스 색상 변경 vizcore3d.Object3D.Material.SetColor(material, color); // 수정된 리소스 (Material) 를 기존 커스텀 개체에 지정 vizcore3d.ShapeDrawing.SetMaterial(customSeaId, material); vizcore3d.EndUpdate(); }
private void btnCreate_Click(object sender, EventArgs e) { if (vizcore3d.Model.IsOpen() == false) { return; } vizcore3d.SelectionBox.Clear(); int xCount = Convert.ToInt32(txtCountX.Text); int yCount = Convert.ToInt32(txtCountY.Text); int zCount = Convert.ToInt32(txtCountZ.Text); VIZCore3D.NET.Data.BoundBox3D box = vizcore3d.Model.BoundBox; float xWidth = box.LengthX / xCount; float yWidth = box.LengthY / yCount; float zWidth = box.LengthZ / zCount; vizcore3d.BeginUpdate(); for (int x = 0; x < xCount; x++) { for (int y = 0; y < yCount; y++) { for (int z = 0; z < zCount; z++) { string title = string.Format("선택상자 - {0}/{1}/{2}", x + 1, y + 1, z + 1); string label = string.Format("{0}/{1}/{2}", x + 1, y + 1, z + 1); VIZCore3D.NET.Data.Vertex3D min = new Data.Vertex3D( box.MinX + (xWidth * x) , box.MinY + (yWidth * y) , box.MinZ + (zWidth * z) ); VIZCore3D.NET.Data.Vertex3D max = new Data.Vertex3D( min.X + xWidth , min.Y + yWidth , min.Z + zWidth ); VIZCore3D.NET.Data.BoundBox3D selectionbox = new Data.BoundBox3D(min, max); int id = vizcore3d.SelectionBox.Add( selectionbox , GetTransparencyColor(Color.FromArgb(100, 255, 255, 255)) , GetTransparencyColor(Color.Black) , title ); vizcore3d.SelectionBox.SetLabel(id, label); } // z } // y } // x vizcore3d.EndUpdate(); vizcore3d.SelectionBox.MouseSelectionMode = true; }
// ================================================ // Bounding Box // ================================================ private void btnBoxAdd_Click(object sender, EventArgs e) { if (vizcore3dMain.Model.IsOpen() == false) { return; } vizcore3dMain.SelectionBox.Clear(); BoxKey = new Dictionary <int, string>(); int xCount = Convert.ToInt32(txtBoxX.Text); int yCount = Convert.ToInt32(txtBoxY.Text); int zCount = Convert.ToInt32(txtBoxZ.Text); VIZCore3D.NET.Data.BoundBox3D box = vizcore3dMain.Model.BoundBox; float xWidth = box.LengthX / xCount; float yWidth = box.LengthY / yCount; float zWidth = box.LengthZ / zCount; vizcore3dMain.BeginUpdate(); for (int x = 0; x < xCount; x++) { for (int y = 0; y < yCount; y++) { for (int z = 0; z < zCount; z++) { string title = string.Format("선택상자 - {0}/{1}/{2}", x + 1, y + 1, z + 1); string label = string.Format("{0}/{1}/{2}", x + 1, y + 1, z + 1); VIZCore3D.NET.Data.Vertex3D min = new Data.Vertex3D( box.MinX + (xWidth * x) , box.MinY + (yWidth * y) , box.MinZ + (zWidth * z) ); VIZCore3D.NET.Data.Vertex3D max = new Data.Vertex3D( min.X + xWidth , min.Y + yWidth , min.Z + zWidth ); VIZCore3D.NET.Data.BoundBox3D selectionbox = new Data.BoundBox3D(min, max); int id = vizcore3dMain.SelectionBox.Add( selectionbox , Color.FromArgb(10, Color.White) , Color.Black , title ); //vizcore3dMain.SelectionBox.SetLabel(id, label); BoxKey.Add(id, string.Format("{0}-{1}-{2}", x + 1, y + 1, z + 1)); } // z } // y } // x vizcore3dMain.EndUpdate(); CreateGridView(); }