+
+ // Case for LayerDistribution hypothesis (not finished yet)
+ else if(aStates->GetObjectType() == "LayerDistribution") {
+ if(aMethod == "SetLayerDistribution"){
+ LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
+ aLDStates->AddDistribution(aCmd->GetArg(1));
+ }
+ }
+
+ // Case for MaxElementArea hypothesis
+ else if(aStates->GetObjectType().IsEqual("MaxElementArea")){
+ if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 1) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
+ }
+
+ // Case for MaxElementVolume hypothesis
+ else if(aStates->GetObjectType().IsEqual("MaxElementVolume")){
+ if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 1) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
+ }
+ // Case for NETGEN_Parameters_2D hypothesis
+ else if(aStates->GetObjectType().IsEqual("NETGEN_Parameters_2D")){
+ if(aMethod == "SetMaxSize" && aStates->GetCurrectState().size() >= 1) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
+ else if(aMethod == "SetGrowthRate" && aStates->GetCurrectState().size() >= 2) {
+ if(!aStates->GetCurrectState().at(1).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(1));
+ aStates->IncrementState();
+ }
+ else if(aMethod == "SetNbSegPerEdge" && aStates->GetCurrectState().size() >= 3) {
+ if(!aStates->GetCurrectState().at(2).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(2));
+ aStates->IncrementState();
+ }
+ else if(aMethod == "SetNbSegPerRadius" && aStates->GetCurrectState().size() >= 4) {
+ if(!aStates->GetCurrectState().at(3).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(3));
+ aStates->IncrementState();
+ }
+ }
+
+ // Case for NumberOfLayers hypothesis
+ else if(aStates->GetObjectType().IsEqual("NumberOfLayers")){
+ if(aMethod == "SetNumberOfLayers" && aStates->GetCurrectState().size() >= 1) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ aStates->IncrementState();
+ }
+ }
+
+ // Case for NumberOfSegments hypothesis
+ else if(aStates->GetObjectType().IsEqual("NumberOfSegments")){
+ if(aMethod == "SetNumberOfSegments" && aStates->GetCurrectState().size() >= 1) {
+ if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ if(aStates->GetCurrectState().size()==1)
+ aStates->IncrementState();
+ }
+ else if (aMethod == "SetScaleFactor" && aStates->GetCurrectState().size() >= 2) {
+ if(!aStates->GetCurrectState().at(1).IsEmpty() )
+ aCmd->SetArg(1,aStates->GetCurrectState().at(1));
+ aStates->IncrementState();
+ }
+ }
+
+ else if(aStates->GetObjectType().IsEqual("Mesh")) {
+ TState aCurrentState = aStates->GetCurrectState();
+ int aCurrentStateSize = aCurrentState.size();
+ if(aMethod.IsEqual("Translate") ||
+ aMethod.IsEqual("TranslateMakeGroups") ||
+ aMethod.IsEqual("TranslateMakeMesh")) {
+ bool isVariableFound = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
+ anArgIndex = i+1;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ if(aCurrentStateSize == 3) { // translation by dx, dy, dz
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ isVariableFound = true;
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ }
+ }
+ else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
+ isVariableFound = true;
+ for(int j = 0; j < 3; j++) {
+ TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j);
+ TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1);
+ bool aV1 = !aValue1.IsEmpty();
+ bool aV2 = !aValue2.IsEmpty();
+ double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0;
+ if(aV1 && !aV2) {
+ if(!GetReal(aValue1, aValue))
+ aValue = 0;
+ aValue2 = TCollection_AsciiString( aValue + aCurrentValue );
+ }
+ else if(!aV1 && aV2) {
+ if(!GetReal(aValue2, aValue))
+ aValue = 0;
+ aValue1 = TCollection_AsciiString( aValue - aCurrentValue );
+ }
+ else if(!aV1 && !aV2) {
+ aValue1 = TCollection_AsciiString( 0 );
+ aValue2 = TCollection_AsciiString( aCurrentValue );
+ }
+ aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 );
+ }
+ }
+ }
+ if(isVariableFound) {
+ TCollection_AsciiString aDim;
+ if(aCurrentStateSize == 6)
+ aDim = "6";
+ aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"+aDim);
+ aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("Rotate") ||
+ aMethod.IsEqual("RotateMakeGroups") ||
+ aMethod.IsEqual("RotateMakeMesh") ||
+ aMethod.IsEqual("RotationSweep") ||
+ aMethod.IsEqual("RotationSweepMakeGroups") ||
+ aMethod.IsEqual("Mirror") ||
+ aMethod.IsEqual("MirrorMakeGroups")) {
+ bool isSubstitute = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) {
+ anArgIndex = i+1;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep)
+ isSubstitute = true;
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ }