From 0cad33a0028b5d78e36b57f00d4e9276de61476e Mon Sep 17 00:00:00 2001 From: skv Date: Mon, 6 Apr 2015 15:54:49 +0300 Subject: [PATCH] 0022869: Group creation support for MakePipeShellsWithoutPath --- src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 97 +++++++++++++++++++++------- 1 file changed, 73 insertions(+), 24 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 8b8f27e04..4671e824a 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -1919,6 +1919,7 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases(); // vertex for recognition Handle(TColStd_HSequenceOfTransient) VObjs = aCIDS->GetLocations(); + Standard_Boolean isGenerateGroups = aCIDS->GetGenerateGroups(); Standard_Integer nbBases = aBasesObjs->Length(), nbv = (VObjs.IsNull() ? 0 :VObjs->Length()); @@ -1928,6 +1929,7 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) Standard_ConstructionError::Raise("Number of shapes for recognition is invalid"); } + TopTools_SequenceOfShape aGroups[5]; TopTools_SequenceOfShape SecVs,Bases; for (i=1; i<=nbBases; i++) { // vertex @@ -1979,8 +1981,23 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) } TopTools_MapOfShape aFaces1,aFaces2; + TopTools_MapOfShape aBndEdges1; + for (anExp.Init(aShBase1, TopAbs_FACE); anExp.More(); anExp.Next()) { - aFaces1.Add(anExp.Current()); + const TopoDS_Shape &aBaseFace1 = anExp.Current(); + + if (aFaces1.Add(aBaseFace1)) { + // Get boundary edges. + TopExp_Explorer anExpE(aBaseFace1, TopAbs_EDGE); + + for (; anExpE.More(); anExpE.Next()) { + const TopoDS_Shape &aBaseEdge1 = anExpE.Current(); + + if (!aBndEdges1.Add(aBaseEdge1)) { + aBndEdges1.Remove(aBaseEdge1); + } + } + } } for (anExp.Init(aShBase2, TopAbs_FACE); anExp.More(); anExp.Next()) { aFaces2.Add(anExp.Current()); @@ -2068,6 +2085,8 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) TopExp_Explorer anExpE(F1,TopAbs_EDGE); TopTools_SequenceOfShape aNewFs; + TopTools_SequenceOfShape aLocalGroups[5]; + //int nbee=0; for (; anExpE.More(); anExpE.Next()) { TopoDS_Edge E1 = TopoDS::Edge(anExpE.Current()); @@ -2295,8 +2314,13 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) TopoDS_Face FixedFace = sff->Face(); aNewFs.Append(FixedFace); VPE.Add(E1,FixedFace); - //cout<<" face for edge "<SetTolerance(Precision::Confusion()); @@ -2344,32 +2377,48 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) B.Add(aComp,aShell); MESSAGE (" solid for face "<Perform(); - //TopoDS_Shell FixedShell = sfs->Shell(); - /* - GProp_GProps aSystem; - BRepGProp::VolumeProperties(FixedShell, aSystem); - if (aSystem.Mass()<0) { - //cout<<"aSewShape is reversed"<IsModifiedSubShape(aGrpShape)) { + // Use the shape modified by sewing. + const TopoDS_Shape &aModifGrpShape = + aSewing->ModifiedSubShape(aGrpShape); + + aGroups[iGrp].Append(aModifGrpShape); + } else { + // Use the shape as it is. + aGroups[iGrp].Append(aGrpShape); + } + } + } } - */ } } - //BRepTools::Write(aComp,"/dn02/users_Linux/skl/work/Bugs/14857/comp.brep"); + if (isGenerateGroups) { + // Fill the groups. + Handle(TColStd_HArray1OfInteger) aGroupIds[5]; + TopTools_IndexedMapOfShape anIndices; + + TopExp::MapShapes(aComp, anIndices); + + if (!FillGroups(aGroups, anIndices, aGroupIds)) { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("Generate groups failure"); + } + + StoreGroups(aCI, aGroupIds); + } + return aComp; } -- 2.39.2