mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-15 21:21:21 +05:00
0021014: EDF 1583 SMESH: Improvement of the Python Dump for the creation of groups
set a more human readable name to the filter
This commit is contained in:
parent
7133933036
commit
fb7637f099
@ -204,10 +204,11 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
|||||||
_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames)
|
||||||
: _pyObject( new _pyCommand( TPythonDump::SMESHGenName(), 0 )),
|
: _pyObject( new _pyCommand( TPythonDump::SMESHGenName(), 0 )),
|
||||||
|
myNbCommands( 0 ),
|
||||||
myID2AccessorMethod( theEntry2AccessorMethod ),
|
myID2AccessorMethod( theEntry2AccessorMethod ),
|
||||||
myObjectNames( theObjectNames )
|
myObjectNames( theObjectNames ),
|
||||||
|
myNbFilters( 0 )
|
||||||
{
|
{
|
||||||
myNbCommands = 0;
|
|
||||||
// make that GetID() to return TPythonDump::SMESHGenName()
|
// make that GetID() to return TPythonDump::SMESHGenName()
|
||||||
GetCreationCmd()->GetString() += "=";
|
GetCreationCmd()->GetString() += "=";
|
||||||
}
|
}
|
||||||
@ -309,7 +310,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
|||||||
// aFilterManager.CreateFilter() ?
|
// aFilterManager.CreateFilter() ?
|
||||||
if ( aCommand->GetMethod() == "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 );
|
AddObject( filter );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1585,6 +1593,9 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
|||||||
else if ( hypType == "Projection_2D" ) {
|
else if ( hypType == "Projection_2D" ) {
|
||||||
algo->SetConvMethodAndType( "Projection2D", hypType.ToCString());
|
algo->SetConvMethodAndType( "Projection2D", hypType.ToCString());
|
||||||
}
|
}
|
||||||
|
else if ( hypType == "Projection_1D2D" ) {
|
||||||
|
algo->SetConvMethodAndType( "Projection1D2D", hypType.ToCString());
|
||||||
|
}
|
||||||
else if ( hypType == "ProjectionSource2D" ) {
|
else if ( hypType == "ProjectionSource2D" ) {
|
||||||
hyp->SetConvMethodAndType( "SourceFace", "Projection_2D");
|
hyp->SetConvMethodAndType( "SourceFace", "Projection_2D");
|
||||||
hyp->AddArgMethod( "SetSourceFace");
|
hyp->AddArgMethod( "SetSourceFace");
|
||||||
@ -2745,6 +2756,17 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \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
|
* \brief To convert creation of a filter by criteria
|
||||||
@ -2753,6 +2775,9 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
|
|
||||||
void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
|
void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
|
||||||
{
|
{
|
||||||
|
if ( !myNewID.IsEmpty() )
|
||||||
|
theCommand->SetObject( myNewID );
|
||||||
|
|
||||||
// Convert the following set of commands into smesh.GetFilterFromCriteria(criteria)
|
// Convert the following set of commands into smesh.GetFilterFromCriteria(criteria)
|
||||||
// aFilter0x2aaab0487080 = aFilterManager.CreateFilter()
|
// aFilter0x2aaab0487080 = aFilterManager.CreateFilter()
|
||||||
// aFilter0x2aaab0487080.SetCriteria(aCriteria)
|
// aFilter0x2aaab0487080.SetCriteria(aCriteria)
|
||||||
@ -2761,7 +2786,10 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
{
|
{
|
||||||
// aFilter.SetCriteria(aCriteria) ->
|
// aFilter.SetCriteria(aCriteria) ->
|
||||||
// aFilter = smesh.GetFilterFromCriteria(criteria)
|
// aFilter = smesh.GetFilterFromCriteria(criteria)
|
||||||
|
if ( myNewID.IsEmpty() )
|
||||||
theCommand->SetResultValue( GetID() );
|
theCommand->SetResultValue( GetID() );
|
||||||
|
else
|
||||||
|
theCommand->SetResultValue( myNewID );
|
||||||
theCommand->SetObject( SMESH_2smeshpy::GenName() );
|
theCommand->SetObject( SMESH_2smeshpy::GenName() );
|
||||||
theCommand->SetMethod( "GetFilterFromCriteria" );
|
theCommand->SetMethod( "GetFilterFromCriteria" );
|
||||||
|
|
||||||
@ -2773,3 +2801,15 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
theGen->AddMeshAccessorMethod( theCommand );
|
theGen->AddMeshAccessorMethod( theCommand );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set new filter name to the creation command
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void _pyFilter::Flush()
|
||||||
|
{
|
||||||
|
if ( !myNewID.IsEmpty() && GetCreationCmd()->IsEmpty() )
|
||||||
|
GetCreationCmd()->SetResultValue( myNewID );
|
||||||
|
}
|
||||||
|
@ -215,6 +215,7 @@ private:
|
|||||||
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
||||||
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
||||||
Handle(_pyCommand) myLastCommand;
|
Handle(_pyCommand) myLastCommand;
|
||||||
|
int myNbFilters;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyGen)
|
DEFINE_STANDARD_RTTI (_pyGen)
|
||||||
};
|
};
|
||||||
@ -470,10 +471,11 @@ DEFINE_STANDARD_HANDLE (_pyGroup, _pyObject);
|
|||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
class _pyFilter: public _pyObject
|
class _pyFilter: public _pyObject
|
||||||
{
|
{
|
||||||
|
_pyID myNewID;
|
||||||
public:
|
public:
|
||||||
_pyFilter(const Handle(_pyCommand)& theCreationCmd):_pyObject(theCreationCmd) {}
|
_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
|
||||||
void Process( const Handle(_pyCommand)& theCommand);
|
void Process( const Handle(_pyCommand)& theCommand);
|
||||||
virtual void Flush() {}
|
virtual void Flush();
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyFilter)
|
DEFINE_STANDARD_RTTI (_pyFilter)
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user