private void SelectionBox_OnSelectionBoxDeletedEvent(object sender, Event.EventManager.SelectionBoxDeletedEventArgs e) { if (e.ID == null || e.ID.Count == 0) { return; } lvList.BeginUpdate(); foreach (int item in e.ID) { int index = -1; for (int i = 0; i < lvList.Items.Count; i++) { ListViewItem lvi = lvList.Items[i]; if (lvi.Tag == null) { continue; } VIZCore3D.NET.Data.SelectionBox box = (VIZCore3D.NET.Data.SelectionBox)lvi.Tag; if (box.ID == item) { index = i; break; } } if (index != -1) { lvList.Items.RemoveAt(index); } } lvList.EndUpdate(); }
private void btnExportGrid_Click(object sender, EventArgs e) { if (vizcore3dMain.Model.IsOpen() == false) { return; } if (vizcore3dMain.SelectionBox.Items.Count == 0) { return; } if (BoxKey == null || BoxKey.Count == 0) { return; } string path = GetGridExportPath(true); List <string> output_grid = new List <string>(); vizcore3dMain.ShowWaitForm(); foreach (KeyValuePair <int, string> box in BoxKey) { VIZCore3D.NET.Data.SelectionBox item = vizcore3dMain.SelectionBox.GetItem(box.Key); List <int> parts = vizcore3dMain.SelectionBox.GetObject3DIndex( box.Key , VIZCore3D.NET.Data.BoundBoxSearchOption.IncludingPart ); if (parts.Count == 0) { continue; } string output = string.Format("{0}\\{1}.viz", path, box.Value); vizcore3dMain.UpdateWaitForm("Export Grid...", box.Value); bool result_grid = vizcore3dMain.Model.ExportGrid(output, item.BoundBox, true); if (result_grid == false) { continue; } output_grid.Add(output); } vizcore3dMain.CloseWaitForm(); if (output_grid.Count == 0) { return; } vizcore3dDisassembly.Model.Close(); vizcore3dDisassembly.Model.Add(output_grid); }
private void DisplayMessage(int id) { VIZCore3D.NET.Data.SelectionBox info = vizcore3d.SelectionBox.GetItem(id); VIZCore3D.NET.Data.Vertex3D cog = vizcore3d.SelectionBox.GetCOG(id, Data.BoundBoxSearchOption.FullyContained); vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_01, "선택상자", 5, 5, VIZCore3D.NET.Data.FontSize.Size_14_Bold, Color.Red); vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_02, string.Format("Title : {0}", info.Title), 5, 20, VIZCore3D.NET.Data.FontSize.Size_14, Color.Orange); vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_03, string.Format("Lable : {0}", info.Label), 5, 35, VIZCore3D.NET.Data.FontSize.Size_14, Color.Yellow); vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_04, string.Format("COG : {0}", cog.ToString()), 5, 50, VIZCore3D.NET.Data.FontSize.Size_14, Color.Green); vizcore3d.View.Message.Show(VIZCore3D.NET.Data.MessageId.ID_05, string.Format("Size : {0} / {1}", info.MinPoint.ToString(), info.MaxPoint.ToString()), 5, 65, VIZCore3D.NET.Data.FontSize.Size_14, Color.Blue); }
private void SelectionBox_OnSelectionBoxDragEvent(object sender, VIZCore3D.NET.Event.EventManager.SelectionBoxEventArgs e) { VIZCore3D.NET.Data.SelectionBox info = vizcore3d.SelectionBox.GetItem(e.ID); vizcore3d.View.Message.Show(Data.MessageId.ID_05, string.Format("Size : {0} / {1}", info.MinPoint.ToString(), info.MaxPoint.ToString()), 5, 65, Data.FontSize.Size_14, Color.Blue); }
private void CreateGridView() { vizcore3dGrid.BeginUpdate(); int rootIndex = vizcore3dGrid.Model.NewEmptyModel("GRID"); 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; for (int z = zCount; z > 0; z--) { string assemblyName = string.Format("Z-AXIS-#{0}", z); VIZCore3D.NET.Data.Node assemblyNode = vizcore3dGrid.Structure.CreateNode( rootIndex /* Parent Node Index */ , VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */ , assemblyName /* Node Name */ ); foreach (KeyValuePair <int, string> item in BoxKey) { string zLabel = item.Value.Substring(item.Value.Length - 1); if (zLabel != z.ToString()) { continue; } string partName = item.Value; VIZCore3D.NET.Data.Node partNode = vizcore3dGrid.Structure.CreateNode( assemblyNode.Index /* Parent Node Index */ , VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */ , partName /* Node Name */ ); string bodyName = string.Format("BODY-{0}", item.Value); int bodyId = vizcore3dGrid.Structure.CreateBody( partNode.Index /* Parent Node Index */ , bodyName /* Node Name */ ); int bodyIndex = vizcore3dGrid.Object3D.GetBodyIndex(bodyId); VIZCore3D.NET.Data.SelectionBox selectionBox = vizcore3dMain.SelectionBox.GetItem(item.Key); List <float> length = new List <float>() { selectionBox.BoundBox.LengthX , selectionBox.BoundBox.LengthY , selectionBox.BoundBox.LengthZ }; VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D(); matrix.SetTranslate(selectionBox.BoundBox.GetCenter().ToVector3D()); vizcore3dGrid.MeshEdit.AddPrimitiveBox( bodyIndex /* Body Node Index */ , length /* Length */ , matrix /* Matrix */ , Color.White /* Color */ , false /* Rebuild Data */ ); } } vizcore3dGrid.Structure.RebuildData(); vizcore3dGrid.View.SilhouetteEdge = true; vizcore3dGrid.View.XRay.Enable = true; vizcore3dGrid.View.ResetView(); vizcore3dGrid.EndUpdate(); }