From f3f5a55bf7473cb1e012f1e54004b5561c05464c Mon Sep 17 00:00:00 2001 From: ouv Date: Thu, 17 Dec 2009 09:32:28 +0000 Subject: [PATCH] Debug --- src/SMESH_I/SMESH_2smeshpy.cxx | 4 +++ src/SMESH_I/SMESH_Hypothesis_i.cxx | 2 +- src/SMESH_I/SMESH_MeshEditor_i.cxx | 2 +- src/SMESH_I/SMESH_Mesh_i.cxx | 2 +- src/SMESH_I/SMESH_NoteBook.cxx | 36 ++++++++++++------- src/SMESH_I/SMESH_NoteBook.hxx | 2 +- src/SMESH_SWIG/smeshDC.py | 18 ++++++++-- .../StdMeshersGUI_StdHypothesisCreator.cxx | 30 ++++++++-------- 8 files changed, 64 insertions(+), 32 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 080f15a19..e966c781a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -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; diff --git a/src/SMESH_I/SMESH_Hypothesis_i.cxx b/src/SMESH_I/SMESH_Hypothesis_i.cxx index cd45593fb..6ff3ad77a 100644 --- a/src/SMESH_I/SMESH_Hypothesis_i.cxx +++ b/src/SMESH_I/SMESH_Hypothesis_i.cxx @@ -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 ) ) diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index f0f7c923b..82d251fb2 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -2556,7 +2556,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object, else aPythonDump <<"error"; - aPythonDump << " = " << this << ".ExtrusionAlongPathObjX( " + aPythonDump << " = " << this << ".ExtrusionAlongPathX( " << Object << ", " << Path << ", " << NodeStart << ", " diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index e67f5f86c..01d394dcf 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -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 ) ) diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index f5f8a12a3..d064e6d7a 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -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 : "<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(); + } + */ } } } diff --git a/src/SMESH_I/SMESH_NoteBook.hxx b/src/SMESH_I/SMESH_NoteBook.hxx index dfeb3b50a..030cc21b1 100644 --- a/src/SMESH_I/SMESH_NoteBook.hxx +++ b/src/SMESH_I/SMESH_NoteBook.hxx @@ -62,7 +62,7 @@ class LayerDistributionStates : public ObjectStates { public: typedef std::map TDistributionMap; - LayerDistributionStates(); + LayerDistributionStates(TCollection_AsciiString theType); virtual ~LayerDistributionStates(); void AddDistribution(const TCollection_AsciiString& theDistribution); diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 7352db050..2b856952b 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -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): diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index 3c0075c60..a50b91e73 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -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;ilength();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;ilength();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()));