TCollection_AsciiString str ("isDone = mesh_editor.Reorient(");
SMESH_Gen_i::AddArray( str, IDsOfElements ) += ")";
SMESH_Gen_i::AddToCurrentPyScript( str );
-#ifdef _DEBUG_
- SMESH_Gen_i::AddToCurrentPyScript( "print \"Reorient: \", isDone" );
-#endif
return true;
}
CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theObject)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
- return Reorient(anElementsId);
+ CORBA::Boolean isDone = Reorient(anElementsId);
+
+ // Clear python line, created by Reorient()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("isDone = mesh_editor.ReorientObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ")";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
+
+ return isDone;
}
//=============================================================================
CORBA::Double MaxAngle)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
- return TriToQuad(anElementsId, Criterion, MaxAngle);
+ CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
+
+ // Clear python line(s), created by TriToQuad()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+ // Update Python script
+ TCollection_AsciiString str ("isDone = mesh_editor.TriToQuadObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", None, ";
+ str += (Standard_Real) MaxAngle;
+ SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+#ifdef _DEBUG_
+ SMESH_Gen_i::AddToCurrentPyScript( "print \"TriToQuadObject: \", isDone" );
+#endif
+
+ return isDone;
}
//=============================================================================
CORBA::Boolean Diag13)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
- return SplitQuad(anElementsId, Diag13);
+ CORBA::Boolean isDone = SplitQuad(anElementsId, Diag13);
+
+ // Clear python line(s), created by SplitQuad()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+ // Update Python script
+ TCollection_AsciiString str ("isDone = mesh_editor.SplitQuadObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+ str += TCollection_AsciiString( Diag13 ) + ")";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+ SMESH_Gen_i::AddToCurrentPyScript( "print \"SplitQuadObject: \", isDone" );
+#endif
+
+ return isDone;
}
//=============================================================================
str += (Standard_Integer) MaxNbOfIterations;
str += ", ";
str += (Standard_Real) MaxAspectRatio;
- str += ", ";
if ( method == ::SMESH_MeshEditor::CENTROIDAL )
- str += "SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH )";
+ str += ", SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH )";
else
- str += "SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH )";
+ str += ", SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH )";
SMESH_Gen_i::AddToCurrentPyScript( str );
#ifdef _DEBUG_
- SMESH_Gen_i::AddToCurrentPyScript( "print \"SplitQuad: \", isDone" );
+ SMESH_Gen_i::AddToCurrentPyScript( "print \"Smooth: \", isDone" );
#endif
return true;
SMESH::SMESH_MeshEditor::Smooth_Method Method)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
- return Smooth(anElementsId, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method);
+ CORBA::Boolean isDone = Smooth
+ (anElementsId, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method);
+
+ // Clear python line(s), created by Smooth()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+ // Update Python script
+ TCollection_AsciiString str ("isDone = mesh_editor.SmoothObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+ SMESH_Gen_i::AddArray( str, IDsOfFixedNodes ) += ", ";
+ str += (Standard_Integer) MaxNbOfIterations;
+ str += ", ";
+ str += (Standard_Real) MaxAspectRatio;
+ if ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH )
+ str += ", SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH )";
+ else
+ str += ", SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+ SMESH_Gen_i::AddToCurrentPyScript( "print \"SmoothObject: \", isDone" );
+#endif
+
+ return isDone;
}
//=============================================================================
TCollection_AsciiString str = "axis = ";
addAxis( str, theAxis );
SMESH_Gen_i::AddToCurrentPyScript( str );
- str = ("mesh_editor.RotationSweep(");
+ str = "mesh_editor.RotationSweep(";
SMESH_Gen_i::AddArray( str, theIDsOfElements ) += ", axis, ";
str += TCollection_AsciiString( theAngleInRadians ) + ", ";
str += TCollection_AsciiString( (int)theNbOfSteps ) + ", ";
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
RotationSweep(anElementsId, theAxis, theAngleInRadians, theNbOfSteps, theTolerance);
+
+ // Clear python line, created by RotationSweep()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("mesh_editor.RotationSweepObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", axis, ";
+ str += TCollection_AsciiString( theAngleInRadians ) + ", ";
+ str += TCollection_AsciiString( (int)theNbOfSteps ) + ", ";
+ str += TCollection_AsciiString( theTolerance ) + " )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
}
//=======================================================================
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
+
+ // Clear python line, created by ExtrusionSweep()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("mesh_editor.ExtrusionSweepObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", stepVector, ";
+ str += TCollection_AsciiString((int)theNbOfSteps) + " )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
}
#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
SMESH_Gen_i::AddToCurrentPyScript( str );
str = ("error = mesh_editor.ExtrusionAlongPath(");
SMESH_Gen_i::AddArray ( str, theIDsOfElements ) += ", ";
- SMESH_Gen_i::AddObject( str, thePathMesh ) += ", salome.IDToObject(\"";
- SMESH_Gen_i::AddObject( str, thePathShape ) += "\"), ";
+ SMESH_Gen_i::AddObject( str, thePathMesh ) += ", ";
+ SMESH_Gen_i::AddObject( str, thePathShape ) += ", ";
str += TCollection_AsciiString( (int)theNodeStart ) + ", ";
str += TCollection_AsciiString( (int)theHasAngles ) + ", ";
SMESH_Gen_i::AddArray ( str, theAngles ) += ", ";
const SMESH::PointStruct & theRefPoint)
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
- return ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint );
+ SMESH::SMESH_MeshEditor::Extrusion_Error error = ExtrusionAlongPath
+ (anElementsId, thePathMesh, thePathShape, theNodeStart,
+ theHasAngles, theAngles, theHasRefPoint, theRefPoint);
+
+ // Clear python line, created by ExtrusionAlongPath()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("error = mesh_editor.ExtrusionAlongPathObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+ SMESH_Gen_i::AddObject( str, thePathMesh ) += ", ";
+ SMESH_Gen_i::AddObject( str, thePathShape ) += ", ";
+ str += TCollection_AsciiString( (int)theNodeStart ) + ", ";
+ str += TCollection_AsciiString( theHasAngles ) + ", ";
+ SMESH_Gen_i::AddArray ( str, theAngles ) += ", ";
+ str += TCollection_AsciiString( theHasRefPoint ) + ", refPoint )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
+
+ return error;
}
//=======================================================================
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
Mirror(anElementsId, theAxis, theMirrorType, theCopy);
+
+ // Clear python line, created by Mirror()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString typeStr, copyStr( theCopy );
+ switch ( theMirrorType ) {
+ case SMESH::SMESH_MeshEditor::POINT:
+ typeStr = "SMESH.SMESH_MeshEditor.POINT";
+ break;
+ case SMESH::SMESH_MeshEditor::AXIS:
+ typeStr = "SMESH.SMESH_MeshEditor.AXIS";
+ break;
+ default:
+ typeStr = "SMESH.SMESH_MeshEditor.PLANE";
+ }
+
+ TCollection_AsciiString str ("mesh_editor.MirrorObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", ";
+ addAxis( str, theAxis ) += ", ";
+ str += typeStr + ", " + copyStr + " )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
}
//=======================================================================
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
Translate(anElementsId, theVector, theCopy);
+
+ // Clear python line, created by Translate()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("mesh_editor.TranslateObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", vector, ";
+ str += TCollection_AsciiString( theCopy ) + " )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
}
//=======================================================================
{
SMESH::long_array_var anElementsId = theObject->GetIDs();
Rotate(anElementsId, theAxis, theAngle, theCopy);
+
+ // Clear python line, created by Rotate()
+ SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+ aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+
+ // Update Python script
+ TCollection_AsciiString str ("mesh_editor.RotateObject(");
+ SMESH_Gen_i::AddObject( str, theObject ) += ", axis, ";
+ str += TCollection_AsciiString( theAngle ) + ", ";
+ str += TCollection_AsciiString( theCopy ) + " )";
+ SMESH_Gen_i::AddToCurrentPyScript( str );
}
//=======================================================================
//=============================================================================
/*!
- *
+ * Export in different formats
*/
//=============================================================================
-void SMESH_Mesh_i::ExportToMED( const char* file,
+void SMESH_Mesh_i::ExportToMED (const char* file,
CORBA::Boolean auto_groups,
- SMESH::MED_VERSION theVersion )
+ SMESH::MED_VERSION theVersion)
throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
-
+
+ // Update Python script
+ TCollection_AsciiString aStr;
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportToMED(\"";
+ aStr += TCollection_AsciiString((char*)file) + "\", ";
+ aStr += TCollection_AsciiString((int)auto_groups) + ", ";
+ switch (theVersion) {
+ case SMESH::MED_V2_1:
+ aStr += "SMESH.MED_V2_1)";
+ break;
+ case SMESH::MED_V2_2:
+ aStr += "SMESH.MED_V2_2)";
+ break;
+ default:
+ aStr += TCollection_AsciiString(theVersion) + ")";
+ break;
+ }
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+ // Perform Export
char* aMeshName = "Mesh";
SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
if ( !aStudy->_is_nil() ) {
_impl->ExportMED( file, aMeshName, auto_groups, theVersion );
}
-void SMESH_Mesh_i::ExportMED( const char* file,
+void SMESH_Mesh_i::ExportMED (const char* file,
CORBA::Boolean auto_groups)
throw(SALOME::SALOME_Exception)
{
ExportToMED(file,auto_groups,SMESH::MED_V2_1);
}
-void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception)
+void SMESH_Mesh_i::ExportDAT (const char *file)
+ throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
+
+ // Update Python script
+ TCollection_AsciiString aStr;
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportDAT(\"";
+ aStr += TCollection_AsciiString((char*)file) + "\")";
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+ // Perform Export
_impl->ExportDAT(file);
}
-void SMESH_Mesh_i::ExportUNV(const char *file) throw(SALOME::SALOME_Exception)
+
+void SMESH_Mesh_i::ExportUNV (const char *file)
+ throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
+
+ // Update Python script
+ TCollection_AsciiString aStr;
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportUNV(\"";
+ aStr += TCollection_AsciiString((char*)file) + "\")";
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+ // Perform Export
_impl->ExportUNV(file);
}
-void SMESH_Mesh_i::ExportSTL(const char *file, const bool isascii) throw(SALOME::SALOME_Exception)
+void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
+ throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
+
+ // Update Python script
+ TCollection_AsciiString aStr;
+ SMESH_Gen_i::AddObject(aStr, _this()) += ".ExportToMED(\"";
+ aStr += TCollection_AsciiString((char*)file) + "\", ";
+ aStr += TCollection_AsciiString((int)isascii) + ")";
+
+ SMESH_Gen_i::AddToCurrentPyScript(aStr);
+
+ // Perform Export
_impl->ExportSTL(file, isascii);
}