+//=======================================================================
+//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)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups *aGroups = rotationSweep(theIDsOfElements,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotationSweepMakeGroups( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << TVar( theTolerance ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".RotationSweepObject( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false);
+}
+
+//=======================================================================
+//function : RotationSweepObject1D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".RotationSweepObject1D( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << TVar( theTolerance ) << " )";
+ }
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false,
+ SMDSAbs_Edge);
+}
+
+//=======================================================================
+//function : RotationSweepObject2D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".RotationSweepObject2D( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << TVar( theTolerance ) << " )";
+ }
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ false,
+ SMDSAbs_Face);
+}
+
+//=======================================================================
+//function : RotationSweepObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotationSweepObjectMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theNbOfSteps << ", "
+ << theTolerance << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject1DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true,
+ SMDSAbs_Edge);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotationSweepObject1DMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << TVar( theTolerance ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotationSweepObject2DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
+ theAxis,
+ theAngleInRadians,
+ theNbOfSteps,
+ theTolerance,
+ true,
+ SMDSAbs_Face);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotationSweepObject2DMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << TVar( theTolerance ) << " )";
+ }
+ return aGroups;
+}
+
+
+//=======================================================================
+//function : extrusionSweep
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ bool theMakeGroups,
+ const SMDSAbs_ElementType theElementType)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ TIDSortedElemSet elements, copyElements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements, theElementType);
+
+ const SMESH::PointStruct * P = &theStepVector.PS;
+ gp_Vec stepVec( P->x, P->y, P->z );
+
+ TIDSortedElemSet* workElements = & elements;
+
+ SMDSAbs_ElementType aType = SMDSAbs_Face;
+ if (theElementType == SMDSAbs_Node)
+ {
+ aType = SMDSAbs_Edge;
+ }
+ if ( myIsPreviewMode ) {
+ SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
+ getPreviewMesh( aType )->Copy( elements, copyElements, select, avoid );
+ workElements = & copyElements;
+ theMakeGroups = false;
+ }
+
+ TElemOfElemListMap aHystory;
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().ExtrusionSweep (*workElements, stepVec, theNbOfSteps, aHystory, theMakeGroups);
+
+ declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
+
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : ExtrusionSweep
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".ExtrusionSweep( "
+ << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps) << " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweep0D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweep0D(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".ExtrusionSweep0D( "
+ << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps)<< " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".ExtrusionSweepObject( "
+ << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject0D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Node );
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".ExtrusionSweepObject0D( "
+ << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject1D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".ExtrusionSweepObject1D( "
+ << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject2D
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".ExtrusionSweepObject2D( "
+ << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+}
+
+//=======================================================================
+//function : ExtrusionSweepMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups* aGroups = extrusionSweep(theIDsOfElements, theStepVector, theNbOfSteps, true);
+
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepMakeGroups( " << theIDsOfElements
+ << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepMakeGroups0D
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepMakeGroups0D(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups* aGroups = extrusionSweep(theIDsOfElements, theStepVector, theNbOfSteps, true,SMDSAbs_Node);
+
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepMakeGroups0D( " << theIDsOfElements
+ << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector, theNbOfSteps, true);
+
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepObjectMakeGroups( " << theObject
+ << ", " << theStepVector << ", " << theNbOfSteps << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject0DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
+ theNbOfSteps, true, SMDSAbs_Node);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepObject0DMakeGroups( " << theObject
+ << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject1DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
+ theNbOfSteps, true, SMDSAbs_Edge);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( " << theObject
+ << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionSweepObject2DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theStepVector,
+ CORBA::Long theNbOfSteps)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionSweep(anElementsId, theStepVector,
+ theNbOfSteps, true, SMDSAbs_Face);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( " << theObject
+ << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
+ }
+ return aGroups;
+}
+
+
+//=======================================================================
+//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)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+
+ const SMESH::PointStruct * P = &theStepVector.PS;
+ gp_Vec stepVec( P->x, P->y, P->z );
+
+ TElemOfElemListMap aHystory;
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
+ theMakeGroups, theExtrFlags, theSewTolerance);
+
+ declareMeshModified( /*isReComputeSafe=*/true );
+
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//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)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << "stepVector = " << theStepVector;
+ TPythonDump() << this << ".AdvancedExtrusion("
+ << theIDsOfElements
+ << ", stepVector, "
+ << theNbOfSteps << ","
+ << theExtrFlags << ", "
+ << theSewTolerance << " )";
+ }
+ advancedExtrusion( theIDsOfElements,
+ theStepVector,
+ theNbOfSteps,
+ theExtrFlags,
+ theSewTolerance,
+ false);
+}
+
+//=======================================================================
+//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()
+
+ SMESH::ListOfGroups * aGroups = advancedExtrusion( theIDsOfElements,
+ theStepVector,
+ theNbOfSteps,
+ theExtrFlags,
+ theSewTolerance,
+ true);
+
+ 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;
+ }
+
+ TIDSortedElemSet elements, copyElements;
+ arrayToSet(IDsOfElements, getMeshDS(), elements, ElementType);
+
+ TIDSortedElemSet* workElements = &elements;
+
+ if ( myIsPreviewMode )
+ {
+ SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
+ getPreviewMesh( SMDSAbs_Face )->Copy( elements, copyElements, select, avoid );
+ workElements = & copyElements;
+ MakeGroups = false;
+ }
+
+ ::SMESH_MeshEditor::Extrusion_Error error;
+
+ if ( SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( Path ))
+ {
+ // path as mesh
+ SMDS_MeshNode* aNodeStart =
+ (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
+ if ( !aNodeStart ) {
+ Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
+ return EmptyGr;
+ }
+ error = getEditor().ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
+ HasAngles, angles, LinearVariation,
+ HasRefPoint, refPnt, MakeGroups );
+ declareMeshModified( /*isReComputeSafe=*/true );
+ }
+ else if ( SMESH_subMesh_i* aSubMeshImp = SMESH::DownCast<SMESH_subMesh_i*>( Path ))
+ {
+ // path as submesh
+ SMESH::SMESH_Mesh_ptr aPathMesh = aSubMeshImp->GetFather();
+ aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( aPathMesh );
+ SMDS_MeshNode* aNodeStart =
+ (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
+ if ( !aNodeStart ) {
+ Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
+ return EmptyGr;
+ }
+ SMESH_subMesh* aSubMesh =
+ aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
+ error = getEditor().ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
+ HasAngles, angles, LinearVariation,
+ HasRefPoint, refPnt, MakeGroups );
+ declareMeshModified( /*isReComputeSafe=*/true );
+ }
+ else if ( SMESH::DownCast<SMESH_Group_i*>( Path ))
+ {
+ // path as group of 1D elements
+ // ????????
+ }
+ else
+ {
+ // invalid path
+ Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ return EmptyGr;
+ }
+
+ Error = convExtrError( error );
+
+ if ( MakeGroups ) {
+ 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 EmptyGr;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//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)
+ throw (SALOME::SALOME_Exception)
+{
+ MESSAGE("ExtrusionAlongPath");
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
+ << theIDsOfElements << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ extrusionAlongPath( theIDsOfElements,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError);
+ return anError;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject(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)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError);
+ return anError;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject1D
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(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)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject1D( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError,
+ SMDSAbs_Edge);
+ return anError;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2D
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Extrusion_Error
+SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(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)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject2D( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ SMESH::SMESH_MeshEditor::Extrusion_Error anError;
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ false,
+ anError,
+ SMDSAbs_Face);
+ return anError;
+}
+
+
+//=======================================================================
+//function : ExtrusionAlongPathMakeGroups
+//purpose :
+//=======================================================================
+
+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)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( theIDsOfElements,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error);
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << aGroups << ", error)";
+ else
+ aPythonDump <<"error";
+
+ aPythonDump<<" = "<< this << ".ExtrusionAlongPathMakeGroups( "
+ << theIDsOfElements << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//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)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error);
+
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << aGroups << ", error)";
+ else
+ aPythonDump <<"error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject1DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject1DMakeGroups(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)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error,
+ SMDSAbs_Edge);
+
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << aGroups << ", error)";
+ else
+ aPythonDump << "error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObject1DMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObject2DMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObject2DMakeGroups(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)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( theObject );
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
+ thePathMesh,
+ thePathShape,
+ theNodeStart,
+ theHasAngles,
+ theAngles,
+ theHasRefPoint,
+ theRefPoint,
+ true,
+ Error,
+ SMDSAbs_Face);
+
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << aGroups << ", error)";
+ else
+ aPythonDump << "error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObject2DMakeGroups( "
+ << theObject << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theHasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : ExtrusionAlongPathObjX
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups* SMESH_MeshEditor_i::
+ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
+ 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,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ prepareIdSource( Object );
+ SMESH::long_array_var anElementsId = Object->GetIDs();
+ SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId,
+ Path,
+ NodeStart,
+ HasAngles,
+ Angles,
+ LinearVariation,
+ HasRefPoint,
+ RefPoint,
+ MakeGroups,
+ (SMDSAbs_ElementType)ElemType,
+ Error);
+
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << *aGroups << ", error)";
+ else
+ aPythonDump << "error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathObjX( "
+ << Object << ", "
+ << Path << ", "
+ << NodeStart << ", "
+ << HasAngles << ", "
+ << TVar( Angles ) << ", "
+ << LinearVariation << ", "
+ << HasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
+ << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
+ << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+ << MakeGroups << ", "
+ << ElemType << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//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,
+ CORBA::Boolean MakeGroups,
+ SMESH::ElementType ElemType,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = extrusionAlongPathX(IDsOfElements,
+ Path,
+ NodeStart,
+ HasAngles,
+ Angles,
+ LinearVariation,
+ HasRefPoint,
+ RefPoint,
+ MakeGroups,
+ (SMDSAbs_ElementType)ElemType,
+ Error);
+
+ if (!myIsPreviewMode) {
+ bool isDumpGroups = aGroups && aGroups->length() > 0;
+ if (isDumpGroups)
+ aPythonDump << "(" << *aGroups << ", error)";
+ else
+ aPythonDump <<"error";
+
+ aPythonDump << " = " << this << ".ExtrusionAlongPathX( "
+ << IDsOfElements << ", "
+ << Path << ", "
+ << NodeStart << ", "
+ << HasAngles << ", "
+ << TVar( Angles ) << ", "
+ << LinearVariation << ", "
+ << HasRefPoint << ", "
+ << "SMESH.PointStruct( "
+ << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
+ << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
+ << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+ << MakeGroups << ", "
+ << ElemType << " )";
+ }
+ return aGroups;
+}
+
+//================================================================================
+/*!
+ * \brief Compute rotation angles for ExtrusionAlongPath as linear variation
+ * of given angles along path steps
+ * \param PathMesh mesh containing a 1D sub-mesh on the edge, along
+ * which proceeds the extrusion
+ * \param PathShape is shape(edge); as the mesh can be complex, the edge
+ * is used to define the sub-mesh for the path
+ */
+//================================================================================
+
+SMESH::double_array*
+SMESH_MeshEditor_i::LinearAnglesVariation(SMESH::SMESH_Mesh_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ const SMESH::double_array & theAngles)
+{
+ SMESH::double_array_var aResult = new SMESH::double_array();
+ int nbAngles = theAngles.length();
+ if ( nbAngles > 0 && !thePathMesh->_is_nil() && !thePathShape->_is_nil() )
+ {
+ 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())
+ return aResult._retn();
+ int nbSteps = aSubMesh->GetSubMeshDS()->NbElements();
+ if ( nbSteps == nbAngles )
+ {
+ aResult.inout() = theAngles;
+ }
+ else
+ {
+ aResult->length( nbSteps );
+ double rAn2St = double( nbAngles ) / double( nbSteps );
+ double angPrev = 0, angle;
+ for ( int iSt = 0; iSt < nbSteps; ++iSt )
+ {
+ double angCur = rAn2St * ( iSt+1 );
+ double angCurFloor = floor( angCur );
+ double angPrevFloor = floor( angPrev );
+ if ( angPrevFloor == angCurFloor )
+ angle = rAn2St * theAngles[ int( angCurFloor ) ];
+ else
+ {
+ int iP = int( angPrevFloor );
+ double angPrevCeil = ceil(angPrev);
+ angle = ( angPrevCeil - angPrev ) * theAngles[ iP ];
+
+ int iC = int( angCurFloor );
+ if ( iC < nbAngles )
+ angle += ( angCur - angCurFloor ) * theAngles[ iC ];
+
+ iP = int( angPrevCeil );
+ while ( iC-- > iP )
+ angle += theAngles[ iC ];
+ }
+ aResult[ iSt ] = angle;
+ angPrev = angCur;
+ }
+ }
+ }
+ // Update Python script
+ TPythonDump() << "rotAngles = " << theAngles;
+ TPythonDump() << "rotAngles = " << this << ".LinearAnglesVariation( "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << "rotAngles )";
+
+ return aResult._retn();
+}
+
+//=======================================================================
+//function : mirror
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::mirror(TIDSortedElemSet & theElements,
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy,
+ bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
+ gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
+
+ if ( theTargetMesh )
+ theCopy = false;
+
+ gp_Trsf aTrsf;
+ switch ( theMirrorType ) {
+ case SMESH::SMESH_MeshEditor::POINT:
+ aTrsf.SetMirror( P );
+ break;
+ case SMESH::SMESH_MeshEditor::AXIS:
+ aTrsf.SetMirror( gp_Ax1( P, V ));
+ break;
+ default:
+ aTrsf.SetMirror( gp_Ax2( P, V ));
+ }
+
+ TIDSortedElemSet copyElements;
+ TIDSortedElemSet* workElements = & theElements;
+
+ if ( myIsPreviewMode )
+ {
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( theElements, copyElements);
+ if ( !theCopy && !theTargetMesh )
+ {
+ TIDSortedElemSet elemsAround, elemsAroundCopy;
+ getElementsAround( theElements, getMeshDS(), elemsAround );
+ tmpMesh->Copy( elemsAround, elemsAroundCopy);
+ }
+ workElements = & copyElements;
+ theMakeGroups = false;
+ }
+
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+
+ if ( theCopy && !myIsPreviewMode)
+ {
+ if ( theTargetMesh )
+ {
+ theTargetMesh->GetMeshDS()->Modified();
+ }
+ else
+ {
+ declareMeshModified( /*isReComputeSafe=*/false );
+ }
+ }
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 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)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".Mirror( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopy << " )";
+ }
+ if ( theIDsOfElements.length() > 0 )
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ mirror(elements, theAxis, theMirrorType, theCopy, false);
+ }
+}
+
+
+//=======================================================================
+//function : MirrorObject
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".MirrorObject( "
+ << theObject << ", "
+ << theAxis << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopy << " )";
+ }
+ TIDSortedElemSet elements;
+
+ bool emptyIfIsMesh = myIsPreviewMode ? false : true;
+
+ prepareIdSource( theObject );
+ if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
+ mirror(elements, theAxis, theMirrorType, theCopy, false);
+}
+
+//=======================================================================
+//function : MirrorMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ if ( theIDsOfElements.length() > 0 )
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ aGroups = mirror(elements, theMirror, theMirrorType, true, true);
+ }
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".MirrorMakeGroups( "
+ << theIDsOfElements << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : MirrorObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if ( idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ aGroups = mirror(elements, theMirror, theMirrorType, true, true);
+
+ if (!myIsPreviewMode)
+ {
+ dumpGroupsList(aPythonDump,aGroups);
+ aPythonDump << this << ".MirrorObjectMakeGroups( "
+ << theObject << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : MirrorMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_Mesh_i* mesh_i;
+ SMESH::SMESH_Mesh_var mesh;
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+ if (mesh_i && theIDsOfElements.length() > 0 )
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ mirror(elements, theMirror, theMirrorType,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+
+ if (!myIsPreviewMode) {
+ pydump << mesh << " = " << this << ".MirrorMakeMesh( "
+ << theIDsOfElements << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ //dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+}
+
+//=======================================================================
+//function : MirrorObjectMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_Mesh_i* mesh_i;
+ SMESH::SMESH_Mesh_var mesh;
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if ( mesh_i &&
+ idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ {
+ mirror(elements, theMirror, theMirrorType,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if (!myIsPreviewMode) {
+ pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
+ << theObject << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ //dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+}
+
+//=======================================================================
+//function : translate
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::translate(TIDSortedElemSet & theElements,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy,
+ bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ if ( theTargetMesh )
+ theCopy = false;
+
+ gp_Trsf aTrsf;
+ const SMESH::PointStruct * P = &theVector.PS;
+ aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
+
+ TIDSortedElemSet copyElements;
+ TIDSortedElemSet* workElements = &theElements;
+
+ if ( myIsPreviewMode )
+ {
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( theElements, copyElements);
+ if ( !theCopy && !theTargetMesh )
+ {
+ TIDSortedElemSet elemsAround, elemsAroundCopy;
+ getElementsAround( theElements, getMeshDS(), elemsAround );
+ tmpMesh->Copy( elemsAround, elemsAroundCopy);
+ }
+ workElements = & copyElements;
+ theMakeGroups = false;
+ }
+
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+
+ if ( theCopy && !myIsPreviewMode )
+ {
+ if ( theTargetMesh )
+ {
+ theTargetMesh->GetMeshDS()->Modified();
+ }
+ else
+ {
+ declareMeshModified( /*isReComputeSafe=*/false );
+ }
+ }
+
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : Translate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".Translate( "
+ << theIDsOfElements << ", "
+ << theVector << ", "
+ << theCopy << " )";
+ }
+ if (theIDsOfElements.length()) {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ translate(elements, theVector, theCopy, false);
+ }
+}
+
+//=======================================================================
+//function : TranslateObject
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct & theVector,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".TranslateObject( "
+ << theObject << ", "
+ << theVector << ", "
+ << theCopy << " )";
+ }
+ TIDSortedElemSet elements;
+
+ bool emptyIfIsMesh = myIsPreviewMode ? false : true;
+
+ prepareIdSource( theObject );
+ if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
+ translate(elements, theVector, theCopy, false);
+}
+
+//=======================================================================
+//function : TranslateMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theVector)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ if (theIDsOfElements.length()) {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ aGroups = translate(elements,theVector,true,true);
+ }
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".TranslateMakeGroups( "
+ << theIDsOfElements << ", "
+ << theVector << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : TranslateObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theVector)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ aGroups = translate(elements, theVector, true, true);
+
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".TranslateObjectMakeGroups( "
+ << theObject << ", "
+ << theVector << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : TranslateMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
+ const SMESH::DirStruct& theVector,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_Mesh_i* mesh_i;
+ SMESH::SMESH_Mesh_var mesh;
+
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+
+ if ( mesh_i && theIDsOfElements.length() )
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ translate(elements, theVector, false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+
+ if ( !myIsPreviewMode ) {
+ pydump << mesh << " = " << this << ".TranslateMakeMesh( "
+ << theIDsOfElements << ", "
+ << theVector << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ //dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+}
+
+//=======================================================================
+//function : TranslateObjectMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::DirStruct& theVector,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ SMESH_Mesh_i* mesh_i;
+ SMESH::SMESH_Mesh_var mesh;
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if ( mesh_i &&
+ idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ {
+ translate(elements, theVector,false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myIsPreviewMode ) {
+ pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
+ << theObject << ", "
+ << theVector << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ // dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : rotate
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::rotate(TIDSortedElemSet & theElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy,
+ bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ if ( theTargetMesh )
+ theCopy = false;
+
+ gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
+ gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
+
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
+
+ TIDSortedElemSet copyElements;
+ TIDSortedElemSet* workElements = &theElements;
+ if ( myIsPreviewMode ) {
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( theElements, copyElements );
+ if ( !theCopy && !theTargetMesh )
+ {
+ TIDSortedElemSet elemsAround, elemsAroundCopy;
+ getElementsAround( theElements, getMeshDS(), elemsAround );
+ tmpMesh->Copy( elemsAround, elemsAroundCopy);
+ }
+ workElements = ©Elements;
+ theMakeGroups = false;
+ }
+
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+
+ if ( theCopy && !myIsPreviewMode)
+ {
+ if ( theTargetMesh ) theTargetMesh->GetMeshDS()->Modified();
+ else declareMeshModified( /*isReComputeSafe=*/false );
+ }
+
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : Rotate
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if (!myIsPreviewMode) {
+ TPythonDump() << this << ".Rotate( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << TVar( theAngle ) << ", "
+ << theCopy << " )";
+ }
+ if (theIDsOfElements.length() > 0)
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ rotate(elements,theAxis,theAngle,theCopy,false);
+ }
+}
+
+//=======================================================================
+//function : RotateObject
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngle,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".RotateObject( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngle ) << ", "
+ << theCopy << " )";
+ }
+ TIDSortedElemSet elements;
+ bool emptyIfIsMesh = myIsPreviewMode ? false : true;
+ prepareIdSource( theObject );
+ if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
+ rotate(elements,theAxis,theAngle,theCopy,false);
+}
+
+//=======================================================================
+//function : RotateMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngle)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ if (theIDsOfElements.length() > 0)
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ aGroups = rotate(elements,theAxis,theAngle,true,true);
+ }
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotateMakeGroups( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << TVar( theAngle ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotateObjectMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngle)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = 0;
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ aGroups = rotate(elements, theAxis, theAngle, true, true);
+
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".RotateObjectMakeGroups( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngle ) << " )";
+ }
+ return aGroups;
+}
+
+//=======================================================================
+//function : RotateMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ SMESH::SMESH_Mesh_var mesh;
+ SMESH_Mesh_i* mesh_i;
+
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+
+ if ( mesh_i && theIDsOfElements.length() > 0 )
+ {
+ TIDSortedElemSet elements;
+ arrayToSet(theIDsOfElements, getMeshDS(), elements);
+ rotate(elements, theAxis, theAngleInRadians,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myIsPreviewMode ) {
+ pydump << mesh << " = " << this << ".RotateMakeMesh( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ // dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i && theIDsOfElements.length() > 0 )
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : RotateObjectMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::AxisStruct& theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ SMESH::SMESH_Mesh_var mesh;
+ SMESH_Mesh_i* mesh_i;
+
+ {// open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ if (mesh_i &&
+ idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ {
+ rotate(elements, theAxis, theAngleInRadians,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myIsPreviewMode ) {
+ pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
+ << theObject << ", "
+ << theAxis << ", "
+ << TVar( theAngleInRadians ) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ }
+
+ // dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : scale
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::PointStruct& thePoint,
+ const SMESH::double_array& theScaleFact,
+ CORBA::Boolean theCopy,
+ bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+ if ( theScaleFact.length() < 1 )
+ THROW_SALOME_CORBA_EXCEPTION("Scale factor not given", SALOME::BAD_PARAM);
+ if ( theScaleFact.length() == 2 )
+ THROW_SALOME_CORBA_EXCEPTION("Invalid nb of scale factors : 2", SALOME::BAD_PARAM);
+
+ if ( theTargetMesh )
+ theCopy = false;
+
+ TIDSortedElemSet elements;
+ prepareIdSource( theObject );
+ bool emptyIfIsMesh = myIsPreviewMode ? false : true;
+ if ( !idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
+ return 0;
+
+ double S[3] = {
+ theScaleFact[0],
+ (theScaleFact.length() == 1) ? theScaleFact[0] : theScaleFact[1],
+ (theScaleFact.length() == 1) ? theScaleFact[0] : theScaleFact[2],
+ };
+ double tol = std::numeric_limits<double>::max();
+ gp_Trsf aTrsf;
+ aTrsf.SetValues( S[0], 0, 0, thePoint.x * (1-S[0]),
+ 0, S[1], 0, thePoint.y * (1-S[1]),
+ 0, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
+
+ TIDSortedElemSet copyElements;
+ TIDSortedElemSet* workElements = &elements;
+ if ( myIsPreviewMode )
+ {
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( elements, copyElements);
+ if ( !theCopy && !theTargetMesh )
+ {
+ TIDSortedElemSet elemsAround, elemsAroundCopy;
+ getElementsAround( elements, getMeshDS(), elemsAround );
+ tmpMesh->Copy( elemsAround, elemsAroundCopy);
+ }
+ workElements = & copyElements;
+ theMakeGroups = false;
+ }
+
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().Transform (*workElements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
+
+ if ( theCopy && !myIsPreviewMode )
+ {
+ if ( theTargetMesh ) theTargetMesh->GetMeshDS()->Modified();
+ else declareMeshModified( /*isReComputeSafe=*/false );
+ }
+ return theMakeGroups ? getGroups(groupIds.get()) : 0;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : Scale
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::Scale(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::PointStruct& thePoint,
+ const SMESH::double_array& theScaleFact,
+ CORBA::Boolean theCopy)
+ throw (SALOME::SALOME_Exception)
+{
+ if ( !myIsPreviewMode ) {
+ TPythonDump() << this << ".Scale( "
+ << theObject << ", "
+ << thePoint << ", "
+ << TVar( theScaleFact ) << ", "
+ << theCopy << " )";
+ }
+ scale(theObject, thePoint, theScaleFact, theCopy, false);
+}
+
+
+//=======================================================================
+//function : ScaleMakeGroups
+//purpose :
+//=======================================================================
+
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::ScaleMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::PointStruct& thePoint,
+ const SMESH::double_array& theScaleFact)
+ throw (SALOME::SALOME_Exception)
+{
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ SMESH::ListOfGroups * aGroups = scale(theObject, thePoint, theScaleFact, true, true);
+ if (!myIsPreviewMode) {
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".Scale("
+ << theObject << ","
+ << thePoint << ","
+ << TVar( theScaleFact ) << ",True,True)";
+ }
+ return aGroups;
+}
+
+
+//=======================================================================
+//function : ScaleMakeMesh
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::ScaleMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+ const SMESH::PointStruct& thePoint,
+ const SMESH::double_array& theScaleFact,
+ CORBA::Boolean theCopyGroups,
+ const char* theMeshName)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_Mesh_i* mesh_i;
+ SMESH::SMESH_Mesh_var mesh;
+ { // open new scope to dump "MakeMesh" command
+ // and then "GetGroups" using SMESH_Mesh::GetGroups()
+
+ TPythonDump pydump; // to prevent dump at mesh creation
+ mesh = makeMesh( theMeshName );
+ mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+
+ if ( mesh_i )
+ {
+ scale(theObject, thePoint, theScaleFact,false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myIsPreviewMode )
+ pydump << mesh << " = " << this << ".ScaleMakeMesh( "
+ << theObject << ", "
+ << thePoint << ", "
+ << TVar( theScaleFact ) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+
+ // dump "GetGroups"
+ if (!myIsPreviewMode && mesh_i)
+ mesh_i->GetGroups();
+
+ return mesh._retn();
+}
+
+
+//=======================================================================
+//function : FindCoincidentNodes
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double Tolerance,
+ SMESH::array_of_long_array_out GroupsOfNodes)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ TIDSortedNodeSet nodes; // no input nodes
+ getEditor().FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
+
+ GroupsOfNodes = new SMESH::array_of_long_array;
+ GroupsOfNodes->length( aListOfListOfNodes.size() );
+ ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
+ 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 ];
+ aGroup.length( aListOfNodes.size() );
+ for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
+ aGroup[ j ] = (*lIt)->GetID();
+ }
+ TPythonDump() << "coincident_nodes = " << this << ".FindCoincidentNodes( "
+ << Tolerance << " )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=======================================================================
+//function : FindCoincidentNodesOnPart
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr theObject,
+ CORBA::Double Tolerance,
+ SMESH::array_of_long_array_out GroupsOfNodes)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ TIDSortedNodeSet nodes;
+ prepareIdSource( theObject );
+ idSourceToNodeSet( theObject, getMeshDS(), nodes );
+
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ if(!nodes.empty())
+ getEditor().FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
+
+ GroupsOfNodes = new SMESH::array_of_long_array;
+ GroupsOfNodes->length( aListOfListOfNodes.size() );
+ ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
+ 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 ];
+ aGroup.length( aListOfNodes.size() );
+ for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
+ aGroup[ j ] = (*lIt)->GetID();
+ }
+ TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPart( "
+ <<theObject<<", "
+ << Tolerance << " )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//================================================================================
+/*!
+ * \brief Finds nodes coinsident with Tolerance within Object excluding nodes within
+ * ExceptSubMeshOrGroups
+ */
+//================================================================================
+
+void SMESH_MeshEditor_i::
+FindCoincidentNodesOnPartBut(SMESH::SMESH_IDSource_ptr theObject,
+ CORBA::Double theTolerance,
+ SMESH::array_of_long_array_out theGroupsOfNodes,
+ const SMESH::ListOfIDSources& theExceptSubMeshOrGroups)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ TIDSortedNodeSet nodes;
+ prepareIdSource( theObject );
+ idSourceToNodeSet( theObject, getMeshDS(), nodes );
+
+ for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
+ {
+ TIDSortedNodeSet exceptNodes;
+ idSourceToNodeSet( theExceptSubMeshOrGroups[i], getMeshDS(), exceptNodes );
+ TIDSortedNodeSet::iterator avoidNode = exceptNodes.begin();
+ for ( ; avoidNode != exceptNodes.end(); ++avoidNode)
+ nodes.erase( *avoidNode );
+ }
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ if(!nodes.empty())
+ getEditor().FindCoincidentNodes( nodes, theTolerance, aListOfListOfNodes );
+
+ theGroupsOfNodes = new SMESH::array_of_long_array;
+ theGroupsOfNodes->length( aListOfListOfNodes.size() );
+ ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
+ 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 = (*theGroupsOfNodes)[ i ];
+ aGroup.length( aListOfNodes.size() );
+ for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
+ aGroup[ j ] = (*lIt)->GetID();
+ }
+ TPythonDump() << "coincident_nodes_on_part = " << this << ".FindCoincidentNodesOnPartBut( "
+ << theObject<<", "
+ << theTolerance << ", "
+ << theExceptSubMeshOrGroups << " )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=======================================================================
+//function : MergeNodes
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESHDS_Mesh* aMesh = getMeshDS();
+
+ TPythonDump aTPythonDump;
+ aTPythonDump << this << ".MergeNodes([";
+ ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
+ for (int i = 0; i < GroupsOfNodes.length(); i++)
+ {
+ const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
+ aListOfListOfNodes.push_back( list< const SMDS_MeshNode* >() );
+ list< const SMDS_MeshNode* >& aListOfNodes = aListOfListOfNodes.back();
+ for ( int j = 0; j < aNodeGroup.length(); j++ )
+ {
+ CORBA::Long index = aNodeGroup[ j ];
+ const SMDS_MeshNode * node = aMesh->FindNode(index);
+ if ( node )
+ aListOfNodes.push_back( node );
+ }
+ if ( aListOfNodes.size() < 2 )
+ aListOfListOfNodes.pop_back();
+
+ if ( i > 0 ) aTPythonDump << ", ";
+ aTPythonDump << aNodeGroup;
+ }
+ getEditor().MergeNodes( aListOfListOfNodes );
+
+ aTPythonDump << "])";
+
+ declareMeshModified( /*isReComputeSafe=*/false );
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=======================================================================
+//function : FindEqualElements
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::FindEqualElements(SMESH::SMESH_IDSource_ptr theObject,
+ SMESH::array_of_long_array_out GroupsOfElementsID)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow(theObject);
+ if ( !(!group->_is_nil() && group->GetType() == SMESH::NODE) )
+ {
+ TIDSortedElemSet elems;
+ prepareIdSource( theObject );
+ idSourceToSet( theObject, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true);
+
+ ::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
+ getEditor().FindEqualElements( elems, aListOfListOfElementsID );
+
+ GroupsOfElementsID = new SMESH::array_of_long_array;
+ GroupsOfElementsID->length( aListOfListOfElementsID.size() );
+
+ ::SMESH_MeshEditor::TListOfListOfElementsID::iterator arraysIt =
+ aListOfListOfElementsID.begin();
+ for (CORBA::Long j = 0; arraysIt != aListOfListOfElementsID.end(); ++arraysIt, ++j)
+ {
+ SMESH::long_array& aGroup = (*GroupsOfElementsID)[ j ];
+ list<int>& listOfIDs = *arraysIt;
+ aGroup.length( listOfIDs.size() );
+ list<int>::iterator idIt = listOfIDs.begin();
+ for (int k = 0; idIt != listOfIDs.end(); ++idIt, ++k )
+ aGroup[ k ] = *idIt;
+ }
+
+ TPythonDump() << "equal_elements = " << this << ".FindEqualElements( "
+ <<theObject<<" )";
+ }
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=======================================================================
+//function : MergeElements
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MergeElements(const SMESH::array_of_long_array& GroupsOfElementsID)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ TPythonDump aTPythonDump;
+ aTPythonDump << this << ".MergeElements( [";
+
+ ::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
+
+ for (int i = 0; i < GroupsOfElementsID.length(); i++) {
+ const SMESH::long_array& anElemsIDGroup = GroupsOfElementsID[ i ];
+ aListOfListOfElementsID.push_back( list< int >() );
+ list< int >& aListOfElemsID = aListOfListOfElementsID.back();
+ for ( int j = 0; j < anElemsIDGroup.length(); j++ ) {
+ CORBA::Long id = anElemsIDGroup[ j ];
+ aListOfElemsID.push_back( id );
+ }
+ if ( aListOfElemsID.size() < 2 )
+ aListOfListOfElementsID.pop_back();
+ if ( i > 0 ) aTPythonDump << ", ";
+ aTPythonDump << anElemsIDGroup;
+ }
+
+ getEditor().MergeElements(aListOfListOfElementsID);
+
+ declareMeshModified( /*isReComputeSafe=*/true );
+
+ aTPythonDump << "] )";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=======================================================================
+//function : MergeEqualElements
+//purpose :
+//=======================================================================
+
+void SMESH_MeshEditor_i::MergeEqualElements()
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ getEditor().MergeEqualElements();
+
+ declareMeshModified( /*isReComputeSafe=*/true );
+
+ TPythonDump() << this << ".MergeEqualElements()";
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+}
+
+//=============================================================================
+/*!
+ * Move the node to a given point
+ */
+//=============================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData(/*deleteSearchers=*/false);
+
+ const SMDS_MeshNode * node = getMeshDS()->FindNode( NodeID );
+ if ( !node )
+ return false;
+
+ if ( theNodeSearcher )
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+ if ( myIsPreviewMode ) // make preview data
+ {
+ // in a preview mesh, make edges linked to a node
+ TPreviewMesh& tmpMesh = *getPreviewMesh();
+ TIDSortedElemSet linkedNodes;
+ ::SMESH_MeshEditor::GetLinkedNodes( node, linkedNodes );
+ TIDSortedElemSet::iterator nIt = linkedNodes.begin();
+ SMDS_MeshNode *nodeCpy1 = tmpMesh.Copy(node);
+ for ( ; nIt != linkedNodes.end(); ++nIt )
+ {
+ SMDS_MeshNode *nodeCpy2 = tmpMesh.Copy ( cast2Node( *nIt ));
+ tmpMesh.GetMeshDS()->AddEdge(nodeCpy1, nodeCpy2);
+ }
+ // move copied node
+ if ( nodeCpy1 )
+ tmpMesh.GetMeshDS()->MoveNode(nodeCpy1, x, y, z);
+ // fill preview data
+ }
+ else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+ theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+ else
+ getMeshDS()->MoveNode(node, x, y, z);
+
+ if ( !myIsPreviewMode )
+ {
+ // Update Python script
+ TPythonDump() << "isDone = " << this << ".MoveNode( "
+ << NodeID << ", " << TVar(x) << ", " << TVar(y) << ", " << TVar(z) << " )";
+ declareMeshModified( /*isReComputeSafe=*/false );
+ }
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+
+ return true;
+}
+
+//================================================================================
+/*!
+ * \brief Return ID of node closest to a given point
+ */
+//================================================================================
+
+CORBA::Long SMESH_MeshEditor_i::FindNodeClosestTo(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+ if ( !theNodeSearcher ) {
+ theNodeSearcher = SMESH_MeshAlgos::GetNodeSearcher( *getMeshDS() );
+ }
+ gp_Pnt p( x,y,z );
+ if ( const SMDS_MeshNode* node = theNodeSearcher->FindClosestTo( p ))
+ return node->GetID();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//================================================================================
+/*!
+ * \brief If the given ID is a valid node ID (nodeID > 0), just move this node, else
+ * move the node closest to the point to point's location and return ID of the node
+ */
+//================================================================================
+
+CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ CORBA::Long theNodeID)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ // We keep theNodeSearcher until any mesh modification:
+ // 1) initData() deletes theNodeSearcher at any edition,
+ // 2) TSearchersDeleter - at any mesh compute event and mesh change
+
+ initData(/*deleteSearchers=*/false);
+
+ theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other
+
+ int nodeID = theNodeID;
+ const SMDS_MeshNode* node = getMeshDS()->FindNode( nodeID );
+ if ( !node ) // preview moving node
+ {
+ if ( !theNodeSearcher ) {
+ theNodeSearcher = SMESH_MeshAlgos::GetNodeSearcher( *getMeshDS() );
+ }
+ gp_Pnt p( x,y,z );
+ node = theNodeSearcher->FindClosestTo( p );
+ }
+ if ( node ) {
+ nodeID = node->GetID();
+ if ( myIsPreviewMode ) // make preview data
+ {
+ // in a preview mesh, make edges linked to a node
+ TPreviewMesh tmpMesh = *getPreviewMesh();
+ TIDSortedElemSet linkedNodes;
+ ::SMESH_MeshEditor::GetLinkedNodes( node, linkedNodes );
+ TIDSortedElemSet::iterator nIt = linkedNodes.begin();
+ for ( ; nIt != linkedNodes.end(); ++nIt )
+ {
+ SMDS_LinearEdge edge( node, cast2Node( *nIt ));
+ tmpMesh.Copy( &edge );
+ }
+ // move copied node
+ node = tmpMesh.GetMeshDS()->FindNode( nodeID );
+ if ( node )
+ tmpMesh.GetMeshDS()->MoveNode(node, x, y, z);
+ // fill preview data
+ }
+ else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly
+ {
+ theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z ));
+ }
+ else
+ {
+ getMeshDS()->MoveNode(node, x, y, z);
+ }
+ }
+
+ if ( !myIsPreviewMode )
+ {
+ TPythonDump() << "nodeID = " << this
+ << ".MoveClosestNodeToPoint( "<< x << ", " << y << ", " << z
+ << ", " << nodeID << " )";
+
+ declareMeshModified( /*isReComputeSafe=*/false );
+ }
+
+ return nodeID;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+/*!
+ * Return elements of given type where the given point is IN or ON.
+ *
+ * 'ALL' type means elements of any type excluding nodes
+ */
+//=======================================================================
+
+SMESH::long_array* SMESH_MeshEditor_i::FindElementsByPoint(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ SMESH::ElementType type)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ SMESH::long_array_var res = new SMESH::long_array;
+ vector< const SMDS_MeshElement* > foundElems;
+
+ theSearchersDeleter.Set( myMesh );
+ if ( !theElementSearcher ) {
+ theElementSearcher = SMESH_MeshAlgos::GetElementSearcher( *getMeshDS() );
+ }
+ theElementSearcher->FindElementsByPoint( gp_Pnt( x,y,z ),
+ SMDSAbs_ElementType( type ),
+ foundElems);
+ res->length( foundElems.size() );
+ for ( int i = 0; i < foundElems.size(); ++i )
+ res[i] = foundElems[i]->GetID();
+
+ if ( !myIsPreviewMode ) // call from tui
+ TPythonDump() << "res = " << this << ".FindElementsByPoint( "
+ << x << ", "
+ << y << ", "
+ << z << ", "
+ << type << " )";
+
+ return res._retn();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : FindAmongElementsByPoint
+//purpose : Searching among the given elements, return elements of given type
+// where the given point is IN or ON.
+// 'ALL' type means elements of any type excluding nodes
+//=======================================================================
+
+SMESH::long_array*
+SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementIDs,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ SMESH::ElementType type)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ SMESH::long_array_var res = new SMESH::long_array;
+
+ SMESH::array_of_ElementType_var types = elementIDs->GetTypes();
+ if ( types->length() == 1 && // a part contains only nodes or 0D elements
+ ( types[0] == SMESH::NODE || types[0] == SMESH::ELEM0D || types[0] == SMESH::BALL) &&
+ type != types[0] ) // but search of elements of dim > 0
+ return res._retn();
+
+ if ( SMESH::DownCast<SMESH_Mesh_i*>( elementIDs )) // elementIDs is the whole mesh
+ return FindElementsByPoint( x,y,z, type );
+
+ TIDSortedElemSet elements; // elems should live until FindElementsByPoint() finishes
+
+ theSearchersDeleter.Set( myMesh, getPartIOR( elementIDs, type ));
+ if ( !theElementSearcher )
+ {
+ // create a searcher from elementIDs
+ SMESH::SMESH_Mesh_var mesh = elementIDs->GetMesh();
+ SMESHDS_Mesh* meshDS = SMESH::DownCast<SMESH_Mesh_i*>( mesh )->GetImpl().GetMeshDS();
+
+ if ( !idSourceToSet( elementIDs, meshDS, elements,
+ SMDSAbs_ElementType(type), /*emptyIfIsMesh=*/true))
+ return res._retn();
+
+ typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
+ SMDS_ElemIteratorPtr elemsIt( new TIter( elements.begin(), elements.end() ));
+
+ theElementSearcher = SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(), elemsIt );
+ }
+
+ vector< const SMDS_MeshElement* > foundElems;
+
+ theElementSearcher->FindElementsByPoint( gp_Pnt( x,y,z ),
+ SMDSAbs_ElementType( type ),
+ foundElems);
+ res->length( foundElems.size() );
+ for ( int i = 0; i < foundElems.size(); ++i )
+ res[i] = foundElems[i]->GetID();
+
+ if ( !myIsPreviewMode ) // call from tui
+ TPythonDump() << "res = " << this << ".FindAmongElementsByPoint( "
+ << elementIDs << ", "
+ << x << ", "
+ << y << ", "
+ << z << ", "
+ << type << " )";
+
+ return res._retn();
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : GetPointState
+//purpose : Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
+// TopAbs_UNKNOWN state means that either mesh is wrong or the analysis fails.
+//=======================================================================
+
+CORBA::Short SMESH_MeshEditor_i::GetPointState(CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ theSearchersDeleter.Set( myMesh );
+ if ( !theElementSearcher ) {
+ theElementSearcher = SMESH_MeshAlgos::GetElementSearcher( *getMeshDS() );
+ }
+ return CORBA::Short( theElementSearcher->GetPointState( gp_Pnt( x,y,z )));
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
+}
+
+//=======================================================================
+//function : convError
+//purpose :
+//=======================================================================
+
+#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
+
+static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
+{
+ switch ( e ) {
+ RETCASE( SEW_OK );
+ RETCASE( SEW_BORDER1_NOT_FOUND );
+ RETCASE( SEW_BORDER2_NOT_FOUND );
+ RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
+ RETCASE( SEW_BAD_SIDE_NODES );
+ RETCASE( SEW_VOLUMES_TO_SPLIT );
+ RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
+ RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
+ RETCASE( SEW_BAD_SIDE1_NODES );
+ RETCASE( SEW_BAD_SIDE2_NODES );
+ }
+ return SMESH::SMESH_MeshEditor::SEW_OK;
+}
+
+//=======================================================================
+//function : SewFreeBorders
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Sew_Error
+SMESH_MeshEditor_i::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)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESHDS_Mesh* aMesh = getMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
+ const SMDS_MeshNode* aSide2ThirdNode = aMesh->FindNode( LastNodeID2 );
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode)
+ return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
+ if (!aSide2FirstNode ||
+ !aSide2SecondNode ||
+ !aSide2ThirdNode)
+ return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
+
+ TPythonDump() << "error = " << this << ".SewFreeBorders( "
+ << FirstNodeID1 << ", "
+ << SecondNodeID1 << ", "
+ << LastNodeID1 << ", "
+ << FirstNodeID2 << ", "
+ << SecondNodeID2 << ", "
+ << LastNodeID2 << ", "
+ << CreatePolygons<< ", "
+ << CreatePolyedrs<< " )";
+
+ SMESH::SMESH_MeshEditor::Sew_Error error =
+ convError( getEditor().SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ true,
+ CreatePolygons,
+ CreatePolyedrs) );
+
+
+ declareMeshModified( /*isReComputeSafe=*/false );
+ return error;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return SMESH::SMESH_MeshEditor::Sew_Error(0);
+}
+
+
+//=======================================================================
+//function : SewConformFreeBorders
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Sew_Error
+SMESH_MeshEditor_i::SewConformFreeBorders(CORBA::Long FirstNodeID1,
+ CORBA::Long SecondNodeID1,
+ CORBA::Long LastNodeID1,
+ CORBA::Long FirstNodeID2,
+ CORBA::Long SecondNodeID2)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESHDS_Mesh* aMesh = getMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
+ const SMDS_MeshNode* aSide2ThirdNode = 0;
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode )
+ return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
+ if (!aSide2FirstNode ||
+ !aSide2SecondNode)
+ return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
+
+ TPythonDump() << "error = " << this << ".SewConformFreeBorders( "
+ << FirstNodeID1 << ", "
+ << SecondNodeID1 << ", "
+ << LastNodeID1 << ", "
+ << FirstNodeID2 << ", "
+ << SecondNodeID2 << " )";
+
+ SMESH::SMESH_MeshEditor::Sew_Error error =
+ convError( getEditor().SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ true,
+ false, false) );
+
+ declareMeshModified( /*isReComputeSafe=*/false );
+ return error;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return SMESH::SMESH_MeshEditor::Sew_Error(0);
+}
+
+
+//=======================================================================
+//function : SewBorderToSide
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Sew_Error
+SMESH_MeshEditor_i::SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
+ CORBA::Long SecondNodeIDOnFreeBorder,
+ CORBA::Long LastNodeIDOnFreeBorder,
+ CORBA::Long FirstNodeIDOnSide,
+ CORBA::Long LastNodeIDOnSide,
+ CORBA::Boolean CreatePolygons,
+ CORBA::Boolean CreatePolyedrs)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESHDS_Mesh* aMesh = getMeshDS();
+
+ const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeIDOnFreeBorder );
+ const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeIDOnSide );
+ const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( LastNodeIDOnSide );
+ const SMDS_MeshNode* aSide2ThirdNode = 0;
+
+ if (!aBorderFirstNode ||
+ !aBorderSecondNode||
+ !aBorderLastNode )
+ return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
+ if (!aSide2FirstNode ||
+ !aSide2SecondNode)
+ return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE_NODES;
+
+ TPythonDump() << "error = " << this << ".SewBorderToSide( "
+ << FirstNodeIDOnFreeBorder << ", "
+ << SecondNodeIDOnFreeBorder << ", "
+ << LastNodeIDOnFreeBorder << ", "
+ << FirstNodeIDOnSide << ", "
+ << LastNodeIDOnSide << ", "
+ << CreatePolygons << ", "
+ << CreatePolyedrs << ") ";
+
+ SMESH::SMESH_MeshEditor::Sew_Error error =
+ convError( getEditor().SewFreeBorder (aBorderFirstNode,
+ aBorderSecondNode,
+ aBorderLastNode,
+ aSide2FirstNode,
+ aSide2SecondNode,
+ aSide2ThirdNode,
+ false,
+ CreatePolygons,
+ CreatePolyedrs) );
+
+ declareMeshModified( /*isReComputeSafe=*/false );
+ return error;
+
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return SMESH::SMESH_MeshEditor::Sew_Error(0);
+}
+
+
+//=======================================================================
+//function : SewSideElements
+//purpose :
+//=======================================================================
+
+SMESH::SMESH_MeshEditor::Sew_Error
+SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
+ const SMESH::long_array& IDsOfSide2Elements,
+ CORBA::Long NodeID1OfSide1ToMerge,
+ CORBA::Long NodeID1OfSide2ToMerge,
+ CORBA::Long NodeID2OfSide1ToMerge,
+ CORBA::Long NodeID2OfSide2ToMerge)
+ throw (SALOME::SALOME_Exception)
+{
+ SMESH_TRY;
+ initData();
+
+ SMESHDS_Mesh* aMesh = getMeshDS();
+
+ const SMDS_MeshNode* aFirstNode1ToMerge = aMesh->FindNode( NodeID1OfSide1ToMerge );
+ const SMDS_MeshNode* aFirstNode2ToMerge = aMesh->FindNode( NodeID1OfSide2ToMerge );
+ const SMDS_MeshNode* aSecondNode1ToMerge = aMesh->FindNode( NodeID2OfSide1ToMerge );
+ const SMDS_MeshNode* aSecondNode2ToMerge = aMesh->FindNode( NodeID2OfSide2ToMerge );