From: rnv Date: Fri, 28 Nov 2008 17:38:32 +0000 (+0000) Subject: SMESH note book X-Git-Tag: TG_DumpPython_Extension_3~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8eb6a5158a3fef2d63986b7ffcde29ba3182ac92;p=modules%2Fsmesh.git SMESH note book --- diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 57dd307c6..191a78142 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -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"){ diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 0684cecc4..bb6465aee 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -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) diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index b7bf0f6e5..5fe2b8a55 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -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" )