From aa5ce1d37feb958c51e3c5ad596c3825c3ff89a8 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 16 Mar 2005 12:55:58 +0000 Subject: [PATCH] PAL8395: Improve CheckCompoundOfBlocks and RemoveExtraEdges. Improvement done by SKL. --- src/GEOMAlgo/BlockFix_CheckTool.cdl | 1 + src/GEOMAlgo/BlockFix_CheckTool.cxx | 45 +++++++++++++------ src/GEOMAlgo/BlockFix_CheckTool.hxx | 1 + src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx | 26 +++++++++-- 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cdl b/src/GEOMAlgo/BlockFix_CheckTool.cdl index 959ada723..d05d517fd 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.cdl +++ b/src/GEOMAlgo/BlockFix_CheckTool.cdl @@ -38,6 +38,7 @@ fields myNbSolids : Integer; myNbBlocks : Integer; myPossibleBlocks : SequenceOfShape from TopTools; + myNbDegen : Integer; myNbUF : Integer; myNbUE : Integer; myNbUFUE : Integer; diff --git a/src/GEOMAlgo/BlockFix_CheckTool.cxx b/src/GEOMAlgo/BlockFix_CheckTool.cxx index ba902ba5a..2c386c961 100644 --- a/src/GEOMAlgo/BlockFix_CheckTool.cxx +++ b/src/GEOMAlgo/BlockFix_CheckTool.cxx @@ -54,6 +54,7 @@ void BlockFix_CheckTool::Perform() { myNbSolids=0; myNbBlocks=0; + myNbDegen=0; myNbUF=0; myNbUE=0; myNbUFUE=0; @@ -108,13 +109,29 @@ void BlockFix_CheckTool::Perform() } } - Standard_Integer ne=0; + Standard_Integer nbe=0; + TopTools_MapOfShape DegenEdges; TopExp_Explorer expe; - for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) ne++; - ne = ne/2; - if(ne<12) + for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) { + TopoDS_Edge E = TopoDS::Edge(expe.Current()); + if(BRep_Tool::Degenerated(E)) { + if(!DegenEdges.Contains(E)) { + DegenEdges.Add(E); + } + } + else { + nbe++; + } + } + if( nbe==24 && DegenEdges.Extent()>0 ) { + IsBlock=Standard_False; + myNbDegen++; + myPossibleBlocks.Append(aSolid); + continue; + } + if(nbe<24) IsBlock=Standard_False; - if(ne>12) { + if(nbe>24) { IsBlock=Standard_False; // check edges unification // creating map of edge faces @@ -141,13 +158,13 @@ void BlockFix_CheckTool::Perform() } } } - Standard_Integer i = 1; - for (; i <= aMapFacesEdges.Extent(); i++) { + Standard_Integer i=1; + for(; i<=aMapFacesEdges.Extent(); i++) { const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i); - if (ListEdges.Extent() > 1) break; + if(ListEdges.Extent()>1) break; } - if (i <= aMapFacesEdges.Extent()) { - MayBeUE = Standard_True; + if(i<=aMapFacesEdges.Extent()) { + MayBeUE=Standard_True; break; } } @@ -214,11 +231,11 @@ void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const S<<" total number of solids = "<