using namespace std;
+void SetVariable(Handle(_pyCommand) theCommand,const ObjectStates* theStates, int position, int theArgNb);
//================================================================================
/*!
}
}
+ if(it == _objectMap.end()) { // additional check for pattern mapping
+ if(aMethod.IsEqual("ApplyToMeshFaces") ||
+ aMethod.IsEqual("ApplyToHexahedrons"))
+ it = _objectMap.find(aCmd->GetArg(1));
+ }
+
if(it != _objectMap.end()) {
+ if(MYDEBUG)
+ cout << "Found object : " << (*it).first << endl;
ObjectStates *aStates = (*it).second;
// Case for LocalLength hypothesis
if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
if(aMethod == "SetLayerDistribution"){
LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
aLDStates->AddDistribution(aCmd->GetArg(1));
+ if(MYDEBUG)
+ cout<<"Add Distribution :"<<aCmd->GetArg(1)<<endl;
}
}
else if(aStates->GetObjectType().IsEqual("Mesh")) {
TState aCurrentState = aStates->GetCurrectState();
int aCurrentStateSize = aCurrentState.size();
- if(aMethod.IsEqual("Translate") ||
- aMethod.IsEqual("TranslateMakeGroups") ||
- aMethod.IsEqual("TranslateMakeMesh")) {
+ if(aMethod.IsEqual("Translate") ||
+ aMethod.IsEqual("TranslateMakeGroups") ||
+ aMethod.IsEqual("TranslateMakeMesh") ||
+ aMethod.IsEqual("TranslateObject") ||
+ aMethod.IsEqual("TranslateObjectMakeGroups") ||
+ aMethod.IsEqual("TranslateObjectMakeMesh")) {
bool isVariableFound = false;
int anArgIndex = 0;
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
}
aStates->IncrementState();
}
- else if(aMethod.IsEqual("Rotate") ||
- aMethod.IsEqual("RotateMakeGroups") ||
- aMethod.IsEqual("RotateMakeMesh") ||
- aMethod.IsEqual("RotationSweep") ||
+ else if(aMethod.IsEqual("Rotate") ||
+ aMethod.IsEqual("RotateMakeGroups") ||
+ aMethod.IsEqual("RotateMakeMesh") ||
+ aMethod.IsEqual("RotateObject") ||
+ aMethod.IsEqual("RotateObjectMakeGroups") ||
+ aMethod.IsEqual("RotateObjectMakeMesh") ||
+ aMethod.IsEqual("RotationSweep") ||
+ aMethod.IsEqual("RotationSweepObject") ||
+ aMethod.IsEqual("RotationSweepObject1D") ||
+ aMethod.IsEqual("RotationSweepObject2D") ||
aMethod.IsEqual("RotationSweepMakeGroups") ||
- aMethod.IsEqual("Mirror") ||
- aMethod.IsEqual("MirrorMakeGroups")) {
+ aMethod.IsEqual("RotationSweepObjectMakeGroups") ||
+ aMethod.IsEqual("RotationSweepObject1DMakeGroups") ||
+ aMethod.IsEqual("RotationSweepObject2DMakeGroups") ||
+ aMethod.IsEqual("Mirror") ||
+ aMethod.IsEqual("MirrorMakeMesh") ||
+ aMethod.IsEqual("MirrorMakeGroups") ||
+ aMethod.IsEqual("MirrorObject") ||
+ aMethod.IsEqual("MirrorObjectMakeMesh") ||
+ aMethod.IsEqual("MirrorObjectMakeGroups")) {
bool isSubstitute = false;
int anArgIndex = 0;
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
aStates->IncrementState();
}
else if(aMethod.IsEqual("ExtrusionSweep") ||
- aMethod.IsEqual("ExtrusionSweepMakeGroups")) {
+ aMethod.IsEqual("ExtrusionSweepObject") ||
+ aMethod.IsEqual("ExtrusionSweepObject1D") ||
+ aMethod.IsEqual("ExtrusionSweepObject2D") ||
+ aMethod.IsEqual("ExtrusionSweepMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") ||
+ aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) {
bool isSubstitute = false;
int anArgIndex = 0;
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
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("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;
aStates->IncrementState();
}
else if(aMethod.IsEqual("Smooth") ||
- aMethod.IsEqual("SmoothParametric")) {
+ 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())
}
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();
+ }
}
}
+ else {
+ if(MYDEBUG)
+ cout << "Object not found" << endl;
+ }
if(MYDEBUG) {
cout<<"Command after: "<< aCmd->GetString()<<endl;
}
}
- // ProcessLayerDistribution();
+
+ ProcessLayerDistribution();
}
//================================================================================
/*!
if(MYDEBUG)
cout<<"The object Type : "<<anObjType<<endl;
ObjectStates *aState = NULL;
- if(anObjType == "LayerDistribution")
+ if(anObjType == "LayerDistribution") {
aState = new LayerDistributionStates();
+ }
else
aState = new ObjectStates(anObjType);
// 1) Find all LayerDistribution states
vector<LayerDistributionStates*> aLDS;
TVariablesMap::const_iterator it = _objectMap.begin();
- for(;it != _objectMap.end();it++)
- if(LayerDistributionStates* aLDStates = (LayerDistributionStates*)((*it).second)) {
+ for(;it != _objectMap.end();it++) {
+ LayerDistributionStates* aLDStates = dynamic_cast<LayerDistributionStates*>(((*it).second));
+ if(aLDStates!=NULL) {
aLDS.push_back(aLDStates);
}
+ }
+
+ if(!aLDS.size())
+ return;
// 2) Initialize all type of 1D Distribution hypothesis
for(int i=0;i<_commands.size();i++){
TCollection_AsciiString aMethod = _commands[i]->GetMethod();
if(aType == "LocalLength") {
if(aMethod == "SetLength") {
- if(!aLDS[j]->GetCurrectState().at(0).IsEmpty() )
- _commands[i]->SetArg(1,aLDS[j]->GetCurrectState().at(0));
+ SetVariable(_commands[i], aLDS[j],0,1);
aLDS[j]->IncrementState();
}
else if(aMethod == "SetPrecision") {
- if(!aLDS[j]->GetCurrectState().at(1).IsEmpty() )
- _commands[i]->SetArg(1,aLDS[j]->GetCurrectState().at(1));
+ SetVariable(_commands[i], aLDS[j],1,1);
+ aLDS[j]->IncrementState();
+ }
+ }
+
+ // Case for NumberOfSegments hypothesis
+ else if(aType == "NumberOfSegments"){
+ if(aMethod == "SetNumberOfSegments") {
+ SetVariable(_commands[i], aLDS[j],0,1);
+ if(aLDS[j]->GetCurrectState().size()==1)
+ aLDS[j]->IncrementState();
+ }
+ else if (aMethod == "SetScaleFactor") {
+ SetVariable(_commands[i], aLDS[j],1,1);
+ aLDS[j]->IncrementState();
+ }
+ }
+
+ else if( aType == "Deflection1D" ){
+ if(aMethod == "SetDeflection"){
+ SetVariable(_commands[i], aLDS[j],0,1);
+ aLDS[j]->IncrementState();
+ }
+ }
+ // Case for Arithmetic1D and StartEndLength hypothesis
+ else if(aType == "Arithmetic1D" || aType == "StartEndLength") {
+ if(aMethod == "SetLength") {
+ int anArgNb = (_commands[i]->GetArg(2) == "1") ? 0 : 1;
+ SetVariable(_commands[i], aLDS[j],anArgNb,1);
aLDS[j]->IncrementState();
}
}
return ok;
}
+
+
+/*!
+ * Set variable of the ObjectStates from position to the _pyCommand
+ * method as nbArg argument
+ */
+void SetVariable(Handle(_pyCommand) theCommand, const ObjectStates* theStates, int position, int theArgNb)
+{
+ if(theStates->GetCurrectState().size() > position)
+ if(!theStates->GetCurrectState().at(position).IsEmpty())
+ theCommand->SetArg(theArgNb,theStates->GetCurrectState().at(position));
+}