From: skv Date: Wed, 3 Feb 2016 13:55:29 +0000 (+0300) Subject: MakeShell: compound acceptance, update TUI documentation X-Git-Tag: V8_0_0rc1~2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78b2a5e0dad1c9a5b0085b8548adf55df319d59e;p=modules%2Fgeom.git MakeShell: compound acceptance, update TUI documentation --- diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 5072071be..46bcd193e 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -165,9 +165,55 @@ namespace } /** - * This function constructs a shell or a compound of shells from a set of faces and/or shells. + * This function adds faces from the input shape into the list of faces. If + * the input shape is a face, it is added itself. If it is a shell, its + * sub-shapes (faces) are added. If it is a compound, its sub-shapes + * (faces or shells) are added in the list. For null shapes and for other + * types of shapes an exception is thrown. * - * @param theShapes is a set of faces and/or shells. + * @param theShape the shape to be added. Either face or shell or a compound + * of faces and/or shells. + * @param theListFaces the list of faces that is modified on output. + * @param theMapFence the map that protects from adding the same faces in + * the list. + */ + void addFaces(const TopoDS_Shape &theShape, + TopTools_ListOfShape &theListFaces, + TopTools_MapOfShape &theMapFence) + { + if (theShape.IsNull()) { + Standard_NullObject::Raise("Face for shell construction is null"); + } + + // Append the shape is the mapFence + if (theMapFence.Add(theShape)) { + // Shape type + const TopAbs_ShapeEnum aType = theShape.ShapeType(); + + if (aType == TopAbs_FACE) { + theListFaces.Append(theShape); + } else if (aType == TopAbs_SHELL || aType == TopAbs_COMPOUND) { + TopoDS_Iterator anIter(theShape); + + for (; anIter.More(); anIter.Next()) { + // Add sub-shapes: faces for shell or faces/shells for compound. + const TopoDS_Shape &aSubShape = anIter.Value(); + + addFaces(aSubShape, theListFaces, theMapFence); + } + } else { + Standard_TypeMismatch::Raise + ("Shape for shell construction is neither a shell nor a face"); + } + } + } + + /** + * This function constructs a shell or a compound of shells + * from a set of faces and/or shells. + * + * @param theShapes is a set of faces, shells and/or + * compounds of faces/shells. * @return a shell or a compound of shells. */ TopoDS_Shape makeShellFromFaces @@ -192,33 +238,7 @@ namespace // Shape const TopoDS_Shape aShape = aRefShape->GetValue(); - if (aShape.IsNull()) { - Standard_NullObject::Raise("Face for shell construction is null"); - } - - // Shape type - const TopAbs_ShapeEnum aType = aShape.ShapeType(); - - if (aType == TopAbs_SHELL) { - // Get faces. - TopExp_Explorer anExp(aShape, TopAbs_FACE); - - for (; anExp.More(); anExp.Next()) { - const TopoDS_Shape &aFace = anExp.Current(); - - if (aMapFence.Add(aFace)) { - aListFaces.Append(aFace); - } - } - } else if (aType == TopAbs_FACE) { - // Append the face in the list - if (aMapFence.Add(aShape)) { - aListFaces.Append(aShape); - } - } else { - Standard_TypeMismatch::Raise - ("Shape for shell construction is neither a shell nor a face"); - } + addFaces(aShape, aListFaces, aMapFence); } // Perform computation of shells. diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 297b3a18a..379105b72 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -4834,8 +4834,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): self._autoPublish(anObj, theName, "face") return anObj - ## Create a shell from the set of faces and shells. - # @param theFacesAndShells List of faces and/or shells. + ## Create a shell from the set of faces, shells and/or compounds of faces. + # @param theFacesAndShells List of faces, shells and/or compounds of faces. # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name.