X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Extrusion.cpp;h=8238b174388404eddc675eb24d0363e3b7d48b60;hb=919584a7e5ee83c384873c2627b9865e8ba02272;hp=20b7c254ae2c0148e193db24eea484b9143253eb;hpb=87b74a6fd4660ebfa71a40f0be84e44535f84798;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index 20b7c254a..8238b1743 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -14,6 +14,10 @@ #include +#include +#include +#include + //================================================================================================= FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() { @@ -72,17 +76,31 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, { theMakeShapes.clear(); - /// Sub-feature of the composite should be set in the base list. - setSketchObjectToList(); - // Getting base shapes. getBaseShapes(theBaseShapes); + //Getting direction. + std::shared_ptr aDir; + std::shared_ptr anEdge; + AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID()); + if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(aSelection->value())); + } else if(aSelection->context().get() && + aSelection->context()->shape().get() && + aSelection->context()->shape()->isEdge()) { + anEdge = std::shared_ptr(new GeomAPI_Edge(aSelection->context()->shape())); + } + if(anEdge.get()) { + if(anEdge->isLine()) { + aDir = anEdge->line()->direction(); + } + } + // Getting sizes. double aToSize = 0.0; double aFromSize = 0.0; - if(string(CREATION_METHOD())->value() == "BySizes") { + if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_SIZES()) { aToSize = real(TO_SIZE_ID())->value(); aFromSize = real(FROM_SIZE_ID())->value(); } else { @@ -94,8 +112,8 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, GeomShapePtr aToShape; GeomShapePtr aFromShape; - if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") { - AttributeSelectionPtr aSelection = selection(TO_OBJECT_ID()); + if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) { + aSelection = selection(TO_OBJECT_ID()); if(aSelection.get()) { aToShape = std::dynamic_pointer_cast(aSelection->value()); if(!aToShape.get() && aSelection->context().get()) { @@ -115,7 +133,7 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes, for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) { std::shared_ptr aBaseShape = *anIter; - std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, + std::shared_ptr aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize)); if(!isMakeShapeValid(aPrismAlgo)) {