]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix issues after valid, add API python and unitary test
authorJérôme <jerome.lucas@cesgenslab.fr>
Tue, 13 Oct 2020 09:25:59 +0000 (11:25 +0200)
committerJérôme <jerome.lucas@cesgenslab.fr>
Thu, 3 Dec 2020 13:49:55 +0000 (14:49 +0100)
13 files changed:
src/BuildAPI/BuildAPI_Interpolation.cpp
src/BuildAPI/BuildAPI_Interpolation.h
src/BuildPlugin/BuildPlugin_EvalListener.cpp
src/BuildPlugin/BuildPlugin_EvalListener.h
src/BuildPlugin/BuildPlugin_Interpolation.cpp
src/BuildPlugin/BuildPlugin_Interpolation.h
src/BuildPlugin/BuildPlugin_Plugin.cpp
src/BuildPlugin/Test/TestInterpolation.py
src/BuildPlugin/icons/feature_interpolation_analytical.png [new file with mode: 0644]
src/BuildPlugin/interpolation_widget.xml
src/Events/Events_Listener.cpp
src/GeomValidators/CMakeLists.txt
src/GeomValidators/GeomValidators_MinObjectsSelected.cpp

index 113ed4227d8905bdac1c01ebde3754944ec86477..f232b81da9c4261d0112e563905ee89ab07902d7 100644 (file)
@@ -39,6 +39,7 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature,
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
+    fillAttribute(BuildPlugin_Interpolation::CREATION_METHODE_BY_SELECTION_ID(),mycreationmethod);
     setUseTangents(true);
     setTangents(theStartTangent, theEndTangent);
     setClosed(theIsClosed);
@@ -55,6 +56,7 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature,
   : ModelHighAPI_Interface(theFeature)
 {
   if (initialize()) {
+    fillAttribute(BuildPlugin_Interpolation::CREATION_METHODE_BY_SELECTION_ID(),mycreationmethod);
     setClosed(theIsClosed);
     setReorder(theIsToReorder);
     setUseTangents(false);
@@ -62,6 +64,28 @@ BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature,
   }
 }
 
+BuildAPI_Interpolation::BuildAPI_Interpolation(const FeaturePtr& theFeature,
+                                    const std::string & theXTexpression,
+                                    const std::string & theYTexpression,
+                                    const std::string & theZTexpression,
+                                    const ModelHighAPI_Double& theMinT,
+                                    const ModelHighAPI_Double& theMaxT,
+                                    const ModelHighAPI_Integer& theNbStep) 
+: ModelHighAPI_Interface(theFeature)
+{
+  if (initialize()) {
+    fillAttribute(BuildPlugin_Interpolation::CREATION_METHODE_ANALYTICAL_ID(),mycreationmethod);
+    fillAttribute(theXTexpression, myxt);
+    fillAttribute(theYTexpression, myyt);
+    fillAttribute(theZTexpression, myzt);
+    fillAttribute(theMinT, mymint);
+    fillAttribute(theMaxT, mymaxt);
+    fillAttribute(theNbStep, mynumstep);
+
+    execute();
+  }
+}
+
 //==================================================================================================
 BuildAPI_Interpolation::~BuildAPI_Interpolation()
 {
@@ -112,24 +136,46 @@ void BuildAPI_Interpolation::dump(ModelHighAPI_Dumper& theDumper) const
   FeaturePtr aBase = feature();
   std::string aPartName = theDumper.name(aBase->document());
 
-  AttributeSelectionListPtr anAttrBaseObjects =
-    aBase->selectionList(BuildPlugin_Interpolation::BASE_OBJECTS_ID());
-
-  theDumper << aBase << " = model.addInterpolation(" << aPartName << ", "
-            << anAttrBaseObjects << ", ";
-
-  AttributeStringPtr useTangentsAttr = useTangents();
-  std::string useTangents = useTangentsAttr->value();
-  if (!useTangents.empty()) {
-    AttributeSelectionPtr anAttrStartTangent =
-      aBase->selection(BuildPlugin_Interpolation::TANGENT_START_ID());
-    AttributeSelectionPtr anAttrEndTangent =
-      aBase->selection(BuildPlugin_Interpolation::TANGENT_END_ID());
-
-    theDumper << anAttrStartTangent << ", " << anAttrEndTangent << ", ";
+  if( aBase->string(BuildPlugin_Interpolation::CREATION_METHODE_ID())->value() == 
+            BuildPlugin_Interpolation::CREATION_METHODE_BY_SELECTION_ID() )
+  {
+    AttributeSelectionListPtr anAttrBaseObjects =
+      aBase->selectionList(BuildPlugin_Interpolation::BASE_OBJECTS_ID());
+
+    theDumper << aBase << " = model.addInterpolation(" << aPartName << ", "
+              << anAttrBaseObjects << ", ";
+
+    AttributeStringPtr useTangentsAttr = useTangents();
+    std::string useTangents = useTangentsAttr->value();
+    if (!useTangents.empty()) {
+      AttributeSelectionPtr anAttrStartTangent =
+        aBase->selection(BuildPlugin_Interpolation::TANGENT_START_ID());
+      AttributeSelectionPtr anAttrEndTangent =
+        aBase->selection(BuildPlugin_Interpolation::TANGENT_END_ID());
+
+      theDumper << anAttrStartTangent << ", " << anAttrEndTangent << ", ";
+    }
+
+    theDumper << closed() << ", " << reorder() << ")" << std::endl;
+  }else{
+
+    theDumper << aBase << " = model.addInterpolation(" << aPartName ; 
+    AttributeStringPtr XtAttr = xt();
+    std::string xt = XtAttr->value();
+    AttributeStringPtr YtAttr = yt();
+    std::string yt = YtAttr->value();
+    AttributeStringPtr ZtAttr = zt();
+    std::string zt = ZtAttr->value();
+    AttributeDoublePtr minTAttr = mint();
+    double mint = minTAttr->value();
+    AttributeDoublePtr maxTAttr = maxt();
+    double maxt = maxTAttr->value();
+    AttributeIntegerPtr nbStepAttr = numstep();
+    int nbStep = nbStepAttr->value();
+
+    theDumper<< ", \""  << xt << "\",\"" << yt << "\",\""<< zt<< "\", " ;
+    theDumper << mint << ", " << maxt << ", "<< nbStep<< ")"<<std::endl;
   }
-
-  theDumper << closed() << ", " << reorder() << ")" << std::endl;
 }
 
 //==================================================================================================
@@ -162,6 +208,23 @@ InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& theP
                                                      theIsToReorder));
 }
 
+InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                  const std::string & theXTexpression,
+                                  const std::string & theYTexpression,
+                                  const std::string & theZTexpression,
+                                  const ModelHighAPI_Double& theMinT,
+                                  const ModelHighAPI_Double& theMaxT,
+                                  const ModelHighAPI_Integer& theNbStep)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Interpolation::ID());
+  return InterpolationPtr(new BuildAPI_Interpolation(aFeature,
+                                                     theXTexpression,
+                                                     theYTexpression,
+                                                     theZTexpression,
+                                                     theMinT,
+                                                     theMaxT,
+                                                     theNbStep));
+}
 //==================================================================================================
 void BuildAPI_Interpolation::execIfBaseNotEmpty()
 {
index e1ee1031d58dbc6aa949e9ee442884c7f131bb8e..732a57a90dbabae70b95444a633e2d77054b0ee2 100644 (file)
@@ -27,6 +27,9 @@
 #include <ModelHighAPI_Interface.h>
 #include <ModelHighAPI_Macro.h>
 #include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Integer.h>
+
 
 class ModelHighAPI_Selection;
 
@@ -54,11 +57,21 @@ public:
                                     const std::list<ModelHighAPI_Selection>& theBaseObjects,
                                     const bool theIsClosed, const bool theIsToReorder);
 
+  /// Constructor with expression analytical of X,Y andZ
+  BUILDAPI_EXPORT
+    explicit BuildAPI_Interpolation(const FeaturePtr& theFeature,
+                                    const std::string & theXTexpression,
+                                    const std::string & theYTexpression,
+                                    const std::string & theZTexpression,
+                                    const ModelHighAPI_Double& theMinT,
+                                    const ModelHighAPI_Double& theMaxT,
+                                    const ModelHighAPI_Integer& theNbStep);
+
   /// Destructor.
   BUILDAPI_EXPORT
   virtual ~BuildAPI_Interpolation();
 
-  INTERFACE_6(BuildPlugin_Interpolation::ID(),
+  INTERFACE_13(BuildPlugin_Interpolation::ID(),
               baseObjects, BuildPlugin_Interpolation::BASE_OBJECTS_ID(),
               ModelAPI_AttributeSelectionList, /** Base objects */,
               closed, BuildPlugin_Interpolation::CLOSED_ID(),
@@ -70,7 +83,21 @@ public:
               startTangent, BuildPlugin_Interpolation::TANGENT_START_ID(),
               ModelAPI_AttributeSelection, /** Start point tangent */,
               endTangent, BuildPlugin_Interpolation::TANGENT_END_ID(),
-              ModelAPI_AttributeSelection, /** End point tangent */)
+              ModelAPI_AttributeSelection, /** End point tangent */,
+              xt, BuildPlugin_Interpolation::XT_ID(),
+              ModelAPI_AttributeString, /** xt expression*/,
+              yt, BuildPlugin_Interpolation::YT_ID(),
+              ModelAPI_AttributeString, /** yt expression*/,
+              zt, BuildPlugin_Interpolation::ZT_ID(),
+              ModelAPI_AttributeString, /** zt expression*/,
+              mint, BuildPlugin_Interpolation::MINT_ID(),
+              ModelAPI_AttributeDouble, /** zt expression*/,
+              maxt, BuildPlugin_Interpolation::MAXT_ID(),
+              ModelAPI_AttributeDouble, /** zt expression*/,
+              numstep, BuildPlugin_Interpolation::NUMSTEP_ID(),
+              ModelAPI_AttributeInteger, /** zt expression*/,
+              creationmethod, BuildPlugin_Interpolation::CREATION_METHODE_ID(),
+              ModelAPI_AttributeString, /** zt expression*/)
 
   /// Modify base attribute of the feature.
   BUILDAPI_EXPORT
@@ -118,4 +145,15 @@ InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& theP
                                   const bool theIsClosed = false,
                                   const bool theIsToReorder = false);
 
+/// \ingroup CPPHighAPI
+/// \brief Create Interpolation feature using tangents.
+BUILDAPI_EXPORT
+InterpolationPtr addInterpolation(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                  const std::string & theXTexpression,
+                                  const std::string & theYTexpression,
+                                  const std::string & theZTexpression,
+                                  const ModelHighAPI_Double& theMinT,
+                                  const ModelHighAPI_Double& theMaxT,
+                                  const ModelHighAPI_Integer& theNbStep);
+
 #endif // BuildAPI_Interpolation_H_
index 73b4292a05701d5363a29e920cbc843b40b0ab74..33599562200b0e9216437e135f84454124cb9ca2 100644 (file)
@@ -132,29 +132,45 @@ void BuildPlugin_EvalListener::processEvent(
     AttributeTablesPtr anValueAttr = aParam->tables(BuildPlugin_Interpolation::VALUE_ID());
     std::string anError;
     std::list<std::shared_ptr<ModelAPI_ResultParameter> > aParamsList;
-        
-    AttributeStringPtr anExprAttr; 
+
+    AttributeStringPtr anExprAttr;
     ModelAPI_AttributeTables::Value aVal;
     for(int step =0; step < anValueAttr->rows(); step++ ){
         anExprAttr = aParam->string(BuildPlugin_Interpolation::XT_ID());
         std::wstring anExp = anExprAttr->isUValue() ?
         Locale::Convert::toWString(anExprAttr->valueU()) :
         Locale::Convert::toWString(anExprAttr->value());
-        aVal.myDouble = evaluate(anVar,anValueAttr->value(step,0).myDouble,aParam, anExp, anError, aParamsList, true);
-        anValueAttr->setValue(aVal,step,1);     
-        
+        aVal.myDouble = evaluate(anVar,anValueAttr->value(step,0).myDouble,
+                                 aParam,
+                                 anExp,
+                                 anError,aParamsList,
+                                 true);
+        anValueAttr->setValue(aVal,step,1);
+
         anExprAttr = aParam->string(BuildPlugin_Interpolation::YT_ID());
         anExp = anExprAttr->isUValue() ?
         Locale::Convert::toWString(anExprAttr->valueU()) :
         Locale::Convert::toWString(anExprAttr->value());
-        aVal.myDouble = evaluate(anVar,anValueAttr->value(step,0).myDouble,aParam, anExp, anError, aParamsList, true);
+        aVal.myDouble = evaluate(anVar,
+                                anValueAttr->value(step,0).myDouble,
+                                aParam,
+                                anExp,
+                                anError,
+                                aParamsList,
+                                true);
         anValueAttr->setValue(aVal,step,2);
 
         anExprAttr = aParam->string(BuildPlugin_Interpolation::ZT_ID());
         anExp = anExprAttr->isUValue() ?
         Locale::Convert::toWString(anExprAttr->valueU()) :
         Locale::Convert::toWString(anExprAttr->value());
-        aVal.myDouble = evaluate(anVar,anValueAttr->value(step,0).myDouble,aParam, anExp, anError, aParamsList, true);
+        aVal.myDouble = evaluate(anVar,
+                                  anValueAttr->value(step,0).myDouble,
+                                  aParam,
+                                  anExp,
+                                  anError,
+                                  aParamsList,
+                                  true);
         anValueAttr->setValue(aVal,step,3);
     }
 
@@ -167,10 +183,10 @@ void BuildPlugin_EvalListener::processEvent(
 }
 
 double BuildPlugin_EvalListener::evaluate(
-  std::wstring& theVariable, 
+  std::wstring& theVariable,
   double theValueVariable,
   FeaturePtr theParameter,
-  const std::wstring& theExpression, 
+  const std::wstring& theExpression,
   std::string& theError,
   std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
   const bool theIsParameter)
index 3698e6f51db93ab277bc27c9e6e7a6bb1efb8a60..ab558a356b81dab86dd96280fc6a959c4df7b3ff 100644 (file)
@@ -27,7 +27,6 @@ class ModelAPI_Attribute;
 class ModelAPI_Document;
 class ModelAPI_Feature;
 class ModelAPI_ResultParameter;
-// JL_CGLB n'existe pas class InitializationPlugin_Parameter;
 class BuildPlugin_PyInterp;
 
 /**
@@ -50,7 +49,7 @@ class BuildPlugin_EvalListener : public Events_Listener
 
  protected:
   /// Evaluates theExpression and returns its value.
-  double evaluate(std::wstring& theVariable, 
+  double evaluate(std::wstring& theVariable,
                   double theValueVariable,std::shared_ptr<ModelAPI_Feature> theParameter,
                   const std::wstring& theExpression, std::string& theError,
                   std::list<std::shared_ptr<ModelAPI_ResultParameter> >& theParamsList,
index ab0dec57ae7cc59b66728765eab0d76dfca94106..7aa82f279fa9e9508b3e27b91a5e452563e5ff75 100644 (file)
@@ -59,7 +59,7 @@
 //=================================================================================================
 BuildPlugin_Interpolation::BuildPlugin_Interpolation()
 {
-   
+
 }
 
 //=================================================================================================
@@ -89,58 +89,63 @@ void BuildPlugin_Interpolation::initAttributes()
   data()->addAttribute(MINT_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(MAXT_ID(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(NUMSTEP_ID(), ModelAPI_AttributeInteger::typeId());
-  
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHODE_ANALYTICAL_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATION_METHODE_BY_SELECTION_ID());
+
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+                                                 CREATION_METHODE_ANALYTICAL_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
+                                                 CREATION_METHODE_BY_SELECTION_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXPRESSION_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VARIABLE_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VALUE_ID());
-
   data()->addAttribute(ARGUMENTS_ID(), ModelAPI_AttributeRefList::typeId());
   data()->reflist(ARGUMENTS_ID())->setIsArgument(false);
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), ARGUMENTS_ID());
 
+  string(XT_ID())->setValue("t");
+  string(YT_ID())->setValue("t");
+  string(ZT_ID())->setValue("t");
+  real(MINT_ID())->setValue(0);
+  real(MAXT_ID())->setValue(100);
+  integer(NUMSTEP_ID())->setValue(10);
+  updateCoods();
 }
 
 void BuildPlugin_Interpolation::attributeChanged(const std::string& theID)
-{ 
-  if( (theID == XT_ID() 
-    || theID == YT_ID() 
-    || theID == ZT_ID() 
+{
+  if( (theID == XT_ID()
+    || theID == YT_ID()
+    || theID == ZT_ID()
     || theID == MINT_ID()
     || theID == MAXT_ID()
     || theID == NUMSTEP_ID())
     && string(XT_ID())->value() !=""
     && string(YT_ID())->value() !=""
     && string(ZT_ID())->value() !=""
+    && string(CREATION_METHODE_ID())->value() == CREATION_METHODE_ANALYTICAL_ID()
     ){
     updateCoods();
   }
-    
 }
 
 void BuildPlugin_Interpolation::updateCoods()
-{ 
+{
     std::wstring exp;
-    double aMint = real(MINT_ID())->value(); 
+    double aMint = real(MINT_ID())->value();
     double aMaxt = real(MAXT_ID())->value();
-    int aNbrStep = integer(NUMSTEP_ID())->value(); 
-    double scale = (aMaxt - aMint )/aNbrStep; 
+    int aNbrStep = integer(NUMSTEP_ID())->value();
+    double scale = (aMaxt - aMint )/aNbrStep;
     string(VARIABLE_ID())->setValue("t");
 
     tables(VALUE_ID())->setSize(aNbrStep,4);
     for( int step = 0; step < aNbrStep; step++ ){
       ModelAPI_AttributeTables::Value aVal;
       aVal.myDouble = step * scale + aMint;
-      tables(VALUE_ID())->setValue(aVal,step,0);   
+      tables(VALUE_ID())->setValue(aVal,step,0);
     }
 
     outErrorMessage="";
-    
+
     evaluate(outErrorMessage);
-    if (!outErrorMessage.empty()){
-     std::cout << L"outErrorMessage= " << outErrorMessage << std::endl;
-    }
 }
 
 //=================================================================================================
@@ -233,61 +238,54 @@ void BuildPlugin_Interpolation::execute()
   {
     if(   string( XT_ID())->value() == ""
         ||string( YT_ID())->value() == ""
-        ||string( ZT_ID())->value() == "")
-      return; 
-    
+        ||string( ZT_ID())->value() == ""
+        ||tables(VALUE_ID())->rows()== 0  )
+      return;
+
     if (!outErrorMessage.empty()){
       setError("Error: Python interpreter " + outErrorMessage);
       return;
     }
-    AttributeTablesPtr table = tables( VALUE_ID() ); 
+    AttributeTablesPtr table = tables( VALUE_ID() );
     std::list<std::vector<double> > aCoodPoints;
     for( int step = 0; step < table->rows() ; step++ ){
-      std::vector<double> coodPoint; 
+      std::vector<double> coodPoint;
       ModelAPI_AttributeTables::Value value;
       //x
-      value = table->value(step, 1); 
-      coodPoint.push_back( value.myDouble ); 
+      value = table->value(step, 1);
+      coodPoint.push_back( value.myDouble );
       //y
-      value = table->value(step, 2); 
-      coodPoint.push_back( value.myDouble ); 
+      value = table->value(step, 2);
+      coodPoint.push_back( value.myDouble );
       //
-      value = table->value(step, 3); 
-      coodPoint.push_back( value.myDouble ); 
+      value = table->value(step, 3);
+      coodPoint.push_back( value.myDouble );
 
       aCoodPoints.push_back(coodPoint);
     }
-    
+
     std::list<GeomPointPtr> aPoints;
     std::list<GeomVertexPtr> aVertices;
     std::list<std::vector<double> >::const_iterator aItCoodPoints = aCoodPoints.begin();
+
     for( ; aItCoodPoints != aCoodPoints.end(); ++aItCoodPoints ){
-      std::cout << "cood = " << "(" << (*aItCoodPoints)[0] << ", "<< 
-                                       (*aItCoodPoints)[1] << ", "<< 
-                                       (*aItCoodPoints)[2] << " ) "<<  std::endl;
-      GeomVertexPtr vertex = 
+
+      GeomVertexPtr vertex =
           GeomAlgoAPI_PointBuilder::vertex( (*aItCoodPoints)[0],
                                             (*aItCoodPoints)[1],
                                             (*aItCoodPoints)[2]);
-      aPoints.push_back (vertex->point()); 
+      aPoints.push_back (vertex->point());
       aVertices.push_back (vertex);
-    } 
-    /* 
-    GeomDirPtr aDirStart(new GeomAPI_Dir( aCoodPoints.front()[0],
-                                        aCoodPoints.front()[1], 
-                                        aCoodPoints.front()[2]));
-    GeomDirPtr aDirEnd(new GeomAPI_Dir( aCoodPoints.back()[0],
-                                        aCoodPoints.back()[1], 
-                                        aCoodPoints.back()[2]));*/
+    }
+
     // Create curve from points
     GeomEdgePtr anEdge =
-      GeomAlgoAPI_CurveBuilder::edge(aPoints, false, true,GeomDirPtr(),GeomDirPtr()); //aDirStart, aDirEnd);
+      GeomAlgoAPI_CurveBuilder::edge(aPoints, false, true,GeomDirPtr(),GeomDirPtr());
     if (!anEdge.get()) {
       setError("Error: Result curve is empty.");
       return;
     }
+
     ResultBodyPtr aResultBody = document()->createBody(data());
     // Load the result
     aResultBody->store(anEdge);
@@ -297,9 +295,9 @@ void BuildPlugin_Interpolation::execute()
       aResultBody->generated(anExp.current(), aVertexName);
       aVertexIndex++;
     }
-   
+
     setResult(aResultBody);
-        
+
   }
 
 }
@@ -312,7 +310,6 @@ void  BuildPlugin_Interpolation::evaluate(std::string& theError)
 
   if (aProcessMessage->isProcessed()) {
     theError = aProcessMessage->error();
-    std::cout << "theError= " << theError << std::endl;
   } else { // error: python interpreter is not active
     theError = "Python interpreter is not available";
   }
index 64181cb3b391f0a17d0fd796b12a3ff0885d02e9..4859364cfc4b0a6a9136f976494c39cb43087708 100644 (file)
@@ -148,7 +148,7 @@ public:
     static const std::string MY_VALUE_ID("value");
     return MY_VALUE_ID;
   }
-  
+
   /// attribute of parameter expression
   inline static const std::string& EXPRESSION_ID()
   {
@@ -192,7 +192,7 @@ public:
 
   /// Creates a new part document if needed.
   BUILDPLUGIN_EXPORT virtual void execute();
-  
+
   BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
   protected:
index 45893e4c5656daeb7ffee8426269ee654837ddad..fad3b014503eb25bdfeb97f92e0990a0990ff6b2 100644 (file)
@@ -64,7 +64,7 @@ BuildPlugin_Plugin::BuildPlugin_Plugin()
                               new BuildPlugin_ValidatorBaseForVertex());
   aFactory->registerValidator("BuildPlugin_ValidatorExpressionInterpolation",
                               new BuildPlugin_ValidatorExpressionInterpolation());
-  
+
   // Register this plugin.
   ModelAPI_Session::get()->registerPlugin(this);
 
index 2fae36742489457c9b6ceb41c36b7604dd851da3..a06488579f7f556a70715a02fa490cb5e6af02ca 100644 (file)
@@ -172,6 +172,16 @@ model.testHaveNamingSubshapes(Interpolation_9, model, Part_3_doc)
 model.end()
 
 # =============================================================================
-# Test 12. Check Python dump
+# Test 12. Create curve using an analytical expression
+# =============================================================================
+Part_5 = model.addPart(partSet)
+Part_5_doc = Part_5.document()
+
+Interpolation_11 = model.addInterpolation(Part_5_doc, "sin(t)","cos(t)","t", 0, 100, 10)
+
+model.checkResult(Interpolation_11, model, 1, [0], [0], [0], [1], [2])
+
+# =============================================================================
+# Test 13. Check Python dump
 # =============================================================================
 assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/BuildPlugin/icons/feature_interpolation_analytical.png b/src/BuildPlugin/icons/feature_interpolation_analytical.png
new file mode 100644 (file)
index 0000000..e5c5374
Binary files /dev/null and b/src/BuildPlugin/icons/feature_interpolation_analytical.png differ
index cd35b15223d6bfa08c10e8971c006cd9a68438f2..7294fc5d5e1372382929b3e0a3959faf6402fb3a 100644 (file)
           </shape_selector>
         </optionalbox>
       </optionalbox>
-      <!--JL_CGLB validator id="GeomValidators_MinObjectsSelected" parameters="base_objects,2"/-->
+      <validator id="GeomValidators_MinObjectsSelected" parameters="base_objects,2"/>
     </box>
     <box id="analytical"
          title="Curve analytical"
          tooltip="???"
          icon="icons/Build/feature_interpolation_analytical.png">
-      <stringvalue id="xt" label="X(t) equation" >
+      <groupbox title="Curves parameters">
+        <stringvalue id="xt" label="X(t) equation" >
+            <validator id="BuildPlugin_ValidatorExpressionInterpolation"/>
+          </stringvalue>
+        <stringvalue id="yt" label="Y(t) equation" >
           <validator id="BuildPlugin_ValidatorExpressionInterpolation"/>
         </stringvalue>
-      <stringvalue id="yt" label="Y(t) equation" >
-        <validator id="BuildPlugin_ValidatorExpressionInterpolation"/>
-      </stringvalue>
-      <stringvalue id="zt" label="Z(t) equation" >
-        <validator id="BuildPlugin_ValidatorExpressionInterpolation"/>
-      </stringvalue>
-      <doublevalue id="mint"
-                   label="Min t"
-                   min="0"
-                   default="0">
-        <!--validator id="GeomValidators_Positive"/-->
-      </doublevalue>
-       <doublevalue id="maxt"
-                   label="Max t"
-                   min="0"
-                   default="100">
-        <!--validator id="GeomValidators_Positive"/-->
-      </doublevalue>
-       <integervalue id="numstep"
-                   label="Number of steps"
-                   tooltip="Fillet radius."
-                   min="0"
-                   default="10">
-        <validator id="GeomValidators_Positive"/>
-      </integervalue>
+        <stringvalue id="zt" label="Z(t) equation" >
+          <validator id="BuildPlugin_ValidatorExpressionInterpolation"/>
+        </stringvalue>
+        <doublevalue id="mint"
+                    label="Min t"
+                    min="0"
+                    default="0">
+          <!--validator id="GeomValidators_Positive"/-->
+        </doublevalue>
+        <doublevalue id="maxt"
+                    label="Max t"
+                    min="0"
+                    default="100">
+          <!--validator id="GeomValidators_Positive"/-->
+        </doublevalue>
+        <integervalue id="numstep"
+                    label="Number of steps"
+                    tooltip="Fillet radius."
+                    min="0"
+                    default="10">
+          <validator id="GeomValidators_Positive"/>
+        </integervalue>
+      </groupbox>
     </box>
   </toolbox>
 </source>
index 593f26974d95bba938fc2ac346ee91b8554f6576..267e6db6ba0b49e4870b9146bb1719371cbe7cf4 100644 (file)
@@ -34,7 +34,6 @@ void Events_Listener::groupWhileFlush(const std::shared_ptr<Events_Message>& the
     std::shared_ptr<Events_MessageGroup> aStored =
       std::dynamic_pointer_cast<Events_MessageGroup>(aMyGroup->second);
     aStored->Join(aGroup);
-    //std::cout<<"Add to group "<<theMessage->eventID().eventText()<<std::endl;
     return;
   }
 }
index 40890c4cae469d14ae558be10ac9f5607f7aae22..c2ff50c8d6f8c6ab106ab9e6e28c0209b8de79ce 100644 (file)
@@ -78,6 +78,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/Events
   ${PROJECT_SOURCE_DIR}/src/GeomAPI
   ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+  ${PROJECT_SOURCE_DIR}/src/BuildPlugin
 )
 
 INSTALL(TARGETS GeomValidators DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
index 174d1b71c962936cfc075a8f80534e0fba314720..606a788718318cc8656441b0c9c4408cb34cd59b 100644 (file)
 #include <GeomValidators_MinObjectsSelected.h>
 
 #include <Events_InfoMessage.h>
+#include <BuildPlugin_Interpolation.h>
 
 #include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeSelectionList.h>
 
 //=================================================================================================
@@ -36,6 +38,15 @@ bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptr<ModelAPI_F
     return false;
 // LCOV_EXCL_STOP
   }
+  //"Interpolation"
+  if( theFeature->name().substr(0, 6) == L"Interp" )
+  {
+    AttributeStringPtr anAttr =theFeature->string(
+                                        BuildPlugin_Interpolation::CREATION_METHODE_ID());
+    if ( anAttr->isInitialized() )
+      if( anAttr->value() == BuildPlugin_Interpolation::CREATION_METHODE_ANALYTICAL_ID())
+        return true; 
+  } 
 
   std::string aSelectionListId = theArguments.front();
   AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(aSelectionListId);