-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), NULL, true);
aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), NULL, true);
aLoop->registerListener(this, ModelAPI_ComputePositionsMessage::eventId(), NULL, true);
+ aLoop->registerListener(this, ModelAPI_ImportParametersMessage::eventId(), NULL, true);
myInterp = std::shared_ptr<InitializationPlugin_PyInterp>(new InitializationPlugin_PyInterp());
myInterp->initialize();
}
aMsg->setResults(aParamsList, anError);
}
+ else if (theMessage->eventID() == ModelAPI_ImportParametersMessage::eventId())
+ {
+ std::shared_ptr<ModelAPI_ImportParametersMessage> aMsg =
+ std::dynamic_pointer_cast<ModelAPI_ImportParametersMessage>(theMessage);
+ std::string anImportScript("from salome.shaper import model;");
+ std::string aDocScript("doc = model.activeDocument();");
+ std::string anParamImpScript("model.importParameters(doc, \"");
+ std::string aPath = aMsg->filename();
+ myInterp->runString(anImportScript + aDocScript + anParamImpScript + aPath + "\")");
+ }
}
//=================================================================================================