if ( -1 < iGeom && iGeom < SMESH::Geom_POLYHEDRA+1 )
Threshold = SMESH + types[ iGeom ];
}
- if ( ThresholdStr.Length() != 2 ) // not '' or ""
+ if ( ThresholdID.Length() != 2 && ThresholdStr.Length() != 2) // not '' or ""
+ aCommand->SetArg( 4, ThresholdID.SubString( 2, ThresholdID.Length()-1 )); // shape entry
+ else if ( ThresholdStr.Length() != 2 )
aCommand->SetArg( 4, ThresholdStr );
else if ( ThresholdID.Length() != 2 )
aCommand->SetArg( 4, ThresholdID );
algo = newAlgo;
// set algorithm creation
theGen->SetCommandBefore( newCmd, addCmd );
+ myHypos.push_back( newAlgo );
+ if ( !myLastComputeCmd.IsNull() &&
+ newCmd->GetOrderNb() == myLastComputeCmd->GetOrderNb() + 1)
+ newAlgo->MeshComputed( myLastComputeCmd );
}
else
newCmd->Clear();
if( pos != -1)
{
isPyMeshMethod = true;
+ bool is0DmethId = ( method == "ExtrusionSweepMakeGroups0D" );
+ bool is0DmethObj = ( method == "ExtrusionSweepObject0DMakeGroups");
// 1. Remove "MakeGroups" from the Command
TCollection_AsciiString aMethod = theCommand->GetMethod();
int nbArgsToAdd = diffLastTwoArgsMethods.Contains(aMethod) ? 2 : 1;
+
+ if(is0DmethObj)
+ pos = pos-2; //Remove "0D" from the Command too
aMethod.Trunc(pos-1);
theCommand->SetMethod(aMethod);
// 2. And add last "True" argument(s)
while(nbArgsToAdd--)
theCommand->SetArg(theCommand->GetNbArgs()+1,"True");
+ if( is0DmethId || is0DmethObj )
+ theCommand->SetArg(theCommand->GetNbArgs()+1,"True");
}
}
+ // ExtrusionSweep0D() -> ExtrusionSweep()
+ // ExtrusionSweepObject0D() -> ExtrusionSweepObject()
+ if ( !isPyMeshMethod && ( method == "ExtrusionSweep0D" ||
+ method == "ExtrusionSweepObject0D" ))
+ {
+ isPyMeshMethod=true;
+ theCommand->SetMethod( method.SubString( 1, method.Length()-2));
+ theCommand->SetArg(theCommand->GetNbArgs()+1,"False"); //sets flag "MakeGroups = False"
+ theCommand->SetArg(theCommand->GetNbArgs()+1,"True"); //sets flag "IsNode = True"
+ }
// set "ExtrusionAlongPathX()" instead of "ExtrusionAlongPathObjX()"
if ( !isPyMeshMethod && method == "ExtrusionAlongPathObjX")
{
void _pyHypothesis::Process( const Handle(_pyCommand)& theCommand)
{
ASSERT( !myIsAlgo );
- rememberCmdOfParameter( theCommand );
+ if ( !theGen->IsToKeepAllCommands() )
+ rememberCmdOfParameter( theCommand );
// set args
int nbArgs = 0;
for ( int i = 1; i <= myArgMethods.Length(); ++i ) {
void _pyHypothesis::Flush()
{
- if ( IsWrapped() ) {
- }
- else {
+ if ( !IsAlgo() )
+ {
list < Handle(_pyCommand) >::iterator cmd = myArgCommands.begin();
for ( ; cmd != myArgCommands.end(); ++cmd ) {
// Add access to a wrapped mesh
void _pyHypothesis::ClearCommands()
{
- if ( !theGen->IsToKeepAllCommands() )
- {
- bool isUsed = false;
- int lastComputeOrder = 0;
- list<Handle(_pyCommand) >::iterator cmd = myComputeCmds.begin();
- for ( ; cmd != myComputeCmds.end(); ++cmd )
- if ( ! (*cmd)->IsEmpty() )
- {
- isUsed = true;
- if ( (*cmd)->GetOrderNb() > lastComputeOrder )
- lastComputeOrder = (*cmd)->GetOrderNb();
- }
- if ( !isUsed )
- {
- SetRemovedFromStudy( true );
- }
- else
- {
- // clear my commands invoked after lastComputeOrder
- map<TCollection_AsciiString, list< Handle(_pyCommand) > >::iterator m2c;
- for ( m2c = myMeth2Commands.begin(); m2c != myMeth2Commands.end(); ++m2c )
- {
- list< Handle(_pyCommand)> & cmds = m2c->second;
- if ( !cmds.empty() && cmds.back()->GetOrderNb() > lastComputeOrder )
- cmds.back()->Clear();
- }
- }
- }
+ // if ( !theGen->IsToKeepAllCommands() )
+ // {
+ // bool isUsed = false;
+ // int lastComputeOrder = 0;
+ // list<Handle(_pyCommand) >::iterator cmd = myComputeCmds.begin();
+ // for ( ; cmd != myComputeCmds.end(); ++cmd )
+ // if ( ! (*cmd)->IsEmpty() )
+ // {
+ // isUsed = true;
+ // if ( (*cmd)->GetOrderNb() > lastComputeOrder )
+ // lastComputeOrder = (*cmd)->GetOrderNb();
+ // }
+ // if ( !isUsed )
+ // {
+ // SetRemovedFromStudy( true );
+ // }
+ // else
+ // {
+ // // clear my commands invoked after lastComputeOrder
+ // // map<TCollection_AsciiString, list< Handle(_pyCommand) > >::iterator m2c;
+ // // for ( m2c = myMeth2Commands.begin(); m2c != myMeth2Commands.end(); ++m2c )
+ // // {
+ // // list< Handle(_pyCommand)> & cmds = m2c->second;
+ // // if ( !cmds.empty() && cmds.back()->GetOrderNb() > lastComputeOrder )
+ // // cmds.back()->Clear();
+ // // }
+ // }
+ // }
_pyObject::ClearCommands();
}
void _pyHypothesis::rememberCmdOfParameter( const Handle(_pyCommand) & theCommand )
{
- // not to clear commands setting different parameters via one method
+ // parameters are discriminated by method name
+ TCollection_AsciiString method = theCommand->GetMethod();
+
+ // discriminate commands setting different parameters via one method
// by passing parameter names like e.g. SetOption("size", "0.2")
- int quotePos = theCommand->GetString().FirstLocationInSet( "'\"", 1, theCommand->Length() );
- if ( !quotePos )
+ if ( theCommand->GetString().FirstLocationInSet( "'\"", 1, theCommand->Length() ) &&
+ theCommand->GetNbArgs() > 1 )
{
- // parameters are discriminated by method name
- list< Handle(_pyCommand)>& cmds = myMeth2Commands[ theCommand->GetMethod() ];
- if ( !cmds.empty() && !isCmdUsedForCompute( cmds.back() ))
- {
- cmds.back()->Clear(); // previous parameter value has not been used
- cmds.back() = theCommand;
- }
- else
+ // mangle method by appending a 1st textual arg (what if it's a variable name?!!!)
+ for ( int iArg = 1; iArg <= theCommand->GetNbArgs(); ++iArg )
{
- cmds.push_back( theCommand );
+ const TCollection_AsciiString& arg = theCommand->GetArg( iArg );
+ if ( arg.Value(1) != '\"' && arg.Value(1) != '\'' ) continue;
+ if ( !isalpha( arg.Value(2))) continue;
+ method += arg;
+ break;
}
}
+ // parameters are discriminated by method name
+ list< Handle(_pyCommand)>& cmds = myMeth2Commands[ theCommand->GetMethod() ];
+ if ( !cmds.empty() && !isCmdUsedForCompute( cmds.back() ))
+ {
+ cmds.back()->Clear(); // previous parameter value has not been used
+ cmds.back() = theCommand;
+ }
+ else
+ {
+ cmds.push_back( theCommand );
+ }
}
//================================================================================
if ( endPos )
{
begPos = 1;
- while ( begPos < endPos && isblank( myString.Value( begPos ))) ++begPos;
+ while ( begPos < endPos && isspace( myString.Value( begPos ))) ++begPos;
if ( begPos < endPos )
{
SetBegPos( RESULT_IND, begPos );
--endPos;
- while ( begPos < endPos && isblank( myString.Value( endPos ))) --endPos;
+ while ( begPos < endPos && isspace( myString.Value( endPos ))) --endPos;
myRes = myString.SubString( begPos, endPos );
}
}
if ( IsEmpty() ) return;
int i = 1;
- while ( i <= Length() && isblank( myString.Value(i) )) ++i;
+ while ( i <= Length() && isspace( myString.Value(i) )) ++i;
if ( i <= Length() )
{
myString.Insert( i, "#" );