+//================================================================================
+/*!
+ * \brief MeshEditor convert its commands to ones of mesh
+ */
+//================================================================================
+
+_pyMeshEditor::_pyMeshEditor(const Handle(_pyCommand)& theCreationCmd):
+ _pyObject( theCreationCmd )
+{
+ myMesh = theCreationCmd->GetObject();
+ myCreationCmdStr = theCreationCmd->GetString();
+ theCreationCmd->Clear();
+}
+
+//================================================================================
+/*!
+ * \brief convert its commands to ones of mesh
+ */
+//================================================================================
+
+void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
+{
+ // names of SMESH_MeshEditor methods fully equal to methods of class Mesh, so
+ // commands calling this methods are converted to calls of methods of Mesh
+ static TStringSet sameMethods;
+ if ( sameMethods.empty() ) {
+ const char * names[] = {
+ "RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
+ "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode",
+ "InverseDiag","DeleteDiag","Reorient","ReorientObject","SplitQuad","SplitQuadObject",
+ "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
+ "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
+ "RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
+ "ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","Mirror",
+ "MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
+ "FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
+ "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
+ "SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
+ "GetLastCreatedElems",
+ "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh",
+ "TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh",
+ "" }; // <- mark of the end
+ sameMethods.Insert( names );
+ }
+ //theGen->AddMeshAccessorMethod( theCommand ); // for *Object()
+
+ if ( sameMethods.Contains( theCommand->GetMethod() )) {
+ theCommand->SetObject( myMesh );
+
+ // meshes made by *MakeMesh() methods are not wrapped by _pyMesh,
+ // so let _pyMesh care of it (TMP?)
+ if ( theCommand->GetMethod().Search("MakeMesh") != -1 )
+ _pyMesh( new _pyCommand( theCommand->GetString(), 0 )); // for theGen->SetAccessorMethod()
+ }
+ else {
+ // editor creation command is needed only if any editor function is called
+ if ( !myCreationCmdStr.IsEmpty() ) {
+ GetCreationCmd()->GetString() = myCreationCmdStr;
+ myCreationCmdStr.Clear();
+ }
+ }
+}
+