Salome HOME
Debug
authorouv <ouv@opencascade.com>
Thu, 17 Dec 2009 09:32:28 +0000 (09:32 +0000)
committerouv <ouv@opencascade.com>
Thu, 17 Dec 2009 09:32:28 +0000 (09:32 +0000)
src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_Hypothesis_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_NoteBook.cxx
src/SMESH_I/SMESH_NoteBook.hxx
src/SMESH_SWIG/smeshDC.py
src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx

index 080f15a19075c2852fec4fec123185c6f50ddf3d..e966c781aafeca730549c6477ab2189bc64bade5 100644 (file)
@@ -1379,6 +1379,10 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
     hyp = new _pyLayerDistributionHypo( theCreationCmd );
     hyp->SetConvMethodAndType( "LayerDistribution", "RadialPrism_3D");
   }
+  else if ( hypType == "LayerDistribution2D" ) {
+    hyp = new _pyLayerDistributionHypo( theCreationCmd );
+    hyp->SetConvMethodAndType( "LayerDistribution2D", "RadialQuadrangle_1D2D");
+  }
 
   if ( algo->IsValid() ) {
     return algo;
index cd45593fb523fb7e74006048a41a7bdaf8037796..6ff3ad77a43bba4488749ecde511ee5a5797acc4 100644 (file)
@@ -234,7 +234,7 @@ void SMESH_Hypothesis_i::UpdateStringAttribute()
   // previous implementation can be found in revision 1.12.14.8
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
 
-  SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( myBaseImpl->GetStudyId() );
+  SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Hypothesis::_narrow( _this() ) );
   if( CORBA::is_nil( aSObject ) )
index f0f7c923bf1bcb50ab0768486b490a4d36f24d6d..82d251fb234160b8962bb768f2ab5f22fc974dab 100644 (file)
@@ -2556,7 +2556,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
     else
       aPythonDump <<"error";
 
-    aPythonDump << " = " << this << ".ExtrusionAlongPathObjX( "
+    aPythonDump << " = " << this << ".ExtrusionAlongPathX( "
                 << Object      << ", "
                 << Path        << ", "
                 << NodeStart   << ", "
index e67f5f86c1ce9f0d43ac6eec4e1533ab11149011..01d394dcf022ba5559fbcc496cc96161b657a661 100644 (file)
@@ -3470,7 +3470,7 @@ void SMESH_Mesh_i::UpdateStringAttribute( const SALOME::StringArray& theParamete
   // previous implementation can be found in revision 1.23.2.7.2.2.2.6
   SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
 
-  SALOMEDS::Study_ptr aStudy = aSMESHGen->GetStudy( GetStudyId() );
+  SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
   SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
   SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject( aStudy, SMESH::SMESH_Mesh::_narrow( _this() ) );
   if( CORBA::is_nil( aSObject ) )
index f5f8a12a3be1f478f1310203f32c9d9aaea7e919..d064e6d7a6498a9fd4126bbac0238d0eb812220f 100644 (file)
@@ -124,8 +124,8 @@ TCollection_AsciiString ObjectStates::GetObjectType() const{
  * \brief Constructor
  */
 //================================================================================
-LayerDistributionStates::LayerDistributionStates():
-  ObjectStates("LayerDistribution")
+LayerDistributionStates::LayerDistributionStates(TCollection_AsciiString theType):
+  ObjectStates(theType)
 {
 }
 //================================================================================
@@ -302,7 +302,8 @@ void SMESH_NoteBook::ReplaceVariables()
       }
       
       // Case for LayerDistribution hypothesis (not finished yet)
-      else if(aStates->GetObjectType() == "LayerDistribution") {
+      else if(aStates->GetObjectType() == "LayerDistribution" ||
+              aStates->GetObjectType() == "LayerDistribution2D") {
         if(aMethod == "SetLayerDistribution"){
           LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
           aLDStates->AddDistribution(aCmd->GetArg(1));
@@ -732,8 +733,9 @@ void SMESH_NoteBook::InitObjectMap()
       if(MYDEBUG)
         cout<<"The object Type : "<<anObjType<<endl;
       ObjectStates *aState = NULL;
-      if(anObjType == "LayerDistribution") {
-        aState = new LayerDistributionStates();
+      if(anObjType == "LayerDistribution" ||
+         anObjType == "LayerDistribution2D") {
+        aState = new LayerDistributionStates(anObjType);
       }
       else
         aState = new  ObjectStates(anObjType);
@@ -839,11 +841,11 @@ void SMESH_NoteBook::ProcessLayerDistribution()
         if(aType == "LocalLength") {
           if(aMethod == "SetLength") {
             SetVariable(_commands[i], aLDS[j],0,1);
-            aLDS[j]->IncrementState();
+            //aLDS[j]->IncrementState();
           }
           else if(aMethod == "SetPrecision") {
             SetVariable(_commands[i], aLDS[j],1,1);
-            aLDS[j]->IncrementState();
+            //aLDS[j]->IncrementState();
           }
         }
 
@@ -851,19 +853,19 @@ void SMESH_NoteBook::ProcessLayerDistribution()
         else if(aType == "NumberOfSegments"){
           if(aMethod == "SetNumberOfSegments") {
             SetVariable(_commands[i], aLDS[j],0,1);
-            if(aLDS[j]->GetCurrectState().size()==1)
-              aLDS[j]->IncrementState();
+            //if(aLDS[j]->GetCurrectState().size()==1)
+            //  aLDS[j]->IncrementState();
           }
           else if (aMethod == "SetScaleFactor") {
             SetVariable(_commands[i], aLDS[j],1,1);
-            aLDS[j]->IncrementState();
+            //aLDS[j]->IncrementState();
           }
         }
         
         else if( aType == "Deflection1D" ){
           if(aMethod == "SetDeflection"){
             SetVariable(_commands[i], aLDS[j],0,1);
-            aLDS[j]->IncrementState();
+            //aLDS[j]->IncrementState();
           }
         }
         // Case for Arithmetic1D and StartEndLength hypothesis
@@ -871,8 +873,18 @@ void SMESH_NoteBook::ProcessLayerDistribution()
           if(aMethod == "SetLength") {
             int anArgNb = (_commands[i]->GetArg(2) == "1") ? 0 : 1;
             SetVariable(_commands[i], aLDS[j],anArgNb,1);
-            aLDS[j]->IncrementState();
+            //aLDS[j]->IncrementState();
           }
+          /* ouv: temporarily disabled (see limitation on LayerDistribution in SMESH help)
+          else if(aMethod == "SetStartLength"){
+            SetVariable(_commands[i], aLDS[j],0,1);
+            //aLDS[j]->IncrementState();
+          }
+          else if(aMethod == "SetEndLength"){
+            SetVariable(_commands[i], aLDS[j],1,1);
+            //aLDS[j]->IncrementState();
+          }
+          */
         }
       }
     }
index dfeb3b50a23123e704fce386104e7b1b8b6bf0c0..030cc21b1038791482d72086589073f69df61747 100644 (file)
@@ -62,7 +62,7 @@ class LayerDistributionStates : public ObjectStates
 {
 public:
   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
-  LayerDistributionStates();
+  LayerDistributionStates(TCollection_AsciiString theType);
   virtual ~LayerDistributionStates();
 
   void AddDistribution(const TCollection_AsciiString& theDistribution);
index 7352db05024f4ccf344b52203d2c5f215a88208b..2b856952b73fecc647b40171bbcb1c2046fd5904 100644 (file)
@@ -2917,6 +2917,8 @@ class Mesh:
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
             RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
             pass
+        if ( isinstance( Path, Mesh )):
+            Path = Path.GetMesh()
         Parameters = AnglesParameters + RefPointParameters
         geompyDC.SetParameters(self.mesh, Parameters)
 
@@ -2929,6 +2931,7 @@ class Mesh:
                                                    HasRefPoint, RefPoint, MakeGroups, ElemType)
         else:
             if isinstance(Base,Mesh):
+                Base = Base.GetMesh()
                 return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart,
                                                           HasAngles, Angles, LinearVariation,
                                                           HasRefPoint, RefPoint, MakeGroups, ElemType)
@@ -5172,13 +5175,24 @@ omniORB.registerObjref(StdMeshers._objref_StdMeshers_LocalLength._NP_RepositoryI
 class LayerDistribution(StdMeshers._objref_StdMeshers_LayerDistribution):
     
     def SetLayerDistribution(self, hypo):
-        #StdMeshers._objref_StdMeshers_LayerDistribution.SetParameters(self,hypo.GetParameters())
-        #hypo.ClearParameters();
+        geompyDC.SetParameters(self, hypo.GetParameters())
+        geompyDC.SetParameters(hypo, [])
         StdMeshers._objref_StdMeshers_LayerDistribution.SetLayerDistribution(self,hypo)
 
 #Registering the new proxy for LayerDistribution
 omniORB.registerObjref(StdMeshers._objref_StdMeshers_LayerDistribution._NP_RepositoryId, LayerDistribution)
 
+#Wrapper class for StdMeshers_LayerDistribution2D hypothesis
+class LayerDistribution2D(StdMeshers._objref_StdMeshers_LayerDistribution2D):
+    
+    def SetLayerDistribution(self, hypo):
+        geompyDC.SetParameters(self, hypo.GetParameters())
+        geompyDC.SetParameters(hypo, [])
+        StdMeshers._objref_StdMeshers_LayerDistribution2D.SetLayerDistribution(self,hypo)
+
+#Registering the new proxy for LayerDistribution
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_LayerDistribution2D._NP_RepositoryId, LayerDistribution2D)
+
 #Wrapper class for StdMeshers_SegmentLengthAroundVertex hypothesis
 class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex):
     
index 3c0075c600a7e73b7507938b96354663b940cc80..a50b91e73a2df7bae5ef28e1e810d716cd9da348 100644 (file)
@@ -545,10 +545,13 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
         widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
       
       h->SetLayerDistribution( w->GetHypothesis() );
-      /* ouv: temporarily disabled
-      h->SetParameters(w->GetHypothesis()->GetParameters());
-      w->GetHypothesis()->ClearParameters();
-      */
+
+      SALOME::StringArray* aParameters = w->GetHypothesis()->GetParameters();
+      QStringList aList;
+      for( int i = 0; i < aParameters->length(); i++ ) 
+        aList.append( QString( aParameters->operator[](i) ) );
+      getNotebook()->setParameters( h, aList );
+      getNotebook()->setParameters( w->GetHypothesis(), QStringList() );
     }
     else if( hypType()=="NumberOfLayers2D" )
     {
@@ -566,10 +569,13 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
         widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
       
       h->SetLayerDistribution( w->GetHypothesis() );
-      /* ouv: temporarily disabled
-      h->SetParameters(w->GetHypothesis()->GetParameters());
-      w->GetHypothesis()->ClearParameters();
-      */
+
+      SALOME::StringArray* aParameters = w->GetHypothesis()->GetParameters();
+      QStringList aList;
+      for( int i = 0; i < aParameters->length(); i++ ) 
+        aList.append( QString( aParameters->operator[](i) ) );
+      getNotebook()->setParameters( h, aList );
+      getNotebook()->setParameters( w->GetHypothesis(), QStringList() );
     }
     else if( hypType()=="ProjectionSource1D" )
     {
@@ -885,10 +891,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     for(int i = 0;i<aParameters->length();i++) 
       aLastVarsList.append(QString(aParameters->operator[](i)));
 
-    /* ouv: temporarily disabled
     if(!aLastVarsList.isEmpty())
-      h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
-    */
+      getNotebook()->setParameters( h->GetLayerDistribution(), aLastVarsList );
     
     customWidgets()->append
       ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
@@ -913,10 +917,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
     for(int i = 0;i<aParameters->length();i++) 
       aLastVarsList.append(QString(aParameters->operator[](i)));
 
-    /* ouv: temporarily disabled
     if(!aLastVarsList.isEmpty())
-      h->GetLayerDistribution()->SetLastParameters(aLastVarsList.join(":").toLatin1().constData());
-    */
+      getNotebook()->setParameters( h->GetLayerDistribution(), aLastVarsList );
     
     customWidgets()->append
       ( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));