- boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
- if (!aDocRef->value()) { // create a document if not yet created
- boost::shared_ptr<ModelAPI_Document> aPartSetDoc =
- ModelAPI_PluginManager::get()->rootDocument();
- aDocRef->setValue(aPartSetDoc->subDocument(data()->getName()));
+ ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
+ if (!aResult) {
+ aResult = document()->createPart(data());
+ setResult(aResult);
+ aResult->activate();