- if (aSPFeature.get() == NULL && myExternalObjectMgr->useExternal()) {
- GeomShapePtr aShape = theShape;
- if (!aShape.get()) {
- ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
- if (aResult.get())
- aShape = aResult->shape();
+ if (aSPFeature.get() == NULL) {
+ ObjectPtr anExternalObject = ObjectPtr();
+ GeomShapePtr anExternalShape = GeomShapePtr();
+ if (myExternalObjectMgr->useExternal()) {
+ if (myExternalObjectMgr->canCreateExternal()) {
+ GeomShapePtr aShape = theShape;
+ if (!aShape.get()) {
+ ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
+ if (aResult.get())
+ aShape = aResult->shape();
+ }
+ if (aShape.get() != NULL && !aShape->isNull())
+ anExternalObject =
+ myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
+ }
+ else { /// use objects of found selection
+ anExternalObject = theObject;
+ anExternalShape = theShape;
+ }