if (aSelAttr.get()) {
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
if (aRes.get()) {
- GeomShapePtr aShapePtr = ModelAPI_Tools::shape(aRes);
+ GeomShapePtr aShapePtr;
+ if (!aShape.get() || aShape->isNull()) { // selection happens in the OCC viewer
+ aShapePtr = ModelAPI_Tools::shape(aRes);
+ }
+ else { // selection happens in OB browser
+ aShapePtr = aShape;
+ }
if (aShapePtr.get() && aShapePtr->isFace()) {
const TopoDS_Shape& aTDShape = aShapePtr->impl<TopoDS_Shape>();
setSketchPlane(aTDShape);
isOwnerSet = true;
}
}
+ else {
+ aSelAttr->setValue(aFeature, GeomShapePtr());
+ GeomShapePtr aShape = aSelAttr->value();
+ if (!aShape.get() && aSelAttr->contextFeature().get() &&
+ aSelAttr->contextFeature()->firstResult().get()) {
+ aShape = aSelAttr->contextFeature()->firstResult()->shape();
+ }
+ if (aShape.get() && aShape->isPlanar()) {
+ const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
+ setSketchPlane(aTDShape);
+ isOwnerSet = true;
+ }
+ }
}
}
return isOwnerSet;