isOwnerSet = aDir.get();
}
if (thePrs->object() && (feature() != thePrs->object())) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object());
- DataPtr aData = feature()->data();
- AttributeSelectionPtr aSelAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
- (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
- if (aSelAttr.get()) {
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
- if (aRes.get()) {
- 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);
- aSelAttr->setValue(aRes, aShapePtr);
- isOwnerSet = true;
- }
- }
- else {
- aSelAttr->setValue(aFeature, GeomShapePtr());
- GeomShapePtr aSelShape = aSelAttr->value();
- if (!aSelShape.get() && aSelAttr->contextFeature().get() &&
- aSelAttr->contextFeature()->firstResult().get()) {
- aSelShape = aSelAttr->contextFeature()->firstResult()->shape();
+ if (thePrs->object()->groupName() != ModelAPI_ResultConstruction::group()) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object());
+ DataPtr aData = feature()->data();
+ AttributeSelectionPtr aSelAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+ (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
+ if (aSelAttr.get()) {
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
+ if (aRes.get()) {
+ 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);
+ aSelAttr->setValue(aRes, aShapePtr);
+ isOwnerSet = true;
+ }
}
- if (aSelShape.get() && aSelShape->isPlanar()) {
- const TopoDS_Shape& aTDShape = aSelShape->impl<TopoDS_Shape>();
- setSketchPlane(aTDShape);
- isOwnerSet = true;
+ else {
+ aSelAttr->setValue(aFeature, GeomShapePtr());
- GeomShapePtr aShape = aSelAttr->value();
- if (!aShape.get() && aSelAttr->contextFeature().get() &&
++ GeomShapePtr aSelShape = aSelAttr->value();
++ if (!aSelShape.get() && aSelAttr->contextFeature().get() &&
+ aSelAttr->contextFeature()->firstResult().get()) {
- aShape = aSelAttr->contextFeature()->firstResult()->shape();
++ aSelShape = aSelAttr->contextFeature()->firstResult()->shape();
+ }
- if (aShape.get() && aShape->isPlanar()) {
- const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
++ if (aSelShape.get() && aSelShape->isPlanar()) {
++ const TopoDS_Shape& aTDShape = aSelShape->impl<TopoDS_Shape>();
+ setSketchPlane(aTDShape);
+ isOwnerSet = true;
+ }
}
}
}