#include "SMESH_2smeshpy.hxx"#include "utilities.h"#include "SMESH_PythonDump.hxx"#include "SMESH_NoteBook.hxx"#include "Resource_DataMapOfAsciiStringAsciiString.hxx"#include "SMESH_Gen_i.hxx"
Go to the source code of this file.
| static Handle | ( | _pyGen | ) | [static] |
Container of commands into which the initial script is split.
It also contains data coresponding to SMESH_Gen contents
| Handle | ( | _pyCommand | ) |
Convert a command using a specific converter.
Set command be last in list of commands.
| theCommand | - the command to convert |
| theCmd | - Command to be last |
Definition at line 227 of file SMESH_2smeshpy.cxx.
References SMESH_2smeshpy.GenName(), _pyCommand.GetArg(), _pyCommand.GetNbArgs(), _pyCommand.GetString(), Handle(), SMESH_demo_hexa2_upd.hyp, PAL_MESH_041_mesh.mesh, MESSAGE, and _pyCommand.SetArg().
{
// store theCommand in the sequence
myCommands.push_back( new _pyCommand( theCommand, ++myNbCommands ));
Handle(_pyCommand) aCommand = myCommands.back();
#ifdef DUMP_CONVERSION
MESSAGE ( "## COM " << myNbCommands << ": "<< aCommand->GetString() );
#endif
_pyID objID = aCommand->GetObject();
if ( objID.IsEmpty() )
return aCommand;
// SMESH_Gen method?
if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName()) {
this->Process( aCommand );
return aCommand;
}
// SMESH_Mesh method?
map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( objID );
if ( id_mesh != myMeshes.end() )
{
// check for mesh editor object
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
_pyID editorID = aCommand->GetResultValue();
Handle(_pyMeshEditor) editor = new _pyMeshEditor( aCommand );
myMeshEditors.insert( make_pair( editorID, editor ));
return aCommand;
}
// check for SubMesh objects
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
_pyID subMeshID = aCommand->GetResultValue();
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
myObjects.insert( make_pair( subMeshID, subMesh ));
}
id_mesh->second->Process( aCommand );
return aCommand;
}
// SMESH_MeshEditor method?
map< _pyID, Handle(_pyMeshEditor) >::iterator id_editor = myMeshEditors.find( objID );
if ( id_editor != myMeshEditors.end() )
{
id_editor->second->Process( aCommand );
TCollection_AsciiString processedCommand = aCommand->GetString();
// some commands of SMESH_MeshEditor create meshes
if ( aCommand->GetMethod().Search("MakeMesh") != -1 ) {
Handle(_pyMesh) mesh = new _pyMesh( aCommand, aCommand->GetResultValue() );
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
}
if ( aCommand->GetMethod() == "MakeBoundaryMesh") {
_pyID meshID = aCommand->GetResultValue(0);
if ( !myMeshes.count( meshID ) )
{
Handle(_pyMesh) mesh = new _pyMesh( aCommand, meshID );
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
myMeshes.insert( make_pair( meshID, mesh ));
}
}
return aCommand;
}
// SMESH_Hypothesis method?
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp )
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
(*hyp)->Process( aCommand );
return aCommand;
}
// other object method?
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID );
if ( id_obj != myObjects.end() ) {
id_obj->second->Process( aCommand );
return aCommand;
}
// if ( theCommand.Search( "aFilterManager" ) != -1 ) {
// if ( theCommand.Search( "CreateFilterManager" ) != -1 )
// myFilterManager = new _pySelfEraser( aCommand );
// else if ( !myFilterManager.IsNull() )
// myFilterManager->Process( aCommand );
// return aCommand;
// }
// Add access to a wrapped mesh
AddMeshAccessorMethod( aCommand );
// Add access to a wrapped algorithm
// AddAlgoAccessorMethod( aCommand ); // ??? what if algo won't be wrapped at all ???
// PAL12227. PythonDump was not updated at proper time; result is
// aCriteria.append(SMESH.Filter.Criterion(17,26,0,'L1',26,25,1e-07,SMESH.EDGE,-1))
// TypeError: __init__() takes exactly 11 arguments (10 given)
char wrongCommand[] = "SMESH.Filter.Criterion(";
if ( int beg = theCommand.Location( wrongCommand, 1, theCommand.Length() ))
{
_pyCommand tmpCmd( theCommand.SubString( beg, theCommand.Length() ), -1);
// there must be 10 arguments, 5-th arg ThresholdID is missing,
const int wrongNbArgs = 9, missingArg = 5;
if ( tmpCmd.GetNbArgs() == wrongNbArgs )
{
for ( int i = wrongNbArgs; i > missingArg; --i )
tmpCmd.SetArg( i + 1, tmpCmd.GetArg( i ));
tmpCmd.SetArg( missingArg, "''");
aCommand->GetString().Trunc( beg - 1 );
aCommand->GetString() += tmpCmd.GetString();
}
}
return aCommand;
}
| Handle | ( | _pyHypothesis | ) |
Find hypothesis by ID (entry)
Creates algorithm or hypothesis.
Find algorithm the created algorithm.
| theHypID | - The hypothesis ID |
| Handle(_pyHypothesis) | - The found hypothesis |
| theGeom | - The shape ID the algorithm was created on |
| theMesh | - The mesh ID that created the algorithm |
| dim | - The algo dimension |
| Handle(_pyHypothesis) | - The found algo |
| theCreationCmd | - The engine command creating a hypothesis |
| Handle(_pyHypothesis) | - Result _pyHypothesis |
Definition at line 544 of file SMESH_2smeshpy.cxx.
References Handle(), and SMESH_demo_hexa2_upd.hyp.
{
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp )
if ( !hyp->IsNull() && theHypID == (*hyp)->GetID() )
return *hyp;
return Handle(_pyHypothesis)();
}
| Handle | ( | _pySubMesh | ) |
Find subMesh by ID (entry)
| theSubMeshID | - The subMesh ID |
| Handle(_pySubMesh) | - The found subMesh |
Definition at line 585 of file SMESH_2smeshpy.cxx.
References SMESH.DownCast(), and Handle().
{
map< _pyID, Handle(_pyObject) >::iterator id_subMesh = myObjects.find(theSubMeshID);
if ( id_subMesh != myObjects.end() )
return Handle(_pySubMesh)::DownCast( id_subMesh->second );
return Handle(_pySubMesh)();
}
| IMPLEMENT_STANDARD_HANDLE | ( | _pyCommand | , |
| Standard_Transient | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pySelfEraser | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyAlgorithm | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pySubMesh | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyComplexParamHypo | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyNumberOfSegmentsHyp | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyMeshEditor | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyObject | , |
| Standard_Transient | |||
| ) |
| IMPLEMENT_STANDARD_HANDLE | ( | _pyHypothesis | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pySelfEraser | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyAlgorithm | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyNumberOfSegmentsHyp | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyLayerDistributionHypo | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyObject | , |
| Standard_Transient | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyCommand | , |
| Standard_Transient | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyMeshEditor | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pySegmentLengthAroundVertexHyp | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyComplexParamHypo | , |
| _pyHypothesis | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pySubMesh | , |
| _pyObject | |||
| ) |
| IMPLEMENT_STANDARD_RTTIEXT | ( | _pyHypothesis | , |
| _pyObject | |||
| ) |
Check if char is a word part.
| c | - The character to check |
| bool | - The check result |
Definition at line 2218 of file SMESH_2smeshpy.cxx.
Referenced by _pyCommand.GetWord().
{
return
!isspace(c) && c != ',' && c != '=' && c != ')' && c != '(' && ( dotIsWord || c != '.');
}
TCollection_AsciiString theEmptyString [static] |
Definition at line 76 of file SMESH_2smeshpy.cxx.
Referenced by _pyCommand.GetResultValue(), and _pyCommand.GetWord().