#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeRefList.h>
#include <ModelAPI_Feature.h>
-#include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Tools.h>
}
ResultPtr aContext = anAttrSelection->context();
if(!aContext.get()) {
- theError = "Error: Empty selection context.";
- return false;
+ FeaturePtr aContFeat = anAttrSelection->contextFeature();
+ if (!aContFeat.get()) {
+ theError = "Error: Empty selection context.";
+ return false;
+ }
}
ResultConstructionPtr aResultConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
}
}
std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
- GeomShapePtr aContextShape = aContext->shape();
if(!aShape.get()) {
+ GeomShapePtr aContextShape = aContext->shape();
aShape = aContextShape;
}
if(!aShape.get()) {
theError = "Error: Empty shape.";
return false;
}
- if(!aShape->isEqual(aContextShape)) {
+ if (aContext.get() && !aShape->isEqual(aContext->shape())) {
theError = "Error: Local selection not allowed.";
return false;
}
return false;
}
- ResultCompSolidPtr aContextOwner = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aContextOwner = ModelAPI_Tools::bodyOwner(aContext);
GeomShapePtr anOwner = aContextOwner.get() ? aContextOwner->shape() : aContext->shape();
if (anOwner->shapeType() != GeomAPI_Shape::SOLID &&
return false;
}
- ResultCompSolidPtr aResultCompsolid =
- std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aContext);
- if(aResultCompsolid.get()) {
+ ResultBodyPtr aResultBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContext);
+ if(aResultBody.get()) {
continue;
}
+ FeaturePtr aResultFeature = aSelectAttr->contextFeature();
+ if(aResultFeature.get()) {
+ bool aOkRes = false;
+ std::list<ResultPtr>::const_iterator aFRes = aResultFeature->results().cbegin();
+ for(; aFRes != aResultFeature->results().cend() && !aOkRes; aFRes++) {
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aFRes);
+ if (aBody.get() && !aBody->isDisabled())
+ aOkRes = true;
+ }
+ if (aOkRes)
+ continue;
+ }
theError = "Error: Only body shapes and construction planes are allowed for selection.";
return false;
return false;
}
- ResultCompSolidPtr aResult =
- std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aContext);
+ ResultBodyPtr aResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContext);
if(!aResult.get()) {
continue;
}
std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
bool isAllInSameCompSolid = true;
- ResultCompSolidPtr aCompSolid;
+ ResultBodyPtr aCompSolid;
AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
if (anAttrSelList)
{
AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get())
{
if (aCompSolid.get())
{
AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get())
{
if (aCompSolid.get())
if (aShape->isSolid() || aShape->isCompSolid()) {
aSelectedShapesType = GeomAPI_Shape::SOLID;
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get()) {
GeomShapePtr aCompSolidShape = aResCompSolidPtr->shape();
aSelectedCompSolidsInOtherList.bind(aCompSolidShape, aCompSolidShape);
return false;
}
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get()) {
GeomShapePtr aCompSolidShape = aResCompSolidPtr->shape();
if (aSelectedCompSolidsInOtherList.isBound(aCompSolidShape)) {
std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
bool isAllInSameCompSolid = true;
- ResultCompSolidPtr aCompSolid;
+ ResultBodyPtr aCompSolid;
AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
if (anAttrSelList) {
for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex) {
AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get()) {
if (aCompSolid.get()) {
isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
for (int anIndex = 0; anIndex < aToolsNb; ++anIndex) {
AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (aResCompSolidPtr.get()) {
if (aCompSolid.get()) {
isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;