private void btnTest_Click(object sender, EventArgs e) { List <VIZCore3D.NET.Data.Node> nodes = vizcore3d.Object3D.FromFilter(Data.Object3dFilter.PART); Dictionary <string, int> map = new Dictionary <string, int>(); foreach (VIZCore3D.NET.Data.Node item in nodes) { if (map.ContainsKey(item.NodeName) == false) { map.Add(item.NodeName, item.Index); } } List <SampleItem> items = GetSampleData(); vizcore3d.BeginUpdate(); foreach (SampleItem item in items) { if (map.ContainsKey(item.Name1) == false) { continue; } if (map.ContainsKey(item.Name2) == false) { continue; } item.Index1 = map[item.Name1]; item.Index2 = map[item.Name2]; VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem nv = vizcore3d.GeometryUtility.GetConnectedSurfaceNormalVector( item.Index1 , item.Index2 , new Data.Vertex3D(item.X, item.Y, item.Z) , 10 /* Face Distance Tolerance */ ); AddResult(nv, true, true); } vizcore3d.EndUpdate(); }
private void lvResult_DoubleClick(object sender, EventArgs e) { if (lvResult.SelectedItems.Count == 0) { return; } if (lvResult.SelectedItems[0].Tag == null) { return; } ListViewItem lvi = lvResult.SelectedItems[0]; VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem nv = (VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem)lvi.Tag; vizcore3d.Object3D.Select(Data.Object3dSelectionModes.DESELECT_ALL); vizcore3d.Object3D.Select(new List <int>() { nv.Index1, nv.Index2 }, true, true); }
private void btnGetNormalVector_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtPart1.Text) == true) { return; } if (String.IsNullOrEmpty(txtPart2.Text) == true) { return; } VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem item = vizcore3d.GeometryUtility.GetConnectedSurfaceNormalVector( Convert.ToInt32(txtPart1.Text) , Convert.ToInt32(txtPart2.Text) ); AddResult(item, true, false); txtPart1.Text = String.Empty; txtPart2.Text = String.Empty; }
private void AddResult(VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem item, bool note, bool nv) { VIZCore3D.NET.Data.Node node1 = vizcore3d.Object3D.FromIndex(item.Index1); VIZCore3D.NET.Data.Node node2 = vizcore3d.Object3D.FromIndex(item.Index2); string no = Convert.ToString(lvResult.Items.Count + 1); ListViewItem lvi = new ListViewItem( new string[] { no , node1.Index.ToString() , node2.Index.ToString() , node1.NodeName , node2.NodeName , item.UseTestPosition == true ? item.TestPosition.ToString() : "" , item.Normal.ToString() , item.Projection1.ToString() , item.Projection2.ToString() } ); lvi.Tag = item; lvResult.Items.Add(lvi); if (note == true) { VIZCore3D.NET.Data.MultiColorText text = new Data.MultiColorText(); text.AddLine(string.Format("NO. : {0}", no), Color.Purple); text.AddLine(string.Format("NODE #1 : {0}", node1.NodeName), Color.Black); text.AddLine(string.Format("NODE #2 : {0}", node2.NodeName), Color.Blue); text.AddLine(string.Format("N/V : {0}", item.Normal.ToString()), Color.Red); VIZCore3D.NET.Data.Vertex3D pos = new VIZCore3D.NET.Data.Vertex3D( item.Projection1.X + 500 , item.Projection1.Y + 500 , item.Projection1.Z + 3500 ); vizcore3d.Review.Note.AddNoteSurface(text, pos, item.Projection1); } if (nv == true) { if (Convert.ToInt32(item.Normal.X) != 0 || Convert.ToInt32(item.Normal.Y) != 0 || Convert.ToInt32(item.Normal.Z) != 0) { return; } vizcore3d.ShapeDrawing.AddVertex( new List <VIZCore3D.NET.Data.Vertex3D>() { item.TestPosition } , 0 , Color.Blue , 10 , 10 , true ); } }
private void ShowResultList() { // 침투만 조회 bool PenetrationOnly = ckPenetration.Checked; lvResult.BeginUpdate(); lvResult.Items.Clear(); List <VIZCore3D.NET.Data.ClashTestResultItem> items = null; if (clash.TestKind != VIZCore3D.NET.Data.ClashTest.ClashTestKind.GROUP_VS_MOVING_GROUP) { items = vizcore3d.Clash.GetResultItem( clash , ckResultAssembly.Checked == true ? VIZCore3D.NET.Manager.ClashManager.ResultGroupingOptions.ASSEMBLY : VIZCore3D.NET.Manager.ClashManager.ResultGroupingOptions.PART ); } else { //items = vizcore3d.Clash.GetResultItem(clash, 0, ckResultAssembly.Checked == true ? Manager.ClashManager.ResultGroupingOptions.ASSEMBLY : Manager.ClashManager.ResultGroupingOptions.PART); items = vizcore3d.Clash.GetResultAllSubItem( clash , ckResultAssembly.Checked == true ? VIZCore3D.NET.Manager.ClashManager.ResultGroupingOptions.ASSEMBLY : VIZCore3D.NET.Manager.ClashManager.ResultGroupingOptions.PART ); } // 인접면 법선벡터 구하기 bool checkConnectedSurfaceNormalVector = ckConnectedSurfaceNormalVector.Checked; for (int i = 0; i < items.Count; i++) { VIZCore3D.NET.Data.ClashTestResultItem item = items[i]; string normal = String.Empty; string projection1 = String.Empty; string projection2 = String.Empty; if (checkConnectedSurfaceNormalVector == true) { VIZCore3D.NET.Data.ConnectedSurfaceNormalVectorItem normalVector = vizcore3d.GeometryUtility.GetConnectedSurfaceNormalVector( item.NodeIndexA , item.NodeIndexB , item.HotPoint , 10.0f ); normal = normalVector.Normal.ToString(); projection1 = normalVector.Projection1.ToString(); projection2 = normalVector.Projection2.ToString(); } ListViewItem lvi = new ListViewItem( new string[] { Convert.ToString(i + 1) , item.ID.ToString() , item.SUBID.ToString() , item.Path != null ? item.Path.ToString() : String.Empty , item.GetResultKindString() , item.NodeIndexA.ToString() , item.NodeIndexB.ToString() , item.NodeNameA , item.NodeNameB , item.Distance.ToString() , item.HotPoint.ToString() , item.FrameStringX , item.FrameStringY , item.FrameStringZ , item.Flag.ToString() , item.NodeIdA.ToString() , item.NodeIdB.ToString() , item.Comment1 , item.Comment2 , item.ParentNodeNameA , item.ParentNodeNameB , item.NodePathA , item.NodePathB , normal , projection1 , projection2 } ); lvi.Tag = item; if (PenetrationOnly == true && item.ResultKind == Data.ClashTestResultItem.ClashResultKind.PENETRATION) { lvResult.Items.Add(lvi); } else if (PenetrationOnly == false) { lvResult.Items.Add(lvi); } } gbResult.Text = string.Format("Result : {0:N0} EA", lvResult.Items.Count); lvResult.EndUpdate(); }