private void ShowResults() { InitDesignResultList(); lvResults.BeginUpdate(); for (int i = 0; i < Blocks.Count; i++) { BlockItem block = Blocks[i]; List <string> val = new List <string>(); val.Add(block.BlockName); for (int j = 0; j < Blocks.Count; j++) { BlockItem clashBlock = Blocks[j]; bool result = block.HasClashBlock(clashBlock.BlockName); val.Add(result == true ? "Y" : "."); } ListViewItem lvi = new ListViewItem(val.ToArray()); lvi.Tag = block; lvResults.Items.Add(lvi); } lvResults.EndUpdate(); }
private void lvResults_DoubleClick(object sender, EventArgs e) { if (lvResults.SelectedItems.Count == 0) { return; } ListViewItem lvi = lvResults.SelectedItems[0]; if (lvi.Tag == null) { return; } BlockItem block = (BlockItem)lvi.Tag; Dictionary <string, List <VIZCore3D.NET.Data.Node> > nameMap = vizcore3d.Object3D.GetNodeNameMapFromDepth(1, false); vizcore3d.BeginUpdate(); vizcore3d.View.XRay.Clear(); if (vizcore3d.View.XRay.Enable == false) { vizcore3d.View.XRay.Enable = true; } vizcore3d.View.XRay.ColorType = Data.XRayColorTypes.OBJECT_COLOR; if (nameMap.ContainsKey(block.BlockName) == true) { vizcore3d.Object3D.Color.SetColor(nameMap[block.BlockName], Color.Red); vizcore3d.View.XRay.Select(nameMap[block.BlockName], true); } List <VIZCore3D.NET.Data.Node> targetBlock = new List <Data.Node>(); foreach (string item in block.ClashBlock.Keys) { if (nameMap.ContainsKey(item) == false) { continue; } targetBlock.Add(nameMap[item][0]); } if (targetBlock.Count != 0) { vizcore3d.Object3D.Color.SetColor(targetBlock, Color.Blue); vizcore3d.View.XRay.Select(targetBlock, true); } vizcore3d.EndUpdate(); }
// ================================================ // Event - GUI :: Clash // ================================================ private void btnAddClashTask_Click(object sender, EventArgs e) { if (Blocks == null || Blocks.Count == 0) { return; } Dictionary <string, List <VIZCore3D.NET.Data.Node> > nameMap = vizcore3d.Object3D.GetNodeNameMapFromDepth(1, false); for (int i = 1; i < Blocks.Count; i++) { BlockItem block = Blocks[i]; string name = block.BlockName; VIZCore3D.NET.Data.ClashTest clash = new VIZCore3D.NET.Data.ClashTest(); clash.Name = string.Format(string.Format("BLOCK : {0}", name)); clash.TestKind = VIZCore3D.NET.Data.ClashTest.ClashTestKind.GROUP_VS_GROUP; clash.UseClearanceValue = false; clash.ClearanceValue = 3.0f; clash.UseRangeValue = false; clash.RangeValue = 2.0f; clash.UsePenetrationTolerance = true; clash.PenetrationTolerance = 1.0f; clash.VisibleOnly = false; clash.BottomLevel = 2; clash.GroupA = GetPreviousBlock(nameMap, name, i); clash.GroupB = nameMap.ContainsKey(name) == true ? nameMap[name] : null; if (clash.GroupA == null || clash.GroupA.Count == 0) { continue; } if (clash.GroupB == null || clash.GroupB.Count == 0) { continue; } vizcore3d.Clash.Add(clash); block.Clash = clash; } MessageBox.Show("Completd.", "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private List <VIZCore3D.NET.Data.Node> GetPreviousBlock(Dictionary <string, List <VIZCore3D.NET.Data.Node> > source, string name, int index) { List <VIZCore3D.NET.Data.Node> nodes = new List <VIZCore3D.NET.Data.Node>(); for (int i = index - 1; i > -1; i--) { BlockItem block = Blocks[i]; string currentBlockName = block.BlockName; if (source.ContainsKey(currentBlockName) == false) { continue; } nodes.Add(source[currentBlockName][0]); } return(nodes); }
private void AnalyzeResults() { for (int i = 0; i < Blocks.Count; i++) { BlockItem block = Blocks[i]; if (block.Clash == null) { continue; } List <VIZCore3D.NET.Data.ClashTestResultItem> results = vizcore3d.Clash.GetResultItem( block.Clash , VIZCore3D.NET.Manager.ClashManager.ResultGroupingOptions.ASSEMBLY ); foreach (VIZCore3D.NET.Data.ClashTestResultItem item in results) { string[] nodepath = item.NodePathArrayA; if (nodepath == null || nodepath.Length == 0) { continue; } block.AddClashBlock(nodepath[0]); } } //StringBuilder sb = new StringBuilder(); //for (int i = 0; i < Blocks.Count; i++) //{ // BlockItem block = Blocks[i]; // sb.AppendLine(string.Format("{0} = {1}", block.BlockName, string.Join(",",block.ClashBlock.Keys.ToArray()))); //} //MessageBox.Show(sb.ToString()); ShowResults(); }