_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
: _pyObject( new _pyCommand( TPythonDump::SMESHGenName(), 0 )),
+ myNbCommands( 0 ),
myID2AccessorMethod( theEntry2AccessorMethod ),
- myObjectNames( theObjectNames )
+ myObjectNames( theObjectNames ),
+ myNbFilters( 0 )
{
- myNbCommands = 0;
// make that GetID() to return TPythonDump::SMESHGenName()
GetCreationCmd()->GetString() += "=";
}
// aFilterManager.CreateFilter() ?
if ( aCommand->GetMethod() == "CreateFilter" )
{
- Handle(_pyObject) filter( new _pyFilter( aCommand ));
+ // Set a more human readable name to a filter
+ // aFilter0x7fbf6c71cfb0 -> aFilter_nb
+ _pyID newID, filterID = aCommand->GetResultValue();
+ int pos = filterID.Search( "0x" );
+ if ( pos > 1 )
+ newID = (filterID.SubString(1,pos-1) + "_") + _pyID( ++myNbFilters );
+
+ Handle(_pyObject) filter( new _pyFilter( aCommand, newID ));
AddObject( filter );
}
else if ( hypType == "Projection_2D" ) {
algo->SetConvMethodAndType( "Projection2D", hypType.ToCString());
}
+ else if ( hypType == "Projection_1D2D" ) {
+ algo->SetConvMethodAndType( "Projection1D2D", hypType.ToCString());
+ }
else if ( hypType == "ProjectionSource2D" ) {
hyp->SetConvMethodAndType( "SourceFace", "Projection_2D");
hyp->AddArgMethod( "SetSourceFace");
}
}
+//================================================================================
+/*!
+ * \brief Constructor of _pyFilter
+ */
+//================================================================================
+
+_pyFilter::_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID/*=""*/)
+ :_pyObject(theCreationCmd), myNewID( newID )
+{
+}
+
//================================================================================
/*!
* \brief To convert creation of a filter by criteria
void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
{
+ if ( !myNewID.IsEmpty() )
+ theCommand->SetObject( myNewID );
+
// Convert the following set of commands into smesh.GetFilterFromCriteria(criteria)
// aFilter0x2aaab0487080 = aFilterManager.CreateFilter()
// aFilter0x2aaab0487080.SetCriteria(aCriteria)
{
// aFilter.SetCriteria(aCriteria) ->
// aFilter = smesh.GetFilterFromCriteria(criteria)
- theCommand->SetResultValue( GetID() );
+ if ( myNewID.IsEmpty() )
+ theCommand->SetResultValue( GetID() );
+ else
+ theCommand->SetResultValue( myNewID );
theCommand->SetObject( SMESH_2smeshpy::GenName() );
theCommand->SetMethod( "GetFilterFromCriteria" );
theGen->AddMeshAccessorMethod( theCommand );
}
}
+
+//================================================================================
+/*!
+ * \brief Set new filter name to the creation command
+ */
+//================================================================================
+
+void _pyFilter::Flush()
+{
+ if ( !myNewID.IsEmpty() && GetCreationCmd()->IsEmpty() )
+ GetCreationCmd()->SetResultValue( myNewID );
+}
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
Handle(_pyCommand) myLastCommand;
+ int myNbFilters;
DEFINE_STANDARD_RTTI (_pyGen)
};
// -------------------------------------------------------------------------------------
class _pyFilter: public _pyObject
{
+ _pyID myNewID;
public:
- _pyFilter(const Handle(_pyCommand)& theCreationCmd):_pyObject(theCreationCmd) {}
+ _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
void Process( const Handle(_pyCommand)& theCommand);
- virtual void Flush() {}
+ virtual void Flush();
DEFINE_STANDARD_RTTI (_pyFilter)
};