int anID = 0;
std::shared_ptr<GeomAPI_Shape> aSelection = value();
std::shared_ptr<GeomAPI_Shape> aContext = context()->shape();
+ // support for compsolids:
+ if (context().get() && ModelAPI_Tools::compSolidOwner(context()).get())
+ aContext = ModelAPI_Tools::compSolidOwner(context())->shape();
+
+
TopoDS_Shape aMainShape = aContext->impl<TopoDS_Shape>();
const TopoDS_Shape& aSubShape = aSelection->impl<TopoDS_Shape>();
// searching for the latest main shape
Handle(TNaming_NamedShape) aName;
if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
TopoDS_Shape aLatest = TNaming_Tool::CurrentShape(aName);
+ if (aLatest.IsNull())
+ return false;
if (aLatest.IsEqual(aShape))
return true;
+ // check sub-shapes for comp-solids:
+ for (TopExp_Explorer anExp(aShape, aLatest.ShapeType()); anExp.More(); anExp.Next()) {
+ if (aLatest.IsEqual(anExp.Current()))
+ return true;
+ }
}
}
}
bool Model_ResultCompSolid::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
{
- return myBuilder->isLatestEqual(theShape);
+ if (myBuilder->isLatestEqual(theShape))
+ return true;
+ // also check that it is asked for sub-elements
+ std::vector<std::shared_ptr<ModelAPI_ResultBody> >::const_iterator aSubIter = mySubs.cbegin();
+ for(; aSubIter != mySubs.cend(); aSubIter++) {
+ if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) {
+ return true;
+ }
+ }
+ return false;
}