- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("ExtrusionAlongPath") ||
- aMethod.IsEqual("ExtrusionAlongPathObject") ||
- aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
- aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
- aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") ||
- aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") ||
- /* workaround for a bug in the command parsing algorithm */
- aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 ||
- aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) {
- int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
- bool isSubstitute = false;
- int anArgIndex = 0;
- for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
- if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
- anArgIndex = i-1-aNbAngles;
- break;
- }
- }
- if(anArgIndex > 0) {
- int j = 0;
- for(; j < aNbAngles; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
- }
- }
- for(; j < aNbAngles+3; j++) {
- if(!aCurrentState.at(j).IsEmpty()) {
- isSubstitute = true;
- aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
- }
- }
- }
- if(isSubstitute)
- aCmd->SetArg(anArgIndex + aNbAngles + 1,
- TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("TriToQuad") ||
- aMethod.IsEqual("Concatenate") ||
- aMethod.IsEqual("ConcatenateWithGroups")) {
- if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty())
- aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0));
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("Smooth") ||
- aMethod.IsEqual("SmoothObject") ||
- aMethod.IsEqual("SmoothParametric") ||
- aMethod.IsEqual("SmoothParametricObject")) {
- int anArgIndex = aCmd->GetNbArgs() - 2;
- for(int j = 0; j < aCurrentStateSize; j++) {
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- }
- aStates->IncrementState();
- }
- else if(aMethod.IsEqual("ApplyToMeshFaces") ||
- aMethod.IsEqual("ApplyToHexahedrons")) {
- int anArgIndex = aCmd->GetNbArgs()-1;
- for(int j = 0; j < aCurrentStateSize; j++)
- if(!aCurrentState.at(j).IsEmpty())
- aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
- aStates->IncrementState();
- }
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("ExtrusionAlongPath") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
+ aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") ||
+ aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") ||
+ /* workaround for a bug in the command parsing algorithm */
+ aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 ||
+ aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) {
+ int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
+ bool isSubstitute = false;
+ int anArgIndex = 0;
+ for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
+ if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
+ anArgIndex = i-1-aNbAngles;
+ break;
+ }
+ }
+ if(anArgIndex > 0) {
+ int j = 0;
+ for(; j < aNbAngles; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
+ }
+ }
+ for(; j < aNbAngles+3; j++) {
+ if(!aCurrentState.at(j).IsEmpty()) {
+ isSubstitute = true;
+ aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
+ }
+ }
+ }
+ if(isSubstitute)
+ aCmd->SetArg(anArgIndex + aNbAngles + 1,
+ TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("TriToQuad") ||
+ aMethod.IsEqual("Concatenate") ||
+ aMethod.IsEqual("ConcatenateWithGroups")) {
+ if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty())
+ aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0));
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("Smooth") ||
+ aMethod.IsEqual("SmoothObject") ||
+ aMethod.IsEqual("SmoothParametric") ||
+ aMethod.IsEqual("SmoothParametricObject")) {
+ int anArgIndex = aCmd->GetNbArgs() - 2;
+ for(int j = 0; j < aCurrentStateSize; j++) {
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ }
+ aStates->IncrementState();
+ }
+ else if(aMethod.IsEqual("ApplyToMeshFaces") ||
+ aMethod.IsEqual("ApplyToHexahedrons")) {
+ int anArgIndex = aCmd->GetNbArgs()-1;
+ for(int j = 0; j < aCurrentStateSize; j++)
+ if(!aCurrentState.at(j).IsEmpty())
+ aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
+ aStates->IncrementState();
+ }
+ } // if ( aStates->GetObjectType().IsEqual("Mesh"))
+
+ // Case for NETGEN_Parameters_2D or NETGEN_Parameters_2D hypothesis
+ // else if(aStates->GetObjectType().IsEqual("NETGEN_Parameters_2D") ||
+ // aStates->GetObjectType().IsEqual("NETGEN_Parameters")){
+ // 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 NETGEN_SimpleParameters_3D or NETGEN_SimpleParameters_2D hypothesis
+ // else if(aStates->GetObjectType().IsEqual("NETGEN_SimpleParameters_3D") ||
+ // aStates->GetObjectType().IsEqual("NETGEN_SimpleParameters_2D")) {
+
+ // if((aMethod == "SetNumberOfSegments" || aMethod == "SetLocalLength") &&
+ // aStates->GetCurrectState().size() >= 1) {
+ // if(!aStates->GetCurrectState().at(0).IsEmpty() )
+ // aCmd->SetArg(1,aStates->GetCurrectState().at(0));
+ // aStates->IncrementState();
+ // }
+ // else if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 2) {
+ // if(!aStates->GetCurrectState().at(1).IsEmpty() )
+ // aCmd->SetArg(1,aStates->GetCurrectState().at(1));
+ // aStates->IncrementState();
+ // }
+ // else if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 3) {
+ // if(!aStates->GetCurrectState().at(2).IsEmpty() )
+ // aCmd->SetArg(1,aStates->GetCurrectState().at(2));
+ // aStates->IncrementState();
+ // }
+ // else if(aMethod == "LengthFromEdges" || aMethod == "LengthFromFaces"){
+ // aStates->IncrementState();
+ // }
+ // }
+
+ else
+ {
+ // treat Netgen hypotheses;
+ // this (and above) code can work wrong since nb of states can differ from nb of
+ // dumped calls due to the fix of
+ // issue 0021364:: Dump of netgen parameters has duplicate lines
+ SMESH_Gen_i * aGen = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
+ SALOMEDS::SObject_wrap sobj = aStudy->FindObjectID( (*it).first.ToCString() );
+ CORBA::Object_var obj = aGen->SObjectToObject( sobj );
+ if ( SMESH_Hypothesis_i* h = SMESH::DownCast< SMESH_Hypothesis_i*>( obj ))
+ {
+ TState aCurrentState = aStates->GetCurrectState();
+ int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
+ if ( 0 <= argIndex && argIndex < (int)aCurrentState.size() &&
+ !aCurrentState[argIndex].IsEmpty() )
+ aCmd->SetArg( 1, aCurrentState[argIndex] );
+
+ if ( argIndex >= 0 )
+ aStates->IncrementState();
+ }