mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 18:00:32 +05:00
020749: EDF 1291 SMESH : Create 2D Mesh from 3D improvement / note 0011031
This commit is contained in:
parent
cc7a87f590
commit
4352740230
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -7,7 +7,7 @@ elements of a higher dimension.
|
|||||||
|
|
||||||
<em>To generate border elements:</em>
|
<em>To generate border elements:</em>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Select a mesh in the Object Browser or in the 3D Viewer</li>
|
<li>Select a mesh or groups in the Object Browser or in the 3D Viewer</li>
|
||||||
<li>From the Modification menu choose "Create boundary elements"
|
<li>From the Modification menu choose "Create boundary elements"
|
||||||
item, or click "Create boundary elements" button in the toolbar
|
item, or click "Create boundary elements" button in the toolbar
|
||||||
|
|
||||||
@ -16,26 +16,23 @@ item, or click "Create boundary elements" button in the toolbar
|
|||||||
The following dialog box will appear:
|
The following dialog box will appear:
|
||||||
\image html 2d_from_3d_dlg.png "Create boundary elements dialog box".
|
\image html 2d_from_3d_dlg.png "Create boundary elements dialog box".
|
||||||
</li>
|
</li>
|
||||||
<li>Check in the dialog box one of three radio buttons corresponding to
|
<li>Check in the dialog box one of two radio buttons corresponding to
|
||||||
the type of operation you would like to perform.</li>
|
the type of operation you would like to perform.</li>
|
||||||
<li>Fill the other fields available in the dialog box.</li>
|
<li>Fill the other fields available in the dialog box.</li>
|
||||||
<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation.</li>
|
<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
\n "Create boundary elements" dialog allows creation of boundary elements
|
\n "Create boundary elements" dialog allows creation of boundary elements
|
||||||
of three types.
|
of two types.
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>2D from 3D</b> creates mesh faces on free facets of volume elements</li>
|
<li><b>2D from 3D</b> creates mesh faces on free facets of volume elements</li>
|
||||||
<li><b>1D from 2D</b> creates mesh edges on free edges of mesh faces</li>
|
<li><b>1D from 2D</b> creates mesh edges on free edges of mesh faces</li>
|
||||||
<li><b>1D from 2D groups</b> creates mesh edges on borders of groups of faces</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
Here a <em>free facet</em> means a facet shared by only one volume, a <em>free edge</em>
|
Here a <em>free facet</em> means a facet shared by only one volume, a <em>free edge</em>
|
||||||
means an edge shared by only one mesh face.
|
means an edge shared by only one mesh face.
|
||||||
|
|
||||||
In this dialog:
|
In this dialog:
|
||||||
<ul>
|
<ul>
|
||||||
<li>specify the <b>2D groups</b> on borders of which the edges will be
|
|
||||||
generated (if <b>1D from 2D groups</b> is selected).</li>
|
|
||||||
<li>specify the <b>Target</b> mesh, where the boundary elements will
|
<li>specify the <b>Target</b> mesh, where the boundary elements will
|
||||||
be created.
|
be created.
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
#include "SMESH_LogicalFilter.hxx"
|
#include "SMESH_LogicalFilter.hxx"
|
||||||
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
|
#include "SMESH_Actor.h"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
@ -37,6 +39,7 @@
|
|||||||
#include <SUIT_OverrideCursor.h>
|
#include <SUIT_OverrideCursor.h>
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SVTK_ViewModel.h>
|
#include <SVTK_ViewModel.h>
|
||||||
|
//#include <SVTK_ViewWindow.h>
|
||||||
#include <SalomeApp_Study.h>
|
#include <SalomeApp_Study.h>
|
||||||
#include <SalomeApp_Tools.h>
|
#include <SalomeApp_Tools.h>
|
||||||
|
|
||||||
@ -53,6 +56,8 @@
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 11
|
#define MARGIN 11
|
||||||
|
|
||||||
@ -74,16 +79,22 @@ SMESHGUI_Make2DFrom3DDlg::SMESHGUI_Make2DFrom3DDlg( QWidget* parent )
|
|||||||
aModeGrpLayout->setSpacing( SPACING );
|
aModeGrpLayout->setSpacing( SPACING );
|
||||||
my2dFrom3dRB = new QRadioButton( tr( "2D_FROM_3D" ), aModeGrp );
|
my2dFrom3dRB = new QRadioButton( tr( "2D_FROM_3D" ), aModeGrp );
|
||||||
my1dFrom2dRB = new QRadioButton( tr( "1D_FROM_2D" ), aModeGrp );
|
my1dFrom2dRB = new QRadioButton( tr( "1D_FROM_2D" ), aModeGrp );
|
||||||
my1dFrom3dRB = new QRadioButton( tr( "1D_FROM_3D" ), aModeGrp );
|
//my1dFrom3dRB = new QRadioButton( tr( "1D_FROM_3D" ), aModeGrp );
|
||||||
aModeGrpLayout->addWidget( my2dFrom3dRB );
|
aModeGrpLayout->addWidget( my2dFrom3dRB );
|
||||||
aModeGrpLayout->addWidget( my1dFrom2dRB );
|
aModeGrpLayout->addWidget( my1dFrom2dRB );
|
||||||
aModeGrpLayout->addWidget( my1dFrom3dRB );
|
//aModeGrpLayout->addWidget( my1dFrom3dRB );
|
||||||
|
|
||||||
// Groups of mesh faces
|
// // Groups of mesh faces
|
||||||
setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
|
// setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
|
||||||
createObject( tr( "Groups" ), mainFrame(), Groups );
|
// createObject( tr( "Groups" ), mainFrame(), Groups );
|
||||||
setNameIndication( Groups, ListOfNames );
|
// setNameIndication( Groups, ListOfNames );
|
||||||
objectWg( Groups, Btn )->hide();
|
// objectWg( Groups, Btn )->hide();
|
||||||
|
|
||||||
|
// Mesh or Groups
|
||||||
|
//setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
|
||||||
|
createObject( tr( "Groups" ), mainFrame(), MeshOrGroups );
|
||||||
|
setNameIndication( MeshOrGroups, ListOfNames );
|
||||||
|
objectWg( MeshOrGroups, Btn )->hide();
|
||||||
|
|
||||||
// target
|
// target
|
||||||
QGroupBox* aTargetGrp = new QGroupBox( tr( "TARGET" ), mainFrame() );
|
QGroupBox* aTargetGrp = new QGroupBox( tr( "TARGET" ), mainFrame() );
|
||||||
@ -106,8 +117,8 @@ SMESHGUI_Make2DFrom3DDlg::SMESHGUI_Make2DFrom3DDlg( QWidget* parent )
|
|||||||
aDlgLay->setMargin( 0 );
|
aDlgLay->setMargin( 0 );
|
||||||
aDlgLay->setSpacing( SPACING );
|
aDlgLay->setSpacing( SPACING );
|
||||||
aDlgLay->addWidget( aModeGrp, 0, 0, 1, 3 );
|
aDlgLay->addWidget( aModeGrp, 0, 0, 1, 3 );
|
||||||
aDlgLay->addWidget( objectWg( Groups, Label ), 1, 0 );
|
aDlgLay->addWidget( objectWg( MeshOrGroups, Label ), 1, 0 );
|
||||||
aDlgLay->addWidget( objectWg( Groups, Control ), 1, 1 );
|
aDlgLay->addWidget( objectWg( MeshOrGroups, Control ), 1, 1 );
|
||||||
aDlgLay->addWidget( aTargetGrp, 2, 0, 1, 3 );
|
aDlgLay->addWidget( aTargetGrp, 2, 0, 1, 3 );
|
||||||
aDlgLay->addWidget( myGroupCheck, 3, 0 );
|
aDlgLay->addWidget( myGroupCheck, 3, 0 );
|
||||||
aDlgLay->addWidget( myGroupName, 3, 1, 1, 2 );
|
aDlgLay->addWidget( myGroupName, 3, 1, 1, 2 );
|
||||||
@ -153,6 +164,21 @@ void SMESHGUI_Make2DFrom3DDlg::setNewMeshName( const QString& name )
|
|||||||
myMeshName->setText( name );
|
myMeshName->setText( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_Make2DFrom3DDlg::setNewMeshEnabled( bool enable )
|
||||||
|
{
|
||||||
|
if ( !enable )
|
||||||
|
myThisMeshRB->setChecked( true );
|
||||||
|
|
||||||
|
myNewMeshRB->setEnabled( enable );
|
||||||
|
|
||||||
|
onTargetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMESHGUI_Make2DFrom3DDlg::getNewMeshEnabled() const
|
||||||
|
{
|
||||||
|
return myNewMeshRB->isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
bool SMESHGUI_Make2DFrom3DDlg::needGroup() const
|
bool SMESHGUI_Make2DFrom3DDlg::needGroup() const
|
||||||
{
|
{
|
||||||
return myGroupCheck->isChecked();
|
return myGroupCheck->isChecked();
|
||||||
@ -190,7 +216,9 @@ void SMESHGUI_Make2DFrom3DDlg::onGroupChecked()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
||||||
: SMESHGUI_SelectionOp()
|
: SMESHGUI_SelectionOp(),
|
||||||
|
myMeshFilter(MESH),
|
||||||
|
myGroupFilter(GROUP)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,33 +248,43 @@ void SMESHGUI_Make2DFrom3DOp::startOperation()
|
|||||||
|
|
||||||
connect( myDlg->my2dFrom3dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
connect( myDlg->my2dFrom3dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
||||||
connect( myDlg->my1dFrom2dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
connect( myDlg->my1dFrom2dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
||||||
connect( myDlg->my1dFrom3dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
//connect( myDlg->my1dFrom3dRB, SIGNAL( toggled(bool) ), this, SLOT( onModeChanged() ) );
|
||||||
|
|
||||||
onModeChanged();
|
//onModeChanged();
|
||||||
|
|
||||||
|
myDlg->activateObject( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups );
|
||||||
|
selectionDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Set filter corresponding to dimension
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
void SMESHGUI_Make2DFrom3DOp::onModeChanged()
|
void SMESHGUI_Make2DFrom3DOp::onModeChanged()
|
||||||
{
|
{
|
||||||
QRadioButton* b = dynamic_cast<QRadioButton*>( sender());
|
// QRadioButton* b = dynamic_cast<QRadioButton*>( sender());
|
||||||
if ( b && !b->isChecked() )
|
// if ( b && !b->isChecked() )
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// enable "2D groups" field
|
// // enable "2D groups" field
|
||||||
bool enableGroups = ( myDlg->mode() == SMESH::BND_1DFROM3D );
|
// bool enableGroups = ( myDlg->mode() == SMESH::BND_1DFROM3D );
|
||||||
myDlg->setObjectEnabled( SMESHGUI_Make2DFrom3DDlg::Groups, enableGroups );
|
// myDlg->setObjectEnabled( SMESHGUI_Make2DFrom3DDlg::Groups, enableGroups );
|
||||||
((QToolButton*) myDlg->objectWg( SMESHGUI_Make2DFrom3DDlg::Groups,
|
// ((QToolButton*) myDlg->objectWg( SMESHGUI_Make2DFrom3DDlg::Groups,
|
||||||
SMESHGUI_Make2DFrom3DDlg::Btn ))->setChecked( enableGroups );
|
// SMESHGUI_Make2DFrom3DDlg::Btn ))->setChecked( enableGroups );
|
||||||
|
|
||||||
// install filter
|
// // install filter
|
||||||
int id = enableGroups ? SMESHGUI_Make2DFrom3DDlg::Groups : SMESHGUI_Make2DFrom3DDlg::Mesh;
|
// int id = enableGroups ? SMESHGUI_Make2DFrom3DDlg::Groups : SMESHGUI_Make2DFrom3DDlg::Mesh;
|
||||||
onDeactivateObject( id );
|
// onDeactivateObject( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups );
|
||||||
onActivateObject( id );
|
// onActivateObject ( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups );
|
||||||
|
// selectionDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
||||||
{
|
{
|
||||||
|
myDlg->clearSelection( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups );
|
||||||
mySrcMesh = SMESH::SMESH_Mesh::_nil();
|
mySrcMesh = SMESH::SMESH_Mesh::_nil();
|
||||||
myDlg->clearSelection( SMESHGUI_Make2DFrom3DDlg::Groups );
|
|
||||||
|
|
||||||
if ( !dlg() ) return;
|
if ( !dlg() ) return;
|
||||||
|
|
||||||
@ -258,13 +296,16 @@ void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
|||||||
selected( names, types, ids );
|
selected( names, types, ids );
|
||||||
myDlg->selectObject( names, types, ids );
|
myDlg->selectObject( names, types, ids );
|
||||||
|
|
||||||
SALOME_ListIO sel; selectionMgr()->selectedObjects( sel, SVTK_Viewer::Type() );
|
// enable/desable "new mesh" button
|
||||||
if ( !sel.IsEmpty() )
|
bool isMesh = true;
|
||||||
|
for ( int i = 0; i < ids.count() && isMesh; ++i )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_IDSource_var IS = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(sel.First());
|
_PTR(SObject) sobj =
|
||||||
if(!CORBA::is_nil(IS))
|
SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
|
||||||
mySrcMesh = IS->GetMesh();
|
mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );
|
||||||
|
isMesh = !mySrcMesh->_is_nil();
|
||||||
}
|
}
|
||||||
|
myDlg->setNewMeshEnabled( isMesh );
|
||||||
}
|
}
|
||||||
catch ( const SALOME::SALOME_Exception& S_ex ) {
|
catch ( const SALOME::SALOME_Exception& S_ex ) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||||
@ -276,8 +317,13 @@ void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
|||||||
|
|
||||||
SUIT_SelectionFilter* SMESHGUI_Make2DFrom3DOp::createFilter( const int theId ) const
|
SUIT_SelectionFilter* SMESHGUI_Make2DFrom3DOp::createFilter( const int theId ) const
|
||||||
{
|
{
|
||||||
MeshObjectType type = ( theId == SMESHGUI_Make2DFrom3DDlg::Groups ? GROUP_FACE : MESH );
|
SMESHGUI_Make2DFrom3DOp* me = (SMESHGUI_Make2DFrom3DOp*) this;
|
||||||
SUIT_SelectionFilter* f = new SMESH_TypeFilter( type );
|
|
||||||
|
QList<SUIT_SelectionFilter*> subFilters;
|
||||||
|
subFilters.append( & me->myMeshFilter );
|
||||||
|
subFilters.append( & me->myGroupFilter );
|
||||||
|
|
||||||
|
SUIT_SelectionFilter* f = new SMESH_LogicalFilter( subFilters, SMESH_LogicalFilter::LO_OR );
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,43 +332,61 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
|
|||||||
if ( !dlg() ) return false;
|
if ( !dlg() ) return false;
|
||||||
|
|
||||||
// check if a mesh is selected
|
// check if a mesh is selected
|
||||||
if ( mySrcMesh->_is_nil() )
|
if ( !myDlg->hasSelection( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups ))
|
||||||
{
|
{
|
||||||
msg = tr( "SMESH_ERR_NO_INPUT_MESH" );
|
msg = tr( "SMESH_ERR_NO_INPUT_MESH" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check if groups are selected
|
QStringList entries;
|
||||||
SMESH::Bnd_Dimension mode = myDlg->mode();
|
dlg()->selectedObject( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups, entries );
|
||||||
if ( mode == SMESH::BND_1DFROM3D )
|
const bool isMeshSelected = ( !mySrcMesh->_is_nil() );
|
||||||
|
if ( isMeshSelected )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_GroupBase_var grp;
|
// only one mesh is allowed
|
||||||
QStringList entries;
|
if ( entries.size() > 1 ) {
|
||||||
dlg()->selectedObject( SMESHGUI_Make2DFrom3DDlg::Groups, entries );
|
msg = tr( "SMESH_TOO_MANY_MESHES" );
|
||||||
if ( !entries.isEmpty() )
|
|
||||||
{
|
|
||||||
_PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[0].toLatin1().constData() );
|
|
||||||
if ( sobj )
|
|
||||||
grp = SMESH::SObjectToInterface<SMESH::SMESH_GroupBase>( sobj );
|
|
||||||
}
|
|
||||||
if ( grp->_is_nil() ) {
|
|
||||||
msg = tr( "SMESH_ERR_NO_INPUT_GROUP" );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if mesh contains elements of required type
|
// check if only groups are selected
|
||||||
SMESH::Bnd_Dimension mode = myDlg->mode();
|
for ( int i = 0; i < entries.count(); ++i )
|
||||||
|
{
|
||||||
if ( mode == SMESH::BND_2DFROM3D && mySrcMesh->NbVolumes() == 0 ) {
|
SMESH::SMESH_GroupBase_var grp;
|
||||||
msg = tr( "SMESH_ERR_NO_3D_ELEMENTS" );
|
if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
|
||||||
return false;
|
grp = SMESH::SObjectToInterface<SMESH::SMESH_GroupBase>( sobj );
|
||||||
|
if ( grp->_is_nil() ) {
|
||||||
|
msg = tr( "SMESH_NOT_ONLY_GROUPS" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( mode == SMESH::BND_1DFROM2D && mySrcMesh->NbFaces() == 0 ) {
|
}
|
||||||
msg = tr( "SMESH_ERR_NO_2D_ELEMENTS" );
|
// check if the selected objects contains elements of required type
|
||||||
return false;
|
bool hasFaces = false, hasVolumes = false;
|
||||||
|
SMESH::Bnd_Dimension mode = myDlg->mode();
|
||||||
|
for ( int i = 0; i < entries.count(); ++i )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_IDSource_var idSource;
|
||||||
|
if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
|
||||||
|
idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
|
||||||
|
if ( !idSource->_is_nil() ) {
|
||||||
|
SMESH::array_of_ElementType_var types = idSource->GetTypes();
|
||||||
|
for ( int j = 0; j < types->length(); ++j )
|
||||||
|
if ( types[j] == SMESH::VOLUME )
|
||||||
|
hasVolumes = true;
|
||||||
|
else if ( types[j] == SMESH::FACE )
|
||||||
|
hasFaces = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( mode == SMESH::BND_2DFROM3D && !hasVolumes ) {
|
||||||
|
msg = tr( "SMESH_ERR_NO_3D_ELEMENTS" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if ( mode == SMESH::BND_1DFROM2D && !hasFaces ) {
|
||||||
|
msg = tr( "SMESH_ERR_NO_2D_ELEMENTS" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check if new mesh name is specified
|
// check if new mesh name is specified
|
||||||
if ( myDlg->needNewMesh() && myDlg->getNewMeshName().isEmpty() ) {
|
if ( myDlg->needNewMesh() && myDlg->getNewMeshName().isEmpty() ) {
|
||||||
@ -335,7 +399,7 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
|
|||||||
msg = tr( "SMESH_ERR_GRP_NAME_NOT_SPECIFIED" );
|
msg = tr( "SMESH_ERR_GRP_NAME_NOT_SPECIFIED" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,20 +409,41 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
|
|||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
try {
|
try {
|
||||||
QStringList entries;
|
|
||||||
dlg()->selectedObject( SMESHGUI_Make2DFrom3DDlg::Groups, entries );
|
|
||||||
SMESH::ListOfIDSources_var groups = new SMESH::ListOfIDSources;
|
|
||||||
groups->length( entries.count() );
|
|
||||||
for ( int i = 0; i < entries.count(); ++i )
|
|
||||||
{
|
|
||||||
_PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() );
|
|
||||||
SMESH::SMESH_IDSource_var grp = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
|
|
||||||
groups[i] = grp;
|
|
||||||
}
|
|
||||||
SMESH::Bnd_Dimension mode = myDlg->mode();
|
SMESH::Bnd_Dimension mode = myDlg->mode();
|
||||||
QString meshName = myDlg->needNewMesh() ? myDlg->getNewMeshName() : QString();
|
QString meshName = myDlg->needNewMesh() ? myDlg->getNewMeshName() : QString();
|
||||||
QString groupName = myDlg->needGroup() ? myDlg->getGroupName() : QString();
|
QString groupName = myDlg->needGroup() ? myDlg->getGroupName() : QString();
|
||||||
bool copyAll = myDlg->copySource();
|
bool copyAll = myDlg->copySource();
|
||||||
|
|
||||||
|
QStringList entries;
|
||||||
|
dlg()->selectedObject( SMESHGUI_Make2DFrom3DDlg::MeshOrGroups, entries );
|
||||||
|
SMESH::ListOfIDSources_var groups = new SMESH::ListOfIDSources;
|
||||||
|
QString wrongGroups = "";
|
||||||
|
|
||||||
|
if ( mySrcMesh->_is_nil() ) // get selected groups, find groups of wrong type
|
||||||
|
{
|
||||||
|
int nbGroups = 0;
|
||||||
|
int goodType = ( mode == SMESH::BND_2DFROM3D ? SMESH::VOLUME : SMESH::FACE );
|
||||||
|
groups->length( entries.count() );
|
||||||
|
for ( int i = 0; i < entries.count(); ++i )
|
||||||
|
{
|
||||||
|
_PTR(SObject) sobj =
|
||||||
|
SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() );
|
||||||
|
SMESH::SMESH_IDSource_var grp = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
|
||||||
|
SMESH::array_of_ElementType_var types = grp->GetTypes();
|
||||||
|
if ( types->length() < 1 || types[0] != goodType )
|
||||||
|
{
|
||||||
|
if ( !wrongGroups.isEmpty() )
|
||||||
|
wrongGroups += ", ";
|
||||||
|
wrongGroups += sobj->GetName().c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
groups[ nbGroups++ ] = grp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groups->length( nbGroups );
|
||||||
|
mySrcMesh = groups[0]->GetMesh();
|
||||||
|
}
|
||||||
|
|
||||||
if ( !CORBA::is_nil( mySrcMesh ) ) {
|
if ( !CORBA::is_nil( mySrcMesh ) ) {
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = mySrcMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = mySrcMesh->GetMeshEditor();
|
||||||
@ -371,9 +456,11 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
|
|||||||
groups,
|
groups,
|
||||||
newMesh.out(),
|
newMesh.out(),
|
||||||
newGrp.out() );
|
newGrp.out() );
|
||||||
SUIT_MessageBox::information( myDlg,
|
QString msg = tr("NB_ADDED").arg( nbAdded );
|
||||||
tr("SMESH_INFORMATION"),
|
if ( !wrongGroups.isEmpty() )
|
||||||
tr("NB_ADDED").arg( nbAdded ));
|
msg += ".\n" + tr("WRONG_GROUPS").arg( wrongGroups );
|
||||||
|
SUIT_MessageBox::information( myDlg, tr("SMESH_INFORMATION"), msg);
|
||||||
|
|
||||||
if ( !newMesh->_is_nil() ) {
|
if ( !newMesh->_is_nil() ) {
|
||||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
|
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
|
||||||
theEntryList.append( aSObject->GetID().c_str() );
|
theEntryList.append( aSObject->GetID().c_str() );
|
||||||
@ -387,6 +474,11 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
|
|
||||||
|
for ( int i = 0; i < entries.count(); ++i )
|
||||||
|
if ( SMESH_Actor* actor = SMESH::FindActorByEntry( entries[i].toLatin1().constData() ))
|
||||||
|
SMESH::Update(actor->getIO(),actor->GetVisibility());
|
||||||
|
SMESH::RepaintCurrentView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( ... ) {
|
catch ( ... ) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
#include "SMESHGUI_Dialog.h"
|
#include "SMESHGUI_Dialog.h"
|
||||||
#include "SMESHGUI_SelectionOp.h"
|
#include "SMESHGUI_SelectionOp.h"
|
||||||
|
#include "SMESH_TypeFilter.hxx"
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
||||||
@ -45,7 +46,7 @@ class SMESHGUI_EXPORT SMESHGUI_Make2DFrom3DDlg : public SMESHGUI_Dialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum { Mesh, Groups };
|
enum { MeshOrGroups };
|
||||||
|
|
||||||
SMESHGUI_Make2DFrom3DDlg( QWidget* );
|
SMESHGUI_Make2DFrom3DDlg( QWidget* );
|
||||||
virtual ~SMESHGUI_Make2DFrom3DDlg();
|
virtual ~SMESHGUI_Make2DFrom3DDlg();
|
||||||
@ -55,6 +56,8 @@ public:
|
|||||||
bool needNewMesh() const;
|
bool needNewMesh() const;
|
||||||
QString getNewMeshName() const;
|
QString getNewMeshName() const;
|
||||||
void setNewMeshName( const QString& );
|
void setNewMeshName( const QString& );
|
||||||
|
void setNewMeshEnabled( bool );
|
||||||
|
bool getNewMeshEnabled() const;
|
||||||
|
|
||||||
bool needGroup() const;
|
bool needGroup() const;
|
||||||
QString getGroupName() const;
|
QString getGroupName() const;
|
||||||
@ -110,6 +113,9 @@ private:
|
|||||||
private:
|
private:
|
||||||
SMESH::SMESH_Mesh_var mySrcMesh;
|
SMESH::SMESH_Mesh_var mySrcMesh;
|
||||||
QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
|
QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
|
||||||
|
|
||||||
|
SMESH_TypeFilter myMeshFilter;
|
||||||
|
SMESH_TypeFilter myGroupFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_Make2DFrom3DOp_H
|
#endif // SMESHGUI_Make2DFrom3DOp_H
|
||||||
|
@ -5594,7 +5594,7 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Groups</source>
|
<source>Groups</source>
|
||||||
<translation>2D groups</translation>
|
<translation>Mesh or groups</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MODE</source>
|
<source>MODE</source>
|
||||||
@ -5643,21 +5643,31 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
<source>NB_ADDED</source>
|
<source>NB_ADDED</source>
|
||||||
<translation>%1 boundary elements have been added</translation>
|
<translation>%1 boundary elements have been added</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>WRONG_GROUPS</source>
|
||||||
|
<translation>The following groups have not been processed
|
||||||
|
as they are of improper type:
|
||||||
|
%1</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_ERR_NO_INPUT_MESH</source>
|
<source>SMESH_ERR_NO_INPUT_MESH</source>
|
||||||
<translation>Source mesh is not specified</translation>
|
<translation>Source mesh is not specified</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_ERR_NO_INPUT_GROUP</source>
|
<source>SMESH_TOO_MANY_MESHES</source>
|
||||||
<translation>2D group is not specified</translation>
|
<translation>Only one mesh can be processed at once</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SMESH_NOT_ONLY_GROUPS</source>
|
||||||
|
<translation>Can't process meshes and groups at once</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_ERR_NO_3D_ELEMENTS</source>
|
<source>SMESH_ERR_NO_3D_ELEMENTS</source>
|
||||||
<translation>The source object does not contain 3D elements</translation>
|
<translation>The source objects do not contain 3D elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_ERR_NO_2D_ELEMENTS</source>
|
<source>SMESH_ERR_NO_2D_ELEMENTS</source>
|
||||||
<translation>The source object does not contain 2D elements</translation>
|
<translation>The source objects do not contain 2D elements</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_ERR_MESH_NAME_NOT_SPECIFIED</source>
|
<source>SMESH_ERR_MESH_NAME_NOT_SPECIFIED</source>
|
||||||
|
Loading…
Reference in New Issue
Block a user