- ( elemTypes[0] == SMESH::EDGE || elemTypes[0] == SMESH::FACE ))
- elemType = ( SMDSAbs_ElementType ) elemTypes[0];
- }
- prepareIdSource( object );
- SMESH::long_array_var anElementsId = object->GetIDs();
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params, elemType );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionByNormal( " << object
- << ", " << TVar( stepSize )
- << ", " << TVar( nbOfSteps )
- << ", " << byAverageNormal
- << ", " << makeGroups
- << ", " << dim
- << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : AdvancedExtrusion
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance)
- throw (SALOME::SALOME_Exception)
-{
- ExtrusionParams params( theStepVector, theNbOfSteps, false, theExtrFlags, theSewTolerance);
- extrusionSweep( theIDsOfElements, params );
-
- if ( !myIsPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".AdvancedExtrusion("
- << theIDsOfElements
- << ", stepVector, "
- << theNbOfSteps << ","
- << theExtrFlags << ", "
- << theSewTolerance << " )";
- }
-}
-
-//=======================================================================
-//function : AdvancedExtrusionMakeGroups
-//purpose :
-//=======================================================================
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsOfElements,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if (!myIsPreviewMode) {
- TPythonDump() << "stepVector = " << theStepVector;
- }
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- ExtrusionParams params( theStepVector, theNbOfSteps, true, theExtrFlags, theSewTolerance);
- SMESH::ListOfGroups * aGroups = extrusionSweep( theIDsOfElements, params );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".AdvancedExtrusionMakeGroups("
- << theIDsOfElements
- << ", stepVector, "
- << theNbOfSteps << ","
- << theExtrFlags << ", "
- << theSewTolerance << " )";
- }
- return aGroups;
-}
-
-
-//================================================================================
-/*!
- * \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 )
-{
- switch ( e ) {
- RETCASE( EXTR_OK );
- RETCASE( EXTR_NO_ELEMENTS );
- RETCASE( EXTR_PATH_NOT_EDGE );
- RETCASE( EXTR_BAD_PATH_SHAPE );
- RETCASE( EXTR_BAD_STARTING_NODE );
- RETCASE( EXTR_BAD_ANGLES_NUMBER );
- RETCASE( EXTR_CANT_GET_TANGENT );
- }
- return SMESH::SMESH_MeshEditor::EXTR_OK;
-}
-
-
-//=======================================================================
-//function : extrusionAlongPath
-//purpose :
-//=======================================================================
-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,
- const SMDSAbs_ElementType theElementType)
- throw (SALOME::SALOME_Exception)
-{
- SMESH_TRY;
- MESSAGE("extrusionAlongPath");
- initData();
-
- 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 );
-
- TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
- SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
-
- 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 ) {
- theError = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
- return 0;
- }
-
- TIDSortedElemSet elements;
- arrayToSet(theIDsOfElements, getMeshDS(), elements, theElementType);
-
- list<double> angles;
- for (int i = 0; i < theAngles.length(); i++) {
- angles.push_back( theAngles[i] );
- }
-
- gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
-
- int nbOldGroups = myMesh->NbGroup();
-
- ::SMESH_MeshEditor::Extrusion_Error error =
- getEditor().ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
- theHasAngles, angles, false,
- theHasRefPoint, refPnt, theMakeGroups );
-
- declareMeshModified( /*isReComputeSafe=*/true );
- 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;
-
- SMESH_CATCH( SMESH::throwCorbaException );
- return 0;
-}
-
-//=======================================================================
-//function : extrusionAlongPathX
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
- SMESH::SMESH_IDSource_ptr Path,
- CORBA::Long NodeStart,
- CORBA::Boolean HasAngles,
- const SMESH::double_array& Angles,
- CORBA::Boolean LinearVariation,
- CORBA::Boolean HasRefPoint,
- const SMESH::PointStruct& RefPoint,
- bool MakeGroups,
- const SMDSAbs_ElementType ElementType,
- SMESH::SMESH_MeshEditor::Extrusion_Error & Error)
- throw (SALOME::SALOME_Exception)
-{
- SMESH_TRY;
- SMESH::ListOfGroups* EmptyGr = new SMESH::ListOfGroups;
-
- initData();
-
- list<double> angles;
- for (int i = 0; i < Angles.length(); i++) {
- angles.push_back( Angles[i] );
- }
- gp_Pnt refPnt( RefPoint.x, RefPoint.y, RefPoint.z );
- int nbOldGroups = myMesh->NbGroup();
-
- if ( Path->_is_nil() ) {
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return EmptyGr;