#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_MakeSweep.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_Prism.h>
#include <GeomAlgoAPI_Revolution.h>
// Pass shells/faces to solids creation function.
ListOfShape aTools;
- std::list<std::shared_ptr<GeomAPI_Interface>> aSolidsAlgos;
+ ListOfMakeShape aSolidsAlgos;
makeSolids(aShells, aTools, aSolidsAlgos);
if(aTools.empty()) {
return;
//=================================================================================================
void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const ListOfShape& theShells,
- const std::list<std::shared_ptr<GeomAPI_Interface>>& theSolidsAlgos,
+ ListOfMakeShape& theSolidsAlgos,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
const ListOfShape& theTools,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
ListOfShape::const_iterator aShellsIter = theShells.begin();
- std::list<std::shared_ptr<GeomAPI_Interface>>::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
+ ListOfMakeShape::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin();
for(; aShellsIter != theShells.end() && aSolidsAlgosIter != theSolidsAlgos.end(); aShellsIter++, aSolidsAlgosIter++) {
- ListOfShape aFromFaces;
- ListOfShape aToFaces;
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes;
-
//Insert lateral face : Face from Edge
- if(std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter)) {
- std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(*aSolidsAlgosIter);
- aSubShapes = aPrismAlgo->mapOfSubShapes();
- theResultBody->loadAndOrientGeneratedShapes(aPrismAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
+ std::shared_ptr<GeomAlgoAPI_MakeShape> aSolidAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeShape>(*aSolidsAlgosIter);
+ if(aSolidAlgo.get()) {
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aSolidAlgo->mapOfSubShapes();
+ theResultBody->loadAndOrientGeneratedShapes(aSolidAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
aLatName, *aSubShapes.get());
- aFromFaces = aPrismAlgo->fromFaces();
- aToFaces = aPrismAlgo->toFaces();
- } else if(std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter)) {
- std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_Revolution>(*aSolidsAlgosIter);
- aSubShapes = aRevolAlgo->mapOfSubShapes();
- theResultBody->loadAndOrientGeneratedShapes(aRevolAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag,
- aLatName, *aSubShapes.get());
- aFromFaces = aRevolAlgo->fromFaces();
- aToFaces = aRevolAlgo->toFaces();
- }
- //Insert to faces
- for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
- if(aSubShapes->isBound(aToFace)) {
- aToFace = aSubShapes->find(aToFace);
- }
- theResultBody->generated(aToFace, aToName, aToTag++);
- }
+ std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(aSolidAlgo);
+ if(aSweepAlgo.get()) {
+ //Insert to faces
+ const ListOfShape& aToFaces = aSweepAlgo->toFaces();
+ for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
+ if(aSubShapes->isBound(aToFace)) {
+ aToFace = aSubShapes->find(aToFace);
+ }
+ theResultBody->generated(aToFace, aToName, aToTag++);
+ }
- //Insert from faces
- if (aFromTag < aToTag) aFromTag = aToTag;
- for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
- if(aSubShapes->isBound(aFromFace)) {
- aFromFace = aSubShapes->find(aFromFace);
+ //Insert from faces
+ const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
+ if (aFromTag < aToTag) aFromTag = aToTag;
+ for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
+ if(aSubShapes->isBound(aFromFace)) {
+ aFromFace = aSubShapes->find(aFromFace);
+ }
+ theResultBody->generated(aFromFace, aFromName, aFromTag++);
+ }
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
}
/// Define this function to create solids from faces with extrusion/revolution.
virtual void makeSolids(const ListOfShape& theFaces,
ListOfShape& theResults,
- std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos) = 0;
+ ListOfMakeShape& theAlgos) = 0;
/// Results naming.
void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const ListOfShape& theShells,
- const std::list<std::shared_ptr<GeomAPI_Interface>>& theSolidsAlgos,
+ ListOfMakeShape& theSolidsAlgos,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
const ListOfShape& theTools,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
int aErrorsNum = 0;
int aResultIndex = 0;
for(ListOfShape::const_iterator anIter = aShells.cbegin(); anIter != aShells.cend(); anIter++) {
- std::shared_ptr<GeomAPI_Shape> aResult;
- ListOfShape aFromFaces, aToFaces;
std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape;
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aDataMap;
std::shared_ptr<GeomAPI_Shape> aBaseFace = *anIter;
- makeSolid(aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap);
- if(!aResult.get()) {
+ makeSolid(aBaseFace, aMakeShape);
+ if(!aMakeShape.get()) {
aErrorsNum++;
continue;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap);
+ loadNamingDS(aResultBody, aBaseFace, aMakeShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
//=================================================================================================
void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Shape>& theResult,
- const ListOfShape& theFromFaces,
- const ListOfShape& theToFaces,
- const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
{
//load result
- theResultBody->storeGenerated(theBaseShape, theResult);
+ theResultBody->storeGenerated(theBaseShape, theMakeShape->shape());
//Insert lateral face : Face from Edge
const std::string aLatName = "LateralFace";
const int aLatTag = 1;
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *theDataMap);
-
- //Insert to faces
- const std::string aToName = "ToFace";
- int aToTag = 2;
- for(ListOfShape::const_iterator anIt = theToFaces.cbegin(); anIt != theToFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
- if(theDataMap->isBound(aToFace)) {
- aToFace = theDataMap->find(aToFace);
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> aDataMap = theMakeShape->mapOfSubShapes();
+ theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aDataMap.get());
+
+ std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
+ if(aSweepAlgo.get()) {
+ //Insert to faces
+ const std::string aToName = "ToFace";
+ int aToTag = 2;
+ const ListOfShape& aToFaces = aSweepAlgo->toFaces();
+ for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
+ if(aDataMap->isBound(aToFace)) {
+ aToFace = aDataMap->find(aToFace);
+ }
+ theResultBody->generated(aToFace, aToName, aToTag++);
}
- theResultBody->generated(aToFace, aToName, aToTag++);
- }
- //Insert from faces
- const std::string aFromName = "FromFace";
- int aFromTag = aToTag > 10000 ? aToTag : 10000;
- for(ListOfShape::const_iterator anIt = theFromFaces.cbegin(); anIt != theFromFaces.cend(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
- if(theDataMap->isBound(aFromFace)) {
- aFromFace = theDataMap->find(aFromFace);
+ //Insert from faces
+ const std::string aFromName = "FromFace";
+ int aFromTag = aToTag > 10000 ? aToTag : 10000;
+ const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
+ for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
+ if(aDataMap->isBound(aFromFace)) {
+ aFromFace = aDataMap->find(aFromFace);
+ }
+ theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
}
/// Define this function to create solids from faces with extrusion/revolution.
virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
- std::shared_ptr<GeomAPI_Shape>& theResult,
- ListOfShape& theFromFaces,
- ListOfShape& theToFaces,
- std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap) = 0;
+ std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape) = 0;
/// Results naming.
void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
- const std::shared_ptr<GeomAPI_Shape>& theResult,
- const ListOfShape& theFromFaces,
- const ListOfShape& theToFaces,
- const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
};
#endif
//=================================================================================================
void FeaturesPlugin_ExtrusionBoolean::makeSolids(const ListOfShape& theFaces,
ListOfShape& theResults,
- std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos)
+ ListOfMakeShape& theAlgos)
{
// Getting extrusion sizes.
double aToSize = 0.0;
/// Create solids from faces with extrusion.
virtual void makeSolids(const ListOfShape& theFaces,
ListOfShape& theResults,
- std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos);
+ ListOfMakeShape& theAlgos);
protected:
FeaturesPlugin_ExtrusionBoolean(){};
//=================================================================================================
void FeaturesPlugin_ExtrusionSketch::makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
- std::shared_ptr<GeomAPI_Shape>& theResult,
- ListOfShape& theFromFaces,
- ListOfShape& theToFaces,
- std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+ std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
{
// Getting extrusion sizes.
double aToSize = 0.0;
return;
}
- theResult = aPrismAlgo->shape();
- theFromFaces = aPrismAlgo->fromFaces();
- theToFaces = aPrismAlgo->toFaces();
theMakeShape = aPrismAlgo;
- theDataMap = aPrismAlgo->mapOfSubShapes();
}
/// Create solid from face with extrusion.
virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
- std::shared_ptr<GeomAPI_Shape>& theResult,
- ListOfShape& theFromFaces,
- ListOfShape& theToFaces,
- std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+ std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
public:
/// Use plugin manager for features creation.
//=================================================================================================
void FeaturesPlugin_RevolutionBoolean::makeSolids(const ListOfShape& theFaces,
ListOfShape& theResults,
- std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos)
+ ListOfMakeShape& theAlgos)
{
//Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
/// Create solids from faces with revolution.
virtual void makeSolids(const ListOfShape& theFaces,
ListOfShape& theResults,
- std::list<std::shared_ptr<GeomAPI_Interface>>& theAlgos);
+ ListOfMakeShape& theAlgos);
protected:
FeaturesPlugin_RevolutionBoolean(){};
//=================================================================================================
void FeaturesPlugin_RevolutionSketch::makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
- std::shared_ptr<GeomAPI_Shape>& theResult,
- ListOfShape& theFromFaces,
- ListOfShape& theToFaces,
- std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap)
+ std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
{
//Getting axis.
std::shared_ptr<GeomAPI_Ax1> anAxis;
return;
}
- theResult = aRevolAlgo->shape();
- theFromFaces = aRevolAlgo->fromFaces();
- theToFaces = aRevolAlgo->toFaces();
theMakeShape = aRevolAlgo;
- theDataMap = aRevolAlgo->mapOfSubShapes();
}
/// Create solids from faces with revolution.
virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
- std::shared_ptr<GeomAPI_Shape>& theResult,
- ListOfShape& theFromFaces,
- ListOfShape& theToFaces,
- std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape,
- std::shared_ptr<GeomAPI_DataMapOfShapeShape>& theDataMap);
+ std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
public:
/// Use plugin manager for features creation.