Salome HOME
SMESH note book
authorrnv <rnv@opencascade.com>
Fri, 28 Nov 2008 17:38:32 +0000 (17:38 +0000)
committerrnv <rnv@opencascade.com>
Fri, 28 Nov 2008 17:38:32 +0000 (17:38 +0000)
src/SMESH_I/SMESH_NoteBook.cxx
src/SMESH_SWIG/smeshDC.py
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx

index 57dd307c65c0590b98a6a36564d1f4e19b537af7..191a78142baaa3f01548f1f3c6785589d1601110 100644 (file)
@@ -268,8 +268,9 @@ void SMESH_NoteBook::ReplaceVariables()
           aStates->IncrementState();
         }
       }
-
-      else if(aStates->GetObjectType().IsEqual("Arithmetic1D")) {
+      // Case for Arithmetic1D or StartEndLength hypothesis
+      else if(aStates->GetObjectType().IsEqual("Arithmetic1D") || 
+              aStates->GetObjectType().IsEqual("StartEndLength")) {
         if(aMethod == "SetLength" &&
            aStates->GetCurrectState().size() >= 2) {
           if(aCmd->GetArg(2) == "1" && !aStates->GetCurrectState().at(0).IsEmpty())
@@ -279,6 +280,13 @@ void SMESH_NoteBook::ReplaceVariables()
           aStates->IncrementState();
         }
       }
+      else if(aStates->GetObjectType().IsEqual("Deflection1D")){
+        if(aMethod == "SetDeflection" && aStates->GetCurrectState().size() >= 1) {
+          if(!aStates->GetCurrectState().at(0).IsEmpty() )
+            aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+          aStates->IncrementState();
+        }
+      }
       // Case for LayerDistribution hypothesis (not finished yet)
       else if(aStates->GetObjectType() == "LayerDistribution") {
         if(aMethod == "SetLayerDistribution"){
index 0684cecc422ad664fe925ca0fb9137409c175cfb..bb6465aeee19f8d253f4102d522a7dad8840a36f 100644 (file)
@@ -4142,5 +4142,35 @@ class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
         StdMeshers._objref_StdMeshers_Arithmetic1D.SetParameters(self,parameters)
         StdMeshers._objref_StdMeshers_Arithmetic1D.SetLength(self,length,isStart)
         
-#Registering the new proxy for LocalLength
+#Registering the new proxy for Arithmetic1D
 omniORB.registerObjref(StdMeshers._objref_StdMeshers_Arithmetic1D._NP_RepositoryId, Arithmetic1D)
+
+#Wrapper class for StdMeshers_Deflection1D hypothesis
+class Deflection1D(StdMeshers._objref_StdMeshers_Deflection1D):
+    
+    ## Set deflection parameter value
+    #  @param deflection numerical value or name of variable from notebook    
+    def SetDeflection(self, deflection):
+        deflection,parameters = ParseParameters(StdMeshers._objref_StdMeshers_Deflection1D.GetLastParameters(self),1,1,deflection)
+        StdMeshers._objref_StdMeshers_Deflection1D.SetParameters(self,parameters)
+        StdMeshers._objref_StdMeshers_Deflection1D.SetDeflection(self,deflection)
+
+#Registering the new proxy for Deflection1D
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_StartEndLength._NP_RepositoryId, Deflection1D)
+
+#Wrapper class for StdMeshers_StartEndLength hypothesis
+class StartEndLength(StdMeshers._objref_StdMeshers_StartEndLength):
+    
+    ## Set length parameter value
+    #  @param length   numerical value or name of variable from notebook
+    #  @param isStart  true is length is Start Length, otherwise false
+    def SetLength(self, length, isStart):
+        nb = 2
+        if isStart:
+            nb = 1
+        length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_StartEndLength.GetLastParameters(self),2,nb,length)
+        StdMeshers._objref_StdMeshers_StartEndLength.SetParameters(self,parameters)
+        StdMeshers._objref_StdMeshers_StartEndLength.SetLength(self,length,isStart)
+        
+#Registering the new proxy for Arithmetic1D
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_StartEndLength._NP_RepositoryId, StartEndLength)
index b7bf0f6e58648acc7103177181501f0a3ab123e4..5fe2b8a552bae0473c9637f790fbdfd536b46f5d 100644 (file)
@@ -453,13 +453,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
        StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
 
       h->SetLength( params[0].myValue.toDouble(), true );
+      h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
       h->SetLength( params[1].myValue.toDouble(), false );
+      h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
     }
     else if( hypType()=="Deflection1D" )
     {
       StdMeshers::StdMeshers_Deflection1D_var h =
        StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
-
+      h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
       h->SetDeflection( params[0].myValue.toDouble() );
     }
     else if( hypType()=="AutomaticLength" )
@@ -652,19 +654,37 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
       StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
 
     item.myName = tr( "SMESH_START_LENGTH_PARAM" );
-    item.myValue = h->GetLength( true );
+
+    aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    item.isVariable = !aVaribaleName.isEmpty();
+    if(item.isVariable) 
+      item.myValue = aVaribaleName;
+    else
+      item.myValue = h->GetLength( true );
     p.append( item );
+
     item.myName = tr( "SMESH_END_LENGTH_PARAM" );
+    aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
+    item.isVariable = !aVaribaleName.isEmpty();
+    if(item.isVariable) 
+      item.myValue = aVaribaleName;
+    else
     item.myValue = h->GetLength( false );
+    
     p.append( item );
   }
   else if( hypType()=="Deflection1D" )
   {
     StdMeshers::StdMeshers_Deflection1D_var h =
       StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
-
+    
     item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
-    item.myValue = h->GetDeflection();
+    aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+    item.isVariable = !aVaribaleName.isEmpty();
+    if(item.isVariable) 
+      item.myValue = aVaribaleName;
+    else
+      item.myValue = h->GetDeflection();
     p.append( item );
   }
   else if( hypType()=="AutomaticLength" )