data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), GROUP_NAME_ID());
- boolean(CREATE_GROUP_ID())->setValue(false);
-}
-
-void explodeCompound(const GeomShapePtr& theCompound, ListOfShape& theSubs)
-{
- if (theCompound->isCompound() || theCompound->isCompSolid()) {
- GeomAPI_ShapeIterator anIt(theCompound);
- for (; anIt.more(); anIt.next())
- explodeCompound(anIt.current(), theSubs);
- } else
- theSubs.push_back(theCompound);
}
//=================================================================================================
if (aShape) {
std::string anError;
ListOfShape aFaces;
- ListOfShape theSubs;
- explodeCompound(aShape, theSubs);
- if( !GetSharedredFaces( theSubs,
- aFaces,
- true,
- anError))
- setError("Error in GetSharedredFaces calculation :" + anError);
+ ListOfShape theShapes;
+
+ theShapes.push_back(aShape);
+ if (!GetSharedFaces(theShapes,
+ aFaces,
+ false,
+ anError))
+ setError("Error in GetSharedFaces calculation :" + anError);
AttributeSelectionListPtr aFacesListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
GeomShapePtr aFacePtr = *anIt;
if (!aFacePtr.get()) {
- setError("GetSharedredFaces : An invalid face found " + anError);
+ setError("GetSharedFaces : An invalid face found " + anError);
}
aFacesListAttr->append( ancompSolidAttr->context(), aFacePtr);
}
<groupbox title="Shared faces">
<label id="number_shared_faces"/>
<multi_selector id="faces"
- label="Liste of faces :"
+ label="List of faces :"
icon=""
shape_types="faces"
Block_selection = "true"
// Result: sub-shapes of all possible couples of all top-level sub-objects of
// theShapes[0].
//=================================================================================================
-bool GetSharedredFaces(const ListOfShape& theShapes,
- ListOfShape & theFaces,
- const bool theMultiShare,
- std::string& theError)
+bool GetSharedFaces(const ListOfShape& theShapes,
+ ListOfShape & theFaces,
+ const bool theMultiShare,
+ std::string& theError)
{
#ifdef _DEBUG
- std::cout << "GetSharedredFaces " << std::endl;
+ std::cout << "GetSharedFaces " << std::endl;
#endif
int aLen = theShapes.size();
if (aLen < 1) return NULL;
GeomShapePtr aShapePtr = *anIt;
if (!aShapePtr.get()) {
- theError = "GetSharedredFaces : An invalid argument";
+ theError = "GetSharedFaces : An invalid argument";
return false;
}
aShape = aShapePtr->impl<TopoDS_Shape>();
// find shared shapes
// number of iterations
- int nbIters = theMultiShare || theShapes.size() > 1 ? 1 : aShapesSeq.Length()-1;
+ int nbIters = theMultiShare || theShapes.size() > 1 ? 1 : aShapesSeq.Length()-1;
// numShares factor to search (i.e. by what nb of shapes each found sub-shape should be shared)
- int nbShares = theMultiShare ? aShapesSeq.Length()-1 : 1;
+ int nbShares = theMultiShare ? aShapesSeq.Length()-1 : 1;
for (int iter = 1; iter <= nbIters; iter++) {
for (int ind = iter+1; ind <= aShapesSeq.Length(); ind++) {
/// \param theFaces the faces shared
/// \param theError error
GEOMALGOAPI_EXPORT
-bool GetSharedredFaces(const ListOfShape& theShapes,
- ListOfShape & theFaces,
- const bool theMultiShare,
- std::string& theError);
+bool GetSharedFaces(const ListOfShape& theShapes,
+ ListOfShape & theFaces,
+ const bool theMultiShare,
+ std::string& theError);
#endif //GEOMALGOAPI_SHAREDFACES_H_
Test19707.py
Test19726.py
Test19912.py
+ Test19932.py
+ Test19989.py
)