0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH module

Use TVar structure to dump arguments that can be defined via
   notebook variables
This commit is contained in:
eap 2012-03-07 15:03:32 +00:00
parent 130a2297e9
commit 93e79bb6c3
3 changed files with 136 additions and 137 deletions

View File

@ -123,6 +123,7 @@
using namespace std;
using SMESH::TPythonDump;
using SMESH::TVar;
#define NUM_TMP_FILES 2
@ -2425,7 +2426,7 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
aPythonDump << "], ";
aPythonDump << theUniteIdenticalGroups << ", "
<< theMergeNodesAndElements << ", "
<< theMergeTolerance << ")";
<< TVar( theMergeTolerance ) << ")";
delete pPythonDump; // enable python dump from GetGroups()

View File

@ -75,6 +75,7 @@
using namespace std;
using SMESH::TPythonDump;
using SMESH::TVar;
namespace {
@ -561,7 +562,7 @@ CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
// Update Python script
TPythonDump() << "nodeID = " << this << ".AddNode( "
<< x << ", " << y << ", " << z << " )";
<< TVar( x ) << ", " << TVar( y ) << ", " << TVar( z )<< " )";
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true ); // issue 0020693
@ -1153,7 +1154,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfE
// Update Python script
TPythonDump() << "isDone = " << this << ".TriToQuad( "
<< IDsOfElements << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
<< IDsOfElements << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
::SMESH_MeshEditor anEditor( myMesh );
@ -1188,7 +1189,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr
// Update Python script
aTPythonDump << "isDone = " << this << ".TriToQuadObject("
<< theObject << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
<< theObject << ", " << aNumericalFunctor << ", " << TVar( MaxAngle ) << " )";
return isDone;
}
@ -1482,7 +1483,7 @@ SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements,
TPythonDump() << "isDone = " << this << "."
<< (IsParametric ? "SmoothParametric( " : "Smooth( ")
<< IDsOfElements << ", " << IDsOfFixedNodes << ", "
<< MaxNbOfIterations << ", " << MaxAspectRatio << ", "
<< TVar( MaxNbOfIterations ) << ", " << TVar( MaxAspectRatio ) << ", "
<< "SMESH.SMESH_MeshEditor."
<< ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
"CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
@ -1517,7 +1518,7 @@ SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr theObjec
aTPythonDump << "isDone = " << this << "."
<< (IsParametric ? "SmoothParametricObject( " : "SmoothObject( ")
<< theObject << ", " << IDsOfFixedNodes << ", "
<< MaxNbOfIterations << ", " << MaxAspectRatio << ", "
<< TVar( MaxNbOfIterations ) << ", " << TVar( MaxAspectRatio ) << ", "
<< "SMESH.SMESH_MeshEditor."
<< ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
"CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
@ -1635,9 +1636,9 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
TPythonDump() << this << ".RotationSweep( "
<< theIDsOfElements << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
rotationSweep(theIDsOfElements,
theAxis,
@ -1672,9 +1673,9 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
aPythonDump << this << ".RotationSweepMakeGroups( "
<< theIDsOfElements << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
return aGroups;
}
@ -1722,9 +1723,9 @@ void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObje
TPythonDump() << this << ".RotationSweepObject1D( "
<< theObject << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
rotationSweep(anElementsId,
@ -1751,9 +1752,9 @@ void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObje
TPythonDump() << this << ".RotationSweepObject2D( "
<< theObject << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
SMESH::long_array_var anElementsId = theObject->GetIDs();
rotationSweep(anElementsId,
@ -1825,9 +1826,9 @@ SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr th
aPythonDump << this << ".RotationSweepObject1DMakeGroups( "
<< theObject << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
return aGroups;
}
@ -1859,9 +1860,9 @@ SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr th
aPythonDump << this << ".RotationSweepObject2DMakeGroups( "
<< theObject << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< theNbOfSteps << ", "
<< theTolerance << " )";
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
<< TVar( theTolerance ) << " )";
}
return aGroups;
}
@ -1940,7 +1941,7 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
if (!myPreviewMode) {
TPythonDump() << this << ".ExtrusionSweep( "
<< theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
<< theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps) << " )";
}
}
@ -1956,7 +1957,7 @@ void SMESH_MeshEditor_i::ExtrusionSweep0D(const SMESH::long_array & theIDsOfElem
extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
if (!myPreviewMode) {
TPythonDump() << this << ".ExtrusionSweep0D( "
<< theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
<< theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps)<< " )";
}
}
@ -1990,7 +1991,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObj
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
if ( !myPreviewMode ) {
TPythonDump() << this << ".ExtrusionSweepObject0D( "
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
<< theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
}
@ -2007,7 +2008,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
if ( !myPreviewMode ) {
TPythonDump() << this << ".ExtrusionSweepObject1D( "
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
<< theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
}
@ -2024,7 +2025,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
if ( !myPreviewMode ) {
TPythonDump() << this << ".ExtrusionSweepObject2D( "
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
<< theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
}
@ -2045,7 +2046,7 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfEl
if (!myPreviewMode) {
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".ExtrusionSweepMakeGroups( " << theIDsOfElements
<< ", " << theStepVector <<", " << theNbOfSteps << " )";
<< ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
}
return aGroups;
}
@ -2067,7 +2068,7 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups0D(const SMESH::long_array& theIDsOf
if (!myPreviewMode) {
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".ExtrusionSweepMakeGroups0D( " << theIDsOfElements
<< ", " << theStepVector <<", " << theNbOfSteps << " )";
<< ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
}
return aGroups;
}
@ -2113,7 +2114,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr t
if (!myPreviewMode) {
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".ExtrusionSweepObject0DMakeGroups( " << theObject
<< ", " << theStepVector << ", " << theNbOfSteps << " )";
<< ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
return aGroups;
}
@ -2136,7 +2137,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
if (!myPreviewMode) {
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( " << theObject
<< ", " << theStepVector << ", " << theNbOfSteps << " )";
<< ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
return aGroups;
}
@ -2159,7 +2160,7 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
if (!myPreviewMode) {
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( " << theObject
<< ", " << theStepVector << ", " << theNbOfSteps << " )";
<< ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
}
return aGroups;
}
@ -2893,13 +2894,13 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
<< Path << ", "
<< NodeStart << ", "
<< HasAngles << ", "
<< Angles << ", "
<< TVar( Angles ) << ", "
<< LinearVariation << ", "
<< HasRefPoint << ", "
<< "SMESH.PointStruct( "
<< ( HasRefPoint ? RefPoint.x : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.y : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
<< TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
<< TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
<< TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
<< MakeGroups << ", "
<< ElemType << " )";
}
@ -2950,13 +2951,13 @@ ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
<< Path << ", "
<< NodeStart << ", "
<< HasAngles << ", "
<< Angles << ", "
<< TVar( Angles ) << ", "
<< LinearVariation << ", "
<< HasRefPoint << ", "
<< "SMESH.PointStruct( "
<< ( HasRefPoint ? RefPoint.x : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.y : 0 ) << ", "
<< ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
<< TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
<< TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
<< TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
<< MakeGroups << ", "
<< ElemType << " )";
}
@ -3638,7 +3639,7 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
TPythonDump() << this << ".Rotate( "
<< theIDsOfElements << ", "
<< theAxis << ", "
<< theAngle << ", "
<< TVar( theAngle ) << ", "
<< theCopy << " )";
}
if (theIDsOfElements.length() > 0)
@ -3663,7 +3664,7 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
TPythonDump() << this << ".RotateObject( "
<< theObject << ", "
<< theAxis << ", "
<< theAngle << ", "
<< TVar( theAngle ) << ", "
<< theCopy << " )";
}
TIDSortedElemSet elements;
@ -3696,7 +3697,7 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
aPythonDump << this << ".RotateMakeGroups( "
<< theIDsOfElements << ", "
<< theAxis << ", "
<< theAngle << " )";
<< TVar( theAngle ) << " )";
}
return aGroups;
}
@ -3723,7 +3724,7 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
aPythonDump << this << ".RotateObjectMakeGroups( "
<< theObject << ", "
<< theAxis << ", "
<< theAngle << " )";
<< TVar( theAngle ) << " )";
}
return aGroups;
}
@ -3763,7 +3764,7 @@ SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
pydump << mesh << " = " << this << ".RotateMakeMesh( "
<< theIDsOfElements << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< TVar( theAngleInRadians ) << ", "
<< theCopyGroups << ", '"
<< theMeshName << "' )";
}
@ -3810,7 +3811,7 @@ SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
<< theObject << ", "
<< theAxis << ", "
<< theAngleInRadians << ", "
<< TVar( theAngleInRadians ) << ", "
<< theCopyGroups << ", '"
<< theMeshName << "' )";
}
@ -3916,9 +3917,8 @@ void SMESH_MeshEditor_i::Scale(SMESH::SMESH_IDSource_ptr theObject,
if ( !myPreviewMode ) {
TPythonDump() << this << ".Scale( "
<< theObject << ", "
<< "SMESH.PointStruct( " << thePoint.x << ", "
<< thePoint.y << ", " << thePoint.z << " ) ,"
<< theScaleFact << ", "
<< thePoint << ", "
<< TVar( theScaleFact ) << ", "
<< theCopy << " )";
}
scale(theObject, thePoint, theScaleFact, theCopy, false);
@ -3942,9 +3942,8 @@ SMESH_MeshEditor_i::ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
DumpGroupsList(aPythonDump, aGroups);
aPythonDump << this << ".Scale("
<< theObject << ","
<< "SMESH.PointStruct(" <<thePoint.x << ","
<< thePoint.y << "," << thePoint.z << "),"
<< theScaleFact << ",True,True)";
<< thePoint << ","
<< TVar( theScaleFact ) << ",True,True)";
}
return aGroups;
}
@ -3979,9 +3978,8 @@ SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
if ( !myPreviewMode )
pydump << mesh << " = " << this << ".ScaleMakeMesh( "
<< theObject << ", "
<< "SMESH.PointStruct( " << thePoint.x << ", "
<< thePoint.y << ", " << thePoint.z << " ) ,"
<< theScaleFact << ", "
<< thePoint << ", "
<< TVar( theScaleFact ) << ", "
<< theCopyGroups << ", '"
<< theMeshName << "' )";
}
@ -4298,7 +4296,7 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
{
// Update Python script
TPythonDump() << "isDone = " << this << ".MoveNode( "
<< NodeID << ", " << x << ", " << y << ", " << z << " )";
<< NodeID << ", " << TVar(x) << ", " << TVar(y) << ", " << TVar(z) << " )";
myMesh->GetMeshDS()->Modified();
myMesh->SetIsModified( true );
}

View File

@ -24,7 +24,6 @@
// File : SMESH_Pattern_i.cxx
// Created : Fri Aug 20 16:15:49 2004
// Author : Edward AGAPOV (eap)
// $Header:
//
#include "SMESH_Pattern_i.hxx"
@ -47,6 +46,7 @@
#include <set>
using SMESH::TPythonDump;
using SMESH::TVar;
//=======================================================================
//function : dumpErrorCode
@ -318,7 +318,7 @@ SMESH::point_array*
// Update Python script
TPythonDump() << "pattern.ApplyToMeshFaces( " << theMesh << ".GetMesh(), "
<< theFacesIDs << ", "
<< theNodeIndexOnKeyPoint1 << ", " << theReverse << " )";
<< TVar( theNodeIndexOnKeyPoint1 ) << ", " << theReverse << " )";
return points._retn();
}
@ -363,7 +363,7 @@ SMESH::point_array*
// Update Python script
TPythonDump() << "pattern.ApplyToHexahedrons( " << theMesh << ".GetMesh(), "
<< theVolumesIDs << ", "
<< theNode000Index << ", " << theNode001Index << " )";
<< TVar(theNode000Index) << ", " << TVar(theNode001Index) << " )";
return points._retn();
}