0020105: EDF 862 SMESH : Creation of the skin elements (2D) of a 3D Mesh

This commit is contained in:
ptv 2009-09-10 06:59:27 +00:00
parent 8772f598d6
commit 35c05cab65
12 changed files with 150 additions and 6 deletions

View File

@ -784,6 +784,13 @@ module SMESH
in ListOfGroups theNodesNot, in ListOfGroups theNodesNot,
in GEOM::GEOM_Object theShape ); in GEOM::GEOM_Object theShape );
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
boolean Make2DMeshFrom3D();
}; };
}; };

View File

@ -165,6 +165,7 @@ dist_salomeres_DATA = \
mesh_tree_mesh_partial.png \ mesh_tree_mesh_partial.png \
mesh_extractGroup.png \ mesh_extractGroup.png \
mesh_precompute.png \ mesh_precompute.png \
mesh_2d_from_3d.png \
mesh_free_faces.png mesh_free_faces.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive # VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

View File

@ -8776,9 +8776,6 @@ bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems,
const TIDSortedElemSet& theNodesNot, const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape ) const TopoDS_Shape& theShape )
{ {
SMESHDS_Mesh* aMesh = GetMeshDS();
if (!aMesh)
return false;
if ( theShape.IsNull() ) if ( theShape.IsNull() )
return false; return false;
@ -8813,3 +8810,46 @@ bool SMESH_MeshEditor::DoubleNodesInRegion( const TIDSortedElemSet& theElems,
} }
return DoubleNodes( theElems, theNodesNot, anAffected ); return DoubleNodes( theElems, theNodesNot, anAffected );
} }
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool SMESH_MeshEditor::Make2DMeshFrom3D()
{
// iterates on volume elements and detect all free faces on them
SMESHDS_Mesh* aMesh = GetMeshDS();
if (!aMesh)
return false;
bool res = false;
SMDS_VolumeIteratorPtr vIt = aMesh->volumesIterator();
while(vIt->more())
{
const SMDS_MeshVolume* volume = vIt->next();
SMDS_VolumeTool vTool( volume );
bool isPoly = volume->IsPoly();
for ( int iface = 0, n = vTool.NbFaces(); iface < n; iface++ )
{
if (!vTool.IsFreeFace(iface))
continue;
vector<const SMDS_MeshNode *> nodes;
int nbFaceNodes = vTool.NbFaceNodes(iface);
const SMDS_MeshNode** faceNodes = vTool.GetFaceNodes(iface);
if (vTool.IsFaceExternal(iface))
for (int inode = 0; inode < nbFaceNodes; inode++)
nodes.push_back(faceNodes[inode]);
else
for (int inode = nbFaceNodes - 1; inode >= 0; inode--)
nodes.push_back(faceNodes[inode]);
// add new face based on volume nodes
if (aMesh->FindFace( nodes ) )
continue; // face already exsist
myLastCreatedElems.Append( AddElement(nodes, SMDSAbs_Face, isPoly && iface == 1) );
res = true;
}
}
return res;
}

View File

@ -610,6 +610,13 @@ public:
const TIDSortedElemSet& theNodesNot, const TIDSortedElemSet& theNodesNot,
const TopoDS_Shape& theShape ); const TopoDS_Shape& theShape );
/*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
bool Make2DMeshFrom3D();
private: private:
/*! /*!

View File

@ -91,6 +91,7 @@ salomeinclude_HEADERS = \
SMESHGUI_MeshEditPreview.h \ SMESHGUI_MeshEditPreview.h \
SMESHGUI_IdValidator.h \ SMESHGUI_IdValidator.h \
SMESHGUI_MeshInfosBox.h \ SMESHGUI_MeshInfosBox.h \
SMESHGUI_Make2DFrom3DOp.h \
SMESH_SMESHGUI.hxx SMESH_SMESHGUI.hxx
# Libraries targets # Libraries targets
@ -159,7 +160,8 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_MeshEditPreview.cxx \ SMESHGUI_MeshEditPreview.cxx \
SMESHGUI_GroupOnShapeDlg.cxx \ SMESHGUI_GroupOnShapeDlg.cxx \
SMESHGUI_FileInfoDlg.cxx \ SMESHGUI_FileInfoDlg.cxx \
SMESHGUI_MeshInfosBox.cxx SMESHGUI_MeshInfosBox.cxx \
SMESHGUI_Make2DFrom3DOp.cxx
MOC_FILES = \ MOC_FILES = \
SMESHGUI_moc.cxx \ SMESHGUI_moc.cxx \
@ -212,7 +214,8 @@ MOC_FILES = \
SMESHGUI_MakeNodeAtPointDlg_moc.cxx \ SMESHGUI_MakeNodeAtPointDlg_moc.cxx \
SMESHGUI_GroupOnShapeDlg_moc.cxx \ SMESHGUI_GroupOnShapeDlg_moc.cxx \
SMESHGUI_FileInfoDlg_moc.cxx \ SMESHGUI_FileInfoDlg_moc.cxx \
SMESHGUI_MeshInfosBox_moc.cxx SMESHGUI_MeshInfosBox_moc.cxx \
SMESHGUI_Make2DFrom3DOp_moc.cxx
nodist_libSMESH_la_SOURCES= \ nodist_libSMESH_la_SOURCES= \
$(MOC_FILES) $(MOC_FILES)

View File

@ -67,6 +67,7 @@
#include "SMESHGUI_BuildCompoundDlg.h" #include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ComputeDlg.h" #include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_FileInfoDlg.h" #include "SMESHGUI_FileInfoDlg.h"
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_MeshUtils.h"
@ -1773,6 +1774,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}*/ }*/
break; break;
} }
case 418: // create 2D mesh from 3D
{
startOperation( 418 );
break;
}
case 806: // CREATE GEO GROUP case 806: // CREATE GEO GROUP
{ {
startOperation( 806 ); startOperation( 806 );
@ -2768,6 +2774,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 415, "MAP", "ICON_MAP" ); createSMESHAction( 415, "MAP", "ICON_MAP" );
createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" ); createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" ); createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
createSMESHAction( 418, "2D_FROM_3D", "ICON_2D_FROM_3D" );
createSMESHAction( 200, "RESET" ); createSMESHAction( 200, "RESET" );
createSMESHAction( 201, "SCALAR_BAR_PROP" ); createSMESHAction( 201, "SCALAR_BAR_PROP" );
createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true ); createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
@ -2937,6 +2944,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 414, modifyId, -1 ); createMenu( 414, modifyId, -1 );
createMenu( 415, modifyId, -1 ); createMenu( 415, modifyId, -1 );
createMenu( 417, modifyId, -1 ); createMenu( 417, modifyId, -1 );
createMenu( 418, modifyId, -1 );
createMenu( 214, viewId, -1 ); createMenu( 214, viewId, -1 );
@ -3033,6 +3041,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 414, modifyTb ); createTool( 414, modifyTb );
createTool( 415, modifyTb ); createTool( 415, modifyTb );
createTool( 417, modifyTb ); createTool( 417, modifyTb );
createTool( 418, modifyTb );
createTool( 214, dispModeTb ); createTool( 214, dispModeTb );
@ -3900,6 +3909,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
case 417: //convert to quadratic case 417: //convert to quadratic
op = new SMESHGUI_ConvToQuadOp(); op = new SMESHGUI_ConvToQuadOp();
break; break;
case 418: // create 2D mesh as boundary on 3D
op = new SMESHGUI_Make2DFrom3DOp();
break;
case 4067: // make mesh pass through point case 4067: // make mesh pass through point
op = new SMESHGUI_MakeNodeAtPointOp(); op = new SMESHGUI_MakeNodeAtPointOp();
break; break;

View File

@ -445,5 +445,9 @@
<source>ICON_UNDERLYING_ELEMS</source> <source>ICON_UNDERLYING_ELEMS</source>
<translation>mesh_extractGroup.png</translation> <translation>mesh_extractGroup.png</translation>
</message> </message>
<message>
<source>ICON_2D_FROM_3D</source>
<translation>mesh_2d_from_3d.png</translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -201,6 +201,10 @@
<source>MEN_CONV_TO_QUAD</source> <source>MEN_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation> <translation>Convert to/from quadratic</translation>
</message> </message>
<message>
<source>MEN_2D_FROM_3D</source>
<translation>Create 2D mesh from 3D</translation>
</message>
<message> <message>
<source>MEN_CREATE_GROUP</source> <source>MEN_CREATE_GROUP</source>
<translation>Create Group</translation> <translation>Create Group</translation>
@ -2043,6 +2047,10 @@ Consider saving your work before application crash</translation>
<source>STB_CONV_TO_QUAD</source> <source>STB_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation> <translation>Convert to/from quadratic</translation>
</message> </message>
<message>
<source>STB_2D_FROM_3D</source>
<translation>Create 2D mesh from 3D</translation>
</message>
<message> <message>
<source>STB_CREATE_GROUP</source> <source>STB_CREATE_GROUP</source>
<translation>Create Group</translation> <translation>Create Group</translation>
@ -2537,6 +2545,10 @@ Consider saving your work before application crash</translation>
<source>TOP_CONV_TO_QUAD</source> <source>TOP_CONV_TO_QUAD</source>
<translation>Convert to/from quadratic</translation> <translation>Convert to/from quadratic</translation>
</message> </message>
<message>
<source>TOP_2D_FROM_3D</source>
<translation>Create 2D mesh from 3D</translation>
</message>
<message> <message>
<source>TOP_CREATE_GROUP</source> <source>TOP_CREATE_GROUP</source>
<translation>Create Group</translation> <translation>Create Group</translation>
@ -3375,6 +3387,13 @@ Please specify it and try again</translation>
<translation>No valid mesh object selected</translation> <translation>No valid mesh object selected</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_Make2DFrom3DDlg</name>
<message>
<source>CAPTION</source>
<translation>Create 2D mesh from 3D</translation>
</message>
</context>
<context> <context>
<name>SMESHGUI_CreatePatternDlg</name> <name>SMESHGUI_CreatePatternDlg</name>
<message> <message>

View File

@ -4245,6 +4245,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElem
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodes( " << theElems << ", "
<< theNodesNot << ", " << theAffectedElems << " )";
return aResult; return aResult;
} }
@ -4282,6 +4285,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodesInRegion( " << theElems << ", "
<< theNodesNot << ", " << theShape << " )";
return aResult; return aResult;
} }
@ -4332,6 +4338,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup(
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodeGroup( " << theElems << ", "
<< theNodesNot << ", " << theAffectedElems << " )";
return aResult; return aResult;
} }
@ -4371,6 +4380,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion(
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodeGroupInRegion( " << theElems << ", "
<< theNodesNot << ", " << theShape << " )";
return aResult; return aResult;
} }
@ -4423,6 +4435,9 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodeGroups( " << &theElems << ", "
<< &theNodesNot << ", " << &theAffectedElems << " )";
return aResult; return aResult;
} }
@ -4459,5 +4474,28 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion(
storeResult( aMeshEditor) ; storeResult( aMeshEditor) ;
// Update Python script
TPythonDump() << "isDone = " << this << ".DoubleNodeGroupsInRegion( " << &theElems << ", "
<< &theNodesNot << ", " << theShape << " )";
return aResult;
}
//================================================================================
/*!
\brief Generated skin mesh (containing 2D cells) from 3D mesh
The created 2D mesh elements based on nodes of free faces of boundary volumes
\return TRUE if operation has been completed successfully, FALSE otherwise
*/
//================================================================================
CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D()
{
initData();
::SMESH_MeshEditor aMeshEditor( myMesh );
bool aResult = aMeshEditor.Make2DMeshFrom3D();
storeResult( aMeshEditor) ;
TPythonDump() << "isDone = " << this << ".Make2DMeshFrom3D()";
return aResult; return aResult;
} }

View File

@ -601,7 +601,14 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
const SMESH::ListOfGroups& theNodesNot, const SMESH::ListOfGroups& theNodesNot,
GEOM::GEOM_Object_ptr theShape ); GEOM::GEOM_Object_ptr theShape );
private: //!< private methods /*!
* \brief Generated skin mesh (containing 2D cells) from 3D mesh
* The created 2D mesh elements based on nodes of free faces of boundary volumes
* \return TRUE if operation has been completed successfully, FALSE otherwise
*/
CORBA::Boolean Make2DMeshFrom3D();
private: //!< private methods
SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); } SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }

View File

@ -2512,6 +2512,12 @@ class Mesh:
def ConvertFromQuadratic(self): def ConvertFromQuadratic(self):
return self.editor.ConvertFromQuadratic() return self.editor.ConvertFromQuadratic()
## Creates 2D mesh as skin on boundary faces of a 3D mesh
# @return TRUE if operation has been completed successfully, FALSE otherwise
# @ingroup l2_modif_edit
def Make2DMeshFrom3D(self):
return self.editor. Make2DMeshFrom3D()
## Renumber mesh nodes ## Renumber mesh nodes
# @ingroup l2_modif_renumber # @ingroup l2_modif_renumber
def RenumberNodes(self): def RenumberNodes(self):