#include "ModelAPI_Document.h"
#include "ModelAPI_Data.h"
#include "ModelAPI_AttributeDocRef.h"
+#include <ModelAPI_ResultPart.h>
using namespace std;
{
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()));
+ boost::shared_ptr<ModelAPI_Document> aPartSetDoc =
+ ModelAPI_PluginManager::get()->rootDocument();
+ aDocRef->setValue(aPartSetDoc->subDocument(data()->name()));
+ }
+ // create a result only once
+ if (results().empty()) {
+ boost::shared_ptr<ModelAPI_ResultPart> aResult = document()->createPart(data());
+ setResult(aResult);
}
}