aNewFeatures.insert(aFeature);
initData(aFeature, aFeatureLabel, TAG_FEATURE_ARGUMENTS);
updateHistory(aFeature);
+ aFeature->setDisabled(false); // by default created feature is enabled (this allows to recreate the results before "setCurrent" is called)
// event: model is updated
ModelAPI_EventCreator::get()->sendUpdated(aFeature, aCreateEvent);
if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) {
aNewBody = createBody(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
- aNewBody = createPart(theFeature->data(), aResIndex);
+ //aNewBody = createPart(theFeature->data(), aResIndex);
+ theFeature->execute(); // create the part result
+ break;
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
theFeature->execute(); // construction shapes are needed for sketch solver
break;
return aResult;
}
+bool Model_Session::isLoadByDemand(const std::string theDocID)
+{
+ return Model_Application::getApplication()->isLoadByDemand(theDocID);
+}
+
std::shared_ptr<ModelAPI_Document> Model_Session::copy(
std::shared_ptr<ModelAPI_Document> theSource, std::string theID)
{
/// Returns all the opened documents of the session (without postponed)
MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments();
+ /// Returns true if document is not loaded yet
+ MODEL_EXPORT virtual bool isLoadByDemand(const std::string theDocID);
+
/// Registers the plugin that creates features.
/// It is obligatory for each plugin to call this function on loading to be found by
/// the plugin manager on call of the feature)
/// Returns all the opened documents of the session (without postponed)
virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments() = 0;
+ /// Returns true if document is not loaded yet
+ virtual bool isLoadByDemand(const std::string theDocID) = 0;
+
/// Copies the document to the new one with the given id
virtual std::shared_ptr<ModelAPI_Document> copy(std::shared_ptr<ModelAPI_Document> theSource,
std::string theID) = 0;
if (!aResult) {
aResult = document()->createPart(data());
setResult(aResult);
- aResult->activate();
+ // do not activate part by simple execution if it is not loaded yet: it must be explicitly
+ // activated for this
+ if (!ModelAPI_Session::get()->isLoadByDemand(aResult->data()->name())) {
+ aResult->activate();
+ }
}
}