#ifdef _DEBUG_
static int MYDEBUG = 0;
+static int VARIABLE_DEBUG = 1;
#else
static int MYDEBUG = 0;
+static int VARIABLE_DEBUG = 1;
#endif
+
+
+
//=============================================================================
/*!
* Get...Tag [ static ]
//=======================================================================
void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters)
{
+
+ if(VARIABLE_DEBUG)
+ cout<<"UpdateParameters : "<<theParameters<<endl;
SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
if(aStudy->_is_nil() || CORBA::is_nil(theObject))
return;
SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
- if(aSObj->_is_nil())
+ if(aSObj->_is_nil())
return;
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+
+ SALOMEDS::GenericAttribute_var aFindAttr;
+ bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString");
+ if(VARIABLE_DEBUG)
+ cout<<"Find Attribute "<<hasAttr<<endl;
+
SALOMEDS::GenericAttribute_var anAttr;
anAttr = aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString");
SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
TCollection_AsciiString aOldParameters(aStringAttr->Value());
TCollection_AsciiString anInputParams(ParseParameters(theParameters));
- if(!aOldParameters.Length())
+ if(!hasAttr)
aNewParams = anInputParams;
else
aNewParams = aOldParameters+"|"+anInputParams;
+
+ if(VARIABLE_DEBUG)
+ {
+ cout<<"Input Parameters : "<<anInputParams<<endl;
+ cout<<"Old Parameters : "<<aOldParameters<<endl;
+ cout<<"New Parameters : "<<aNewParams<<endl;
+ }
+
aStringAttr->SetValue( aNewParams.ToCString() );
}
//================================================================================
TState ObjectStates::GetCurrectState() const
{
- return _states[_dumpstate];
+ if(_states.size() > _dumpstate)
+ return _states[_dumpstate];
+ TState empty;
+ return empty;
}
if(it != _objectMap.end() && !aMethod.IsEmpty()) {
ObjectStates *aStates = (*it).second;
// Case for LocalLength hypothesis
- if(aStates->GetObjectType().IsEqual("LocalLength")) {
+ if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
if(aMethod.IsEqual("SetLength")) {
if(!aStates->GetCurrectState().at(0).IsEmpty() )
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
}
// Case for SegmentLengthAroundVertex hypothesis
- else if(aStates->GetObjectType().IsEqual("SegmentLengthAroundVertex")) {
+ else if(aStates->GetObjectType().IsEqual("SegmentLengthAroundVertex")
+ && aStates->GetCurrectState().size() >= 1) {
if(aMethod == "SetLength") {
if(!aStates->GetCurrectState().at(0).IsEmpty() )
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
aStates->IncrementState();
}
}
+
+ else if(aStates->GetObjectType().IsEqual("Arithmetic1D")) {
+ if(aMethod == "SetLength" &&
+ aStates->GetCurrectState().size() >= 2) {
+ if(aCmd->GetArg(2) == "1" && !aStates->GetCurrectState().at(0).IsEmpty())
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ else if(!aStates->GetCurrectState().at(1).IsEmpty())
+ aCmd->SetArg(1,aStates->GetCurrectState().at(1));
+ aStates->IncrementState();
+ }
+ }
// Case for LayerDistribution hypothesis (not finished yet)
else if(aStates->GetObjectType() == "LayerDistribution") {
if(aMethod == "SetLayerDistribution"){
#Wrapper class for StdMeshers_SegmentLengthAroundVertex hypothesis
class SegmentLengthAroundVertex(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex):
- parent = StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex
## Set length parameter value
# @param length numerical value or name of variable from notebook
def SetLength(self, length):
- length,parameters = ParseParameters(parent.GetLastParameters(self),1,1,length)
- parent.SetParameters(self,parameters)
- parent.SetLength(self,length)
+ length,parameters = ParseParameters(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.GetLastParameters(self),1,1,length)
+ StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.SetParameters(self,parameters)
+ StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex.SetLength(self,length)
+#Registering the new proxy for SegmentLengthAroundVertex
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex._NP_RepositoryId, SegmentLengthAroundVertex)
+
+
+#Wrapper class for StdMeshers_Arithmetic1D hypothesis
+class Arithmetic1D(StdMeshers._objref_StdMeshers_Arithmetic1D):
+
+ ## 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_Arithmetic1D.GetLastParameters(self),2,nb,length)
+ StdMeshers._objref_StdMeshers_Arithmetic1D.SetParameters(self,parameters)
+ StdMeshers._objref_StdMeshers_Arithmetic1D.SetLength(self,length,isStart)
+
#Registering the new proxy for LocalLength
-omniORB.registerObjref(StdMeshers._objref_StdMeshers_SegmentLengthAroundVertex._NP_RepositoryId, LocalLength)
+omniORB.registerObjref(StdMeshers._objref_StdMeshers_Arithmetic1D._NP_RepositoryId, Arithmetic1D)
StdMeshers::StdMeshers_Arithmetic1D::_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()=="MaxElementArea" )
{
StdMeshers::StdMeshers_Arithmetic1D_var h =
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
+ aVaribaleName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
+
+ item.isVariable = !aVaribaleName.isEmpty();
+
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
- item.myValue = h->GetLength( true );
+ if(item.isVariable)
+ item.myValue = aVaribaleName;
+ else
+ item.myValue = h->GetLength( true );
p.append( item );
+
+ aVaribaleName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
+
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
- item.myValue = h->GetLength( false );
+
+ if(item.isVariable)
+ item.myValue = aVaribaleName;
+ else
+ item.myValue = h->GetLength( false );
p.append( item );
}
else if( hypType()=="MaxElementArea" )