X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FInitializationPlugin%2FInitializationPlugin_EvalListener.cpp;h=13328a211fcbbd892cace6eeef04a82c9b00f97b;hb=77ce6d35ac8d2f0fdaecb4f23e0870bf74e36103;hp=4e2d8f6c6eec96bd98797b86e6872ec389a641c2;hpb=a42688321072c73e4d53c503d4b64056d34423d0;p=modules%2Fshaper.git diff --git a/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp b/src/InitializationPlugin/InitializationPlugin_EvalListener.cpp index 4e2d8f6c6..13328a211 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-2024 CEA, EDF // // 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 + "\")"); + } } //=================================================================================================