}
}
};
+
+ TCollection_AsciiString mirrorTypeName( SMESH::SMESH_MeshEditor::MirrorType theMirrorType )
+ {
+ TCollection_AsciiString typeStr;
+ 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";
+ }
+ return typeStr;
+ }
}
//=============================================================================
*/
//=============================================================================
-SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh* theMesh, bool isPreview)
+SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh_i* theMesh, bool isPreview)
{
- myMesh = theMesh;
+ myMesh_i = theMesh;
+ myMesh = & theMesh->GetImpl();
myPreviewMode = isPreview;
}
bool stat = aMeshEditor.DeleteDiag ( n1, n2 );
- StoreResult(aMeshEditor);
+ storeResult(aMeshEditor);
return stat;
}
*/
//================================================================================
- void ToMap(const SMESH::long_array & IDs,
- const SMESHDS_Mesh* aMesh,
- TIDSortedElemSet& aMap,
- const SMDSAbs_ElementType aType = SMDSAbs_All )
+ void arrayToSet(const SMESH::long_array & IDs,
+ const SMESHDS_Mesh* aMesh,
+ TIDSortedElemSet& aMap,
+ const SMDSAbs_ElementType aType = SMDSAbs_All )
{
for (int i=0; i<IDs.length(); i++) {
CORBA::Long ind = IDs[i];
SMESHDS_Mesh* aMesh = GetMeshDS();
TIDSortedElemSet faces;
- ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
+ arrayToSet(IDsOfElements, aMesh, faces, SMDSAbs_Face);
SMESH::NumericalFunctor_i* aNumericalFunctor =
dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
bool stat = anEditor.TriToQuad( faces, aCrit, MaxAngle );
- StoreResult(anEditor);
+ storeResult(anEditor);
return stat;
}
SMESHDS_Mesh* aMesh = GetMeshDS();
TIDSortedElemSet faces;
- ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
+ arrayToSet(IDsOfElements, aMesh, faces, SMDSAbs_Face);
SMESH::NumericalFunctor_i* aNumericalFunctor =
dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
::SMESH_MeshEditor anEditor( myMesh );
CORBA::Boolean stat = anEditor.QuadToTri( faces, aCrit );
- StoreResult(anEditor);
+ storeResult(anEditor);
return stat;
}
SMESHDS_Mesh* aMesh = GetMeshDS();
TIDSortedElemSet faces;
- ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
+ arrayToSet(IDsOfElements, aMesh, faces, SMDSAbs_Face);
// Update Python script
TPythonDump() << "isDone = " << this << ".SplitQuad( "
::SMESH_MeshEditor anEditor( myMesh );
CORBA::Boolean stat = anEditor.QuadToTri( faces, Diag13 );
- StoreResult(anEditor);
+ storeResult(anEditor);
return stat;
}
SMESHDS_Mesh* aMesh = GetMeshDS();
TIDSortedElemSet elements;
- ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
+ arrayToSet(IDsOfElements, aMesh, elements, SMDSAbs_Face);
set<const SMDS_MeshNode*> fixedNodes;
for (int i = 0; i < IDsOfFixedNodes.length(); i++) {
anEditor.Smooth(elements, fixedNodes, method,
MaxNbOfIterations, MaxAspectRatio, IsParametric );
- StoreResult(anEditor);
+ storeResult(anEditor);
// Update Python script
TPythonDump() << "isDone = " << this << "."
GetMeshDS()->Renumber( false );
}
+//=======================================================================
+ /*!
+ * \brief Return groups by their IDs
+ */
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::getGroups(const std::list<int>* groupIDs)
+{
+ if ( !groupIDs )
+ return 0;
+ myMesh_i->CreateGroupServants();
+ return myMesh_i->GetGroups( *groupIDs );
+}
//=======================================================================
-//function : RotationSweep
-//purpose :
+//function : rotationSweep
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance,
+ const bool theMakeGroups)
{
initData();
TIDSortedElemSet inElements, copyElements;
- ToMap(theIDsOfElements, GetMeshDS(), inElements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), inElements);
TIDSortedElemSet* workElements = & inElements;
TPreviewMesh tmpMesh( SMDSAbs_Face );
gp_Vec( theAxis.vx, theAxis.vy, theAxis.vz ));
::SMESH_MeshEditor anEditor( mesh );
- anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
- theNbOfSteps, theTolerance, makeWalls);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.RotationSweep (*workElements, Ax1, theAngleInRadians,
+ theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
+ storeResult(anEditor);
- StoreResult(anEditor);
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+}
+
+//=======================================================================
+//function : RotationSweep
+//purpose :
+//=======================================================================
+void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
if ( !myPreviewMode ) {
- // Update Python script
TPythonDump() << "axis = " << theAxis;
TPythonDump() << this << ".RotationSweep( "
<< theIDsOfElements
<< theNbOfSteps << ", "
<< theTolerance << " )";
}
+ rotationSweep(theIDsOfElements,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false);
+}
+
+//=======================================================================
+//function : RotationSweepMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotationSweepMakeGroups( "
+ << theIDsOfElements
+ << ", axis, "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ return rotationSweep(theIDsOfElements,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true);
}
//=======================================================================
CORBA::Long theNbOfSteps,
CORBA::Double theTolerance)
{
- initData();
-
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotationSweepObject( "
+ << theObject
+ << ", axis, "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
SMESH::long_array_var anElementsId = theObject->GetIDs();
- RotationSweep(anElementsId, theAxis, theAngleInRadians, theNbOfSteps, theTolerance);
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false);
+}
- // Clear python line, created by RotationSweep()
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+//=======================================================================
+//function : RotationSweepObjectMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TPythonDump() << this << ".RotationSweepObject( "
- << theObject
- << ", axis, "
- << theAngleInRadians << ", "
- << theNbOfSteps << ", "
- << theTolerance << " )";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotationSweepObjectMakeGroups( "
+ << theObject
+ << ", axis, "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true);
}
+
//=======================================================================
-//function : ExtrusionSweep
-//purpose :
+//function : extrusionSweep
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ const bool theMakeGroups,
+ const SMDSAbs_ElementType theElementType)
{
initData();
#else
CASCatch_TRY {
#endif
- SMESHDS_Mesh* aMesh = GetMeshDS();
-
TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
const SMESH::PointStruct * P = &theStepVector.PS;
gp_Vec stepVec( P->x, P->y, P->z );
TElemOfElemListMap aHystory;
::SMESH_MeshEditor anEditor( myMesh );
- anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
- StoreResult(anEditor);
+ storeResult(anEditor);
- // Update Python script
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".ExtrusionSweep( "
- << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
#ifdef NO_CAS_CATCH
} catch(Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
INFOS( "SMESH_MeshEditor_i::ExtrusionSweep fails - "<< aFail->GetMessageString() );
}
+ return 0;
+}
+
+//=======================================================================
+//function : ExtrusionSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweep( "
+ << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+ }
}
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps)
{
- initData();
-
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
- TPythonDump() << this << ".ExtrusionSweepObject( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObject( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
}
//=======================================================================
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps)
{
- initData();
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObject1D( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
+}
- SMESHDS_Mesh* aMesh = GetMeshDS();
+//=======================================================================
+//function : ExtrusionSweepObject2D
+//purpose :
+//=======================================================================
- SMESH::long_array_var allElementsId = theObject->GetIDs();
+void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObject2D( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
+}
- TIDSortedElemSet elements;
- ToMap(allElementsId, aMesh, elements);
+//=======================================================================
+//function : ExtrusionSweepMakeGroups
+//purpose :
+//=======================================================================
- const SMESH::PointStruct * P = &theStepVector.PS;
- gp_Vec stepVec( P->x, P->y, P->z );
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepMakeGroups( "
+ << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
+ }
+ return extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
+}
+//=======================================================================
+//function : ExtrusionSweepObjectMakeGroups
+//purpose :
+//=======================================================================
- ::SMESH_MeshEditor anEditor( myMesh );
- //anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
- TElemOfElemListMap aHystory;
- anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObjectMakeGroups( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
+}
- StoreResult(anEditor);
+//=======================================================================
+//function : ExtrusionSweepObject1DMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".ExtrusionSweepObject1D( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObject1DMakeGroups( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
}
//=======================================================================
-//function : ExtrusionSweepObject2D
-//purpose :
+//function : ExtrusionSweepObject2DMakeGroups
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
{
- initData();
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".ExtrusionSweepObject2DMakeGroups( "
+ << theObject << ", stepVector, " << theNbOfSteps << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
+}
- SMESHDS_Mesh* aMesh = GetMeshDS();
- SMESH::long_array_var allElementsId = theObject->GetIDs();
+//=======================================================================
+//function : advancedExtrusion
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::advancedExtrusion(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Long theExtrFlags,
+ CORBA::Double theSewTolerance,
+ const bool theMakeGroups)
+{
+ initData();
TIDSortedElemSet elements;
- ToMap(allElementsId, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements);
const SMESH::PointStruct * P = &theStepVector.PS;
gp_Vec stepVec( P->x, P->y, P->z );
::SMESH_MeshEditor anEditor( myMesh );
- //anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
TElemOfElemListMap aHystory;
- anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
+ theMakeGroups, theExtrFlags, theSewTolerance);
+ storeResult(anEditor);
- StoreResult(anEditor);
-
- // Update Python script
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".ExtrusionSweepObject2D( "
- << theObject << ", stepVector, " << theNbOfSteps << " )";
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
}
-
//=======================================================================
//function : AdvancedExtrusion
//purpose :
CORBA::Long theExtrFlags,
CORBA::Double theSewTolerance)
{
- initData();
-
- SMESHDS_Mesh* aMesh = GetMeshDS();
-
- TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
-
- const SMESH::PointStruct * P = &theStepVector.PS;
- gp_Vec stepVec( P->x, P->y, P->z );
-
- ::SMESH_MeshEditor anEditor( myMesh );
- TElemOfElemListMap aHystory;
- anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
- theExtrFlags, theSewTolerance);
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".AdvancedExtrusion("
+ << theIDsOfElements
+ << ", stepVector, "
+ << theNbOfSteps << ","
+ << theExtrFlags << ", "
+ << theSewTolerance << " )";
+ }
+ advancedExtrusion( theIDsOfElements,
+ theStepVector,
+ theNbOfSteps,
+ theExtrFlags,
+ theSewTolerance,
+ false);
+}
- StoreResult(anEditor);
+//=======================================================================
+//function : AdvancedExtrusionMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".AdvancedExtrusion("
- << theIDsOfElements
- << ", stepVector, "
- << theNbOfSteps << ","
- << theExtrFlags << ", "
- << theSewTolerance << " )";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Long theExtrFlags,
+ CORBA::Double theSewTolerance)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".AdvancedExtrusionMakeGroups("
+ << theIDsOfElements
+ << ", stepVector, "
+ << theNbOfSteps << ","
+ << theExtrFlags << ", "
+ << theSewTolerance << " )";
+ }
+ return advancedExtrusion( theIDsOfElements,
+ theStepVector,
+ theNbOfSteps,
+ theExtrFlags,
+ theSewTolerance,
+ true);
}
+//================================================================================
+/*!
+ * \brief Convert extrusion error to IDL enum
+ */
+//================================================================================
+
#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e )
return SMESH::SMESH_MeshEditor::EXTR_OK;
}
+
//=======================================================================
-//function : ExtrusionAlongPath
-//purpose :
+//function : extrusionAlongPath
+//purpose :
//=======================================================================
-SMESH::SMESH_MeshEditor::Extrusion_Error
- SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfElements,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint,
+ const bool theMakeGroups,
+ SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
{
initData();
- SMESHDS_Mesh* aMesh = GetMeshDS();
-
- if ( thePathMesh->_is_nil() || thePathShape->_is_nil() )
- return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) {
+ theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ return 0;
+ }
+ SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathMesh );
- SMESH_Mesh_i* aMeshImp = dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( thePathMesh ).in() );
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
- if ( !aSubMesh || !aSubMesh->GetSubMeshDS())
- return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ if ( !aSubMesh || !aSubMesh->GetSubMeshDS()) {
+ theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ return 0;
+ }
SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
- if ( !nodeStart )
- return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
+ if ( !nodeStart ) {
+ theError = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
+ return 0;
+ }
TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements);
list<double> angles;
for (int i = 0; i < theAngles.length(); i++) {
gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
- // Update Python script
- TPythonDump() << "rotAngles = " << theAngles;
-
- if ( theHasRefPoint )
- TPythonDump() << "refPoint = SMESH.PointStruct( "
- << refPnt.X() << ", "
- << refPnt.Y() << ", "
- << refPnt.Z() << " )";
- else
- TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
-
- TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
- << theIDsOfElements << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << "rotAngles" << ", "
- << theHasRefPoint << ", refPoint )";
+ int nbOldGroups = myMesh->NbGroup();
::SMESH_MeshEditor anEditor( myMesh );
- SMESH::SMESH_MeshEditor::Extrusion_Error error =
- convExtrError( anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
- theHasAngles, angles,
- theHasRefPoint, refPnt ) );
+ ::SMESH_MeshEditor::Extrusion_Error error =
+ anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
+ theHasAngles, angles,
+ theHasRefPoint, refPnt, theMakeGroups );
+ storeResult(anEditor);
+ theError = convExtrError( error );
+
+ if ( theMakeGroups ) {
+ list<int> groupIDs = myMesh->GetGroupIds();
+ list<int>::iterator newBegin = groupIDs.begin();
+ std::advance( newBegin, nbOldGroups ); // skip old groups
+ groupIDs.erase( groupIDs.begin(), newBegin );
+ return getGroups( & groupIDs );
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPath
+//purpose :
+//=======================================================================
- StoreResult(anEditor);
+SMESH::SMESH_MeshEditor::Extrusion_Error
+ SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "rotAngles = " << theAngles;
- return error;
+ if ( theHasRefPoint )
+ TPythonDump() << "refPoint = SMESH.PointStruct( "
+ << theRefPoint.x << ", "
+ << theRefPoint.y << ", "
+ << theRefPoint.z << " )";
+ else
+ TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
+
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
+ << theIDsOfElements << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << "rotAngles" << ", "
+ << theHasRefPoint << ", refPoint )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ extrusionAlongPath( theIDsOfElements,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError);
+ return anError;
}
//=======================================================================
CORBA::Boolean theHasRefPoint,
const SMESH::PointStruct & theRefPoint)
{
- initData();
+ if ( !myPreviewMode ) {
+ TPythonDump() << "rotAngles = " << theAngles;
+ if ( theHasRefPoint )
+ TPythonDump() << "refPoint = SMESH.PointStruct( "
+ << theRefPoint.x << ", "
+ << theRefPoint.y << ", "
+ << theRefPoint.z << " )";
+ else
+ TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
+
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << "rotAngles" << ", "
+ << theHasRefPoint << ", refPoint )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::SMESH_MeshEditor::Extrusion_Error error = ExtrusionAlongPath
- (anElementsId, thePathMesh, thePathShape, theNodeStart,
- theHasAngles, theAngles, theHasRefPoint, theRefPoint);
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError);
+ return anError;
+}
- // Clear python line, created by ExtrusionAlongPath()
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
- // Update Python script
- TPythonDump() << "rotAngles = " << theAngles;
- TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << "rotAngles" << ", "
- << theHasRefPoint<<", refPoint )";
+//=======================================================================
+//function : ExtrusionAlongPathMakeGroups
+//purpose :
+//=======================================================================
- return error;
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theIDsOfElements,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "rotAngles = " << theAngles;
+
+ if ( theHasRefPoint )
+ TPythonDump() << "refPoint = SMESH.PointStruct( "
+ << theRefPoint.x << ", "
+ << theRefPoint.y << ", "
+ << theRefPoint.z << " )";
+ else
+ TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
+
+ TPythonDump() << "groups = " << this << ".ExtrusionAlongPathMakeGroups( "
+ << theIDsOfElements << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << "rotAngles" << ", "
+ << theHasRefPoint << ", refPoint )";
+ }
+ return extrusionAlongPath( theIDsOfElements,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error);
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array& theAngles,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct& theRefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "rotAngles = " << theAngles;
+
+ if ( theHasRefPoint )
+ TPythonDump() << "refPoint = SMESH.PointStruct( "
+ << theRefPoint.x << ", "
+ << theRefPoint.y << ", "
+ << theRefPoint.z << " )";
+ else
+ TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
+
+ TPythonDump() << "groups = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << "rotAngles" << ", "
+ << theHasRefPoint << ", refPoint )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error);
}
//================================================================================
return aResult._retn();
}
+
//=======================================================================
-//function : Mirror
-//purpose :
+//function : mirror
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElements,
- const SMESH::AxisStruct & theAxis,
- SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
- CORBA::Boolean theCopy)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::mirror(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy,
+ const bool theMakeGroups)
{
initData();
- SMESHDS_Mesh* aMesh = GetMeshDS();
-
TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements);
gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
gp_Trsf aTrsf;
- TCollection_AsciiString typeStr;
switch ( theMirrorType ) {
case SMESH::SMESH_MeshEditor::POINT:
aTrsf.SetMirror( P );
- typeStr = "SMESH.SMESH_MeshEditor.POINT";
break;
case SMESH::SMESH_MeshEditor::AXIS:
aTrsf.SetMirror( gp_Ax1( P, V ));
- typeStr = "SMESH.SMESH_MeshEditor.AXIS";
break;
default:
aTrsf.SetMirror( gp_Ax2( P, V ));
- typeStr = "SMESH.SMESH_MeshEditor.PLANE";
}
- // Update Python script
- TPythonDump() << this << ".Mirror( "
- << theIDsOfElements << ", "
- << theAxis << ", "
- << typeStr << ", "
- << theCopy << " )";
-
::SMESH_MeshEditor anEditor( myMesh );
- anEditor.Transform (elements, aTrsf, theCopy);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
if(theCopy) {
- StoreResult(anEditor);
+ storeResult(anEditor);
+ }
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+}
+
+//=======================================================================
+//function : Mirror
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".Mirror( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopy << " )";
}
+ mirror(theIDsOfElements, theAxis, theMirrorType, theCopy, false);
}
SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
CORBA::Boolean theCopy)
{
- initData();
-
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".MirrorObject( "
+ << theObject << ", "
+ << theAxis << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopy << " )";
+ }
SMESH::long_array_var anElementsId = theObject->GetIDs();
- Mirror(anElementsId, theAxis, theMirrorType, theCopy);
+ mirror(anElementsId, theAxis, theMirrorType, theCopy, false);
+}
- // Clear python line, created by Mirror()
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+//=======================================================================
+//function : MirrorMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TCollection_AsciiString typeStr;
- 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";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".MirrorMakeGroups( "
+ << theIDsOfElements << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << " )";
}
- TPythonDump() << "axis = " << theAxis;
- TPythonDump() << this << ".MirrorObject( "
- << theObject << ", "
- << "axis, "
- << typeStr << ", "
- << theCopy << " )";
+ return mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
}
//=======================================================================
-//function : Translate
-//purpose :
+//function : MirrorObjectMakeGroups
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theVector,
- CORBA::Boolean theCopy)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
{
- initData();
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".MirrorObjectMakeGroups( "
+ << theObject << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return mirror(anElementsId, theMirror, theMirrorType, true, true);
+}
- SMESHDS_Mesh* aMesh = GetMeshDS();
+
+//=======================================================================
+//function : translate
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::translate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy,
+ const bool theMakeGroups)
+{
+ initData();
TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements);
gp_Trsf aTrsf;
const SMESH::PointStruct * P = &theVector.PS;
aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
::SMESH_MeshEditor anEditor( myMesh );
- anEditor.Transform (elements, aTrsf, theCopy);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
- if(theCopy) {
- StoreResult(anEditor);
- }
+ if(theCopy)
+ storeResult(anEditor);
- // Update Python script
- TPythonDump() << "vector = " << theVector;
- TPythonDump() << this << ".Translate( "
- << theIDsOfElements
- << ", vector, "
- << theCopy << " )";
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+}
+
+//=======================================================================
+//function : Translate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "vector = " << theVector;
+ TPythonDump() << this << ".Translate( "
+ << theIDsOfElements
+ << ", vector, "
+ << theCopy << " )";
+ }
+ translate(theIDsOfElements,
+ theVector,
+ theCopy,
+ false);
}
//=======================================================================
const SMESH::DirStruct & theVector,
CORBA::Boolean theCopy)
{
- initData();
-
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".TranslateObject( "
+ << theObject
+ << ", vector, "
+ << theCopy << " )";
+ }
SMESH::long_array_var anElementsId = theObject->GetIDs();
- Translate(anElementsId, theVector, theCopy);
+ translate(anElementsId,
+ theVector,
+ theCopy,
+ false);
+}
- // Clear python line, created by Translate()
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+//=======================================================================
+//function : TranslateMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TPythonDump() << this << ".TranslateObject( "
- << theObject
- << ", vector, "
- << theCopy << " )";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theVector)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "vector = " << theVector;
+ TPythonDump() << this << ".TranslateMakeGroups( "
+ << theIDsOfElements
+ << ", vector )";
+ }
+ return translate(theIDsOfElements,theVector,true,true);
}
//=======================================================================
-//function : Rotate
-//purpose :
+//function : TranslateObjectMakeGroups
+//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngle,
- CORBA::Boolean theCopy)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theVector)
{
- initData();
+ if ( !myPreviewMode ) {
+ TPythonDump() << this << ".TranslateObjectMakeGroups( "
+ << theObject
+ << ", vector )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return translate(anElementsId, theVector, true, true);
+}
- SMESHDS_Mesh* aMesh = GetMeshDS();
+//=======================================================================
+//function : rotate
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::rotate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy,
+ const bool theMakeGroups)
+{
+ initData();
TIDSortedElemSet elements;
- ToMap(theIDsOfElements, aMesh, elements);
+ arrayToSet(theIDsOfElements, GetMeshDS(), elements);
gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
::SMESH_MeshEditor anEditor( myMesh );
- anEditor.Transform (elements, aTrsf, theCopy);
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
if(theCopy) {
- StoreResult(anEditor);
+ storeResult(anEditor);
}
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+}
- // Update Python script
- TPythonDump() << "axis = " << theAxis;
- TPythonDump() << this << ".Rotate( "
- << theIDsOfElements
- << ", axis, "
- << theAngle << ", "
- << theCopy << " )";
+//=======================================================================
+//function : Rotate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".Rotate( "
+ << theIDsOfElements
+ << ", axis, "
+ << theAngle << ", "
+ << theCopy << " )";
+ }
+ rotate(theIDsOfElements,
+ theAxis,
+ theAngle,
+ theCopy,
+ false);
}
//=======================================================================
CORBA::Double theAngle,
CORBA::Boolean theCopy)
{
- initData();
-
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotateObject( "
+ << theObject
+ << ", axis, "
+ << theAngle << ", "
+ << theCopy << " )";
+ }
SMESH::long_array_var anElementsId = theObject->GetIDs();
- Rotate(anElementsId, theAxis, theAngle, theCopy);
+ rotate(anElementsId,
+ theAxis,
+ theAngle,
+ theCopy,
+ false);
+}
- // Clear python line, created by Rotate()
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+//=======================================================================
+//function : RotateMakeGroups
+//purpose :
+//=======================================================================
- // Update Python script
- TPythonDump() << this << ".RotateObject( "
- << theObject
- << ", axis, "
- << theAngle << ", "
- << theCopy << " )";
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngle)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotateMakeGroups( "
+ << theIDsOfElements
+ << ", axis, "
+ << theAngle << " )";
+ }
+ return rotate(theIDsOfElements,theAxis,theAngle,true,true);
+}
+
+//=======================================================================
+//function : RotateObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngle)
+{
+ if ( !myPreviewMode ) {
+ TPythonDump() << "axis = " << theAxis;
+ TPythonDump() << this << ".RotateObjectMakeGroups( "
+ << theObject
+ << ", axis, "
+ << theAngle << " )";
+ }
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ return rotate(anElementsId,theAxis,theAngle,true,true);
}
//=======================================================================
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ ) {
list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
- SMESH::long_array& aGroup = (*GroupsOfNodes)[i];
+ SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
aGroup.length( aListOfNodes.size() );
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
aGroup[ j ] = (*lIt)->GetID();
}
- // Update Python script
TPythonDump() << "coincident_nodes = " << this << ".FindCoincidentNodes( "
<< Tolerance << " )";
}
for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ ) {
list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
- SMESH::long_array& aGroup = (*GroupsOfNodes)[i];
+ SMESH::long_array& aGroup = (*GroupsOfNodes)[ i ];
aGroup.length( aListOfNodes.size() );
for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
aGroup[ j ] = (*lIt)->GetID();
}
- // Update Python script
TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPart( "
<<theObject<<", "
<< Tolerance << " )";
::SMESH_MeshEditor anEditor( myMesh );
anEditor.MergeNodes( aListOfListOfNodes );
- // Update Python script
aTPythonDump << "])";
}
}
}
- // Update Python script
TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
<<theObject<<" )";
}
::SMESH_MeshEditor anEditor( myMesh );
anEditor.MergeElements(aListOfListOfElementsID);
- // Update Python script
aTPythonDump << "] )";
}
::SMESH_MeshEditor anEditor( myMesh );
anEditor.MergeEqualElements();
- // Update Python script
TPythonDump() << this << ".MergeEqualElements()";
}
tmpMesh.GetMeshDS()->MoveNode(node, x, y, z);
// fill preview data
::SMESH_MeshEditor anEditor( & tmpMesh );
- StoreResult( anEditor );
+ storeResult( anEditor );
}
else
{
}
if ( !myPreviewMode ) {
- // Update Python script
TPythonDump() << "nodeID = " << this
<< ".MoveClosestNodeToPoint( "<< x << ", " << y << ", " << z << " )";
}
!aSide2ThirdNode)
return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
- // Update Python script
TPythonDump() << "error = " << this << ".SewFreeBorders( "
<< FirstNodeID1 << ", "
<< SecondNodeID1 << ", "
CreatePolygons,
CreatePolyedrs) );
- StoreResult(anEditor);
+ storeResult(anEditor);
return error;
}
!aSide2SecondNode)
return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
- // Update Python script
TPythonDump() << "error = " << this << ".SewConformFreeBorders( "
<< FirstNodeID1 << ", "
<< SecondNodeID1 << ", "
true,
false, false) );
- StoreResult(anEditor);
+ storeResult(anEditor);
return error;
}
!aSide2SecondNode)
return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE_NODES;
- // Update Python script
TPythonDump() << "error = " << this << ".SewBorderToSide( "
<< FirstNodeIDOnFreeBorder << ", "
<< SecondNodeIDOnFreeBorder << ", "
CreatePolygons,
CreatePolyedrs) );
- StoreResult(anEditor);
+ storeResult(anEditor);
return error;
}
return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE2_NODES;
TIDSortedElemSet aSide1Elems, aSide2Elems;
- ToMap(IDsOfSide1Elements, aMesh, aSide1Elems);
- ToMap(IDsOfSide2Elements, aMesh, aSide2Elems);
+ arrayToSet(IDsOfSide1Elements, aMesh, aSide1Elems);
+ arrayToSet(IDsOfSide2Elements, aMesh, aSide2Elems);
- // Update Python script
TPythonDump() << "error = " << this << ".SewSideElements( "
<< IDsOfSide1Elements << ", "
<< IDsOfSide2Elements << ", "
aSecondNode1ToMerge,
aSecondNode2ToMerge));
- StoreResult(anEditor);
+ storeResult(anEditor);
return error;
}
int nbn = newIDs.length();
int i=0;
- vector<const SMDS_MeshNode*> aNodes (nbn);
+ vector<const SMDS_MeshNode*> aNodes(nbn);
int nbn1=-1;
for(; i<nbn; i++) {
const SMDS_MeshNode* aNode = GetMeshDS()->FindNode(newIDs[i]);
aNodes[nbn1] = aNode;
}
}
- // Update Python script
TPythonDump() << "isDone = " << this << ".ChangeElemNodes( "
<< ide << ", " << newIDs << " )";
#ifdef _DEBUG_
TPythonDump() << "print 'ChangeElemNodes: ', isDone";
#endif
- return GetMeshDS()->ChangeElementNodes( elem, &aNodes[0], nbn1+1 );
+ return GetMeshDS()->ChangeElementNodes( elem, & aNodes[0], nbn1+1 );
}
//================================================================================
*/
//================================================================================
-void SMESH_MeshEditor_i::StoreResult(::SMESH_MeshEditor& anEditor)
+void SMESH_MeshEditor_i::storeResult(::SMESH_MeshEditor& anEditor)
{
if ( myPreviewMode ) { // --- MeshPreviewStruct filling ---
{
::SMESH_MeshEditor anEditor( myMesh );
anEditor.ConvertToQuadratic(theForce3d);
- // Update Python script
TPythonDump() << this << ".ConvertToQuadratic( " << theForce3d << " )";
}
//=======================================================================
//function : ConvertFromQuadratic
-//purpose :
+//purpose :
//=======================================================================
CORBA::Boolean SMESH_MeshEditor_i::ConvertFromQuadratic()
{
::SMESH_MeshEditor anEditor( myMesh );
CORBA::Boolean isDone = anEditor.ConvertFromQuadratic();
- // Update Python script
TPythonDump() << this << ".ConvertFromQuadratic()";
return isDone;
}
#include "SMESH_Mesh.hxx"
+#include <list>
+
class SMESH_MeshEditor;
+class SMESH_Mesh_i;
-class SMESH_I_EXPORT SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
+class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
{
public:
- SMESH_MeshEditor_i(SMESH_Mesh * theMesh, bool isPreview);
+ SMESH_MeshEditor_i(SMESH_Mesh_i * theMesh, bool isPreview);
virtual ~ SMESH_MeshEditor_i();
CORBA::Double Angle,
CORBA::Boolean Copy);
+ SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
+ SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Axix,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance);
+ SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::DirStruct& StepVector,
+ CORBA::Long NbOfSteps);
+ SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::DirStruct& StepVector,
+ CORBA::Long NbOfSteps,
+ CORBA::Long ExtrFlags,
+ CORBA::Double SewTolerance);
+ SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::DirStruct& StepVector,
+ CORBA::Long NbOfSteps);
+ SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::DirStruct& StepVector,
+ CORBA::Long NbOfSteps);
+ SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::DirStruct& StepVector,
+ CORBA::Long NbOfSteps);
+ SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array& Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct& RefPoint,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
+ SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::AxisStruct& Mirror,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType);
+ SMESH::ListOfGroups* MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Mirror,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType);
+ SMESH::ListOfGroups* TranslateMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::DirStruct& Vector);
+ SMESH::ListOfGroups* TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::DirStruct& Vector);
+ SMESH::ListOfGroups* RotateMakeGroups(const SMESH::long_array& IDsOfElements,
+ const SMESH::AxisStruct& Axis,
+ CORBA::Double AngleInRadians);
+ SMESH::ListOfGroups* RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Axis,
+ CORBA::Double AngleInRadians);
+
void FindCoincidentNodes (CORBA::Double Tolerance,
SMESH::array_of_long_array_out GroupsOfNodes);
- void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr theObject,
+ void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
CORBA::Double Tolerance,
SMESH::array_of_long_array_out GroupsOfNodes);
void MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes);
- void FindEqualElements(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::array_of_long_array_out GroupsOfElementsID);
+ void FindEqualElements(SMESH::SMESH_IDSource_ptr Object,
+ SMESH::array_of_long_array_out GroupsOfElementsID);
void MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID);
void MergeEqualElements();
CORBA::Long MoveClosestNodeToPoint(CORBA::Double x,
SMESH::SMESH_MeshEditor::Sew_Error
- SewFreeBorders(CORBA::Long FirstNodeID1,
- CORBA::Long SecondNodeID1,
- CORBA::Long LastNodeID1,
- CORBA::Long FirstNodeID2,
- CORBA::Long SecondNodeID2,
- CORBA::Long LastNodeID2,
- CORBA::Boolean CreatePolygons,
- CORBA::Boolean CreatePolyedrs);
+ SewFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2,
+ CORBA::Long LastNodeID2,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs);
SMESH::SMESH_MeshEditor::Sew_Error
- SewConformFreeBorders(CORBA::Long FirstNodeID1,
- CORBA::Long SecondNodeID1,
- CORBA::Long LastNodeID1,
- CORBA::Long FirstNodeID2,
- CORBA::Long SecondNodeID2);
+ SewConformFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2);
SMESH::SMESH_MeshEditor::Sew_Error
- SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
- CORBA::Long SecondNodeIDOnFreeBorder,
- CORBA::Long LastNodeIDOnFreeBorder,
- CORBA::Long FirstNodeIDOnSide,
- CORBA::Long LastNodeIDOnSide,
- CORBA::Boolean CreatePolygons,
- CORBA::Boolean CreatePolyedrs);
+ SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
+ CORBA::Long SecondNodeIDOnFreeBorder,
+ CORBA::Long LastNodeIDOnFreeBorder,
+ CORBA::Long FirstNodeIDOnSide,
+ CORBA::Long LastNodeIDOnSide,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs);
SMESH::SMESH_MeshEditor::Sew_Error
- SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
- const SMESH::long_array& IDsOfSide2Elements,
- CORBA::Long NodeID1OfSide1ToMerge,
- CORBA::Long NodeID1OfSide2ToMerge,
- CORBA::Long NodeID2OfSide1ToMerge,
- CORBA::Long NodeID2OfSide2ToMerge);
+ SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
+ const SMESH::long_array& IDsOfSide2Elements,
+ CORBA::Long NodeID1OfSide1ToMerge,
+ CORBA::Long NodeID1OfSide2ToMerge,
+ CORBA::Long NodeID2OfSide1ToMerge,
+ CORBA::Long NodeID2OfSide2ToMerge);
/*!
* Set new nodes for given element.
*/
SMESH::long_array* GetLastCreatedElems();
- //
- // Internal methods
- //
-
- /*!
- * \brief Update myLastCreated* or myPreviewData
- * \param anEditor - it contains edition results
- */
- void StoreResult(::SMESH_MeshEditor& anEditor);
-
/*!
* \brief Return edited mesh ID
* \retval int - mesh ID
*/
int GetMeshId() const { return myMesh->GetId(); }
- private:
+
+private: //!< private methods
SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
+
+ /*!
+ * \brief Update myLastCreated* or myPreviewData
+ * \param anEditor - it contains edition results
+ */
+ void storeResult(::SMESH_MeshEditor& anEditor);
+ /*!
+ * \brief Clear myLastCreated* or myPreviewData
+ */
void initData();
+ /*!
+ * \brief Return groups by their IDs
+ */
+ SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs);
+
+ SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Long NbOfSteps,
+ CORBA::Double Tolerance,
+ const bool MakeGroups);
+ SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
+ const SMESH::DirStruct & StepVector,
+ CORBA::Long NbOfSteps,
+ const bool MakeGroups,
+ const SMDSAbs_ElementType ElementType=SMDSAbs_All);
+ SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Long theExtrFlags,
+ CORBA::Double theSewTolerance,
+ const bool MakeGroups);
+ SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
+ SMESH::SMESH_Mesh_ptr PathMesh,
+ GEOM::GEOM_Object_ptr PathShape,
+ CORBA::Long NodeStart,
+ CORBA::Boolean HasAngles,
+ const SMESH::double_array & Angles,
+ CORBA::Boolean HasRefPoint,
+ const SMESH::PointStruct & RefPoint,
+ const bool MakeGroups,
+ SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
+ SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+ CORBA::Boolean Copy,
+ const bool MakeGroups);
+ SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
+ const SMESH::DirStruct & Vector,
+ CORBA::Boolean Copy,
+ const bool MakeGroups);
+ SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
+ const SMESH::AxisStruct & Axis,
+ CORBA::Double Angle,
+ CORBA::Boolean Copy,
+ const bool MakeGroups);
+
+private: //!< fields
+
+ SMESH_Mesh_i* myMesh_i;
SMESH_Mesh * myMesh;
SMESH::long_array_var myLastCreatedElems;