X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FInitializationPlugin%2FInitializationPlugin_EvalListener.cpp;h=f698026f44e20f36c4a6964af04220af14308ef6;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=4e2d8f6c6eec96bd98797b86e6872ec389a641c2;hpb=8e643ca0a81cd0d2a306efac509016e84b5282d9;p=modules%2Fshaper.git diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp index 4e2d8f6c6..f698026f4 100644 --- a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp +++ b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp @@ -1,4 +1,4 @@ -// 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 @@ -78,6 +78,7 @@ InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() 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(new InitializationPlugin_PyInterp()); myInterp->initialize(); @@ -179,6 +180,16 @@ void InitializationPlugin_EvalListener::processEvent( } aMsg->setResults(aParamsList, anError); } + else if (theMessage->eventID() == ModelAPI_ImportParametersMessage::eventId()) + { + std::shared_ptr aMsg = + std::dynamic_pointer_cast(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 + "\")"); + } } //=================================================================================================