#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_MultiEditDlg.h"
#include "SMESHGUI_GroupOpDlg.h"
+#include "SMESHGUI_GroupOnShapeDlg.h"
#include "SMESHGUI_DeleteGroupDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_RenumberingDlg.h"
if( aSel )
aSel->selectedObjects( selected );
- if(selected.Extent()){
- Handle(SALOME_InteractiveObject) anIObject = selected.First();
- SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
- if ( !aMesh->_is_nil() ) {
- QString aFilter, aTitle = QObject::tr("Export mesh");
- QMap<QString, SMESH::MED_VERSION> aFilterMap;
- QMap<QString, int> aFilterMapSTL;
- switch ( theCommandID ) {
- case 125:
- case 122:
- {
- if (aMesh->HasDuplicatedGroupNamesMED()) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
- // PAL18696
- QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
- QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
- aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
- aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
- }
- break;
- case 124:
- case 121:
- aFilter = QObject::tr("DAT files (*.dat)");
- break;
- case 126:
- case 123:
- {
- if (aMesh->NbPyramids()) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
- aFilter = QObject::tr("IDEAS files (*.unv)");
- }
- break;
- case 140:
- case 141:
- {
- // export STL
- /*
- there must be check on others mesh elements not equal triangles
- */
- if (aMesh->NbTriangles() < 1) {
- SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
- return;
- }
- if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
- int aRet = SUIT_MessageBox::warning
- (SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes)
- return;
- }
+ SMESH::SMESH_Mesh_var aMesh;
+ if(selected.Extent() == 1)
+ aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(selected.First());
+ if ( aMesh->_is_nil() ) {
+ SUIT_MessageBox::warning( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_WRN_WARNING" ),
+ QObject::tr( "SMESH_BAD_MESH_SELECTION" ));
+ return;
+ }
- aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode
- aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode
- }
- break;
- default:
- return;
- }
+ Handle(SALOME_InteractiveObject) anIObject = selected.First();
+ QString aFilter, aTitle = QObject::tr("Export mesh");
+ QMap<QString, SMESH::MED_VERSION> aFilterMap;
+ QMap<QString, int> aFilterMapSTL;
+ switch ( theCommandID ) {
+ case 125:
+ case 122:
+ {
+ if (aMesh->HasDuplicatedGroupNamesMED()) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
+ // PAL18696
+ QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
+ QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
+ aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
+ aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
+ }
+ break;
+ case 124:
+ case 121:
+ aFilter = QObject::tr("DAT files (*.dat)");
+ break;
+ case 126:
+ case 123:
+ {
+ if (aMesh->NbPyramids()) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
+ aFilter = QObject::tr("IDEAS files (*.unv)");
+ }
+ break;
+ case 140:
+ case 141:
+ {
+ // export STL
+ /*
+ there must be check on others mesh elements not equal triangles
+ */
+ if (aMesh->NbTriangles() < 1) {
+ SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
+ return;
+ }
+ if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
+ int aRet = SUIT_MessageBox::warning
+ (SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes)
+ return;
+ }
- QString aFilename;
- SMESH::MED_VERSION aFormat;
- // Init the parameter with the default value
- bool aIsASCII_STL = true;
- bool toCreateGroups = false;
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- if ( resMgr )
- toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
-
- QString anInitialPath = "";
- if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
- anInitialPath = QDir::currentPath();
-
- if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
- if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
- aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
- aFilter, aTitle, false);
- }
- else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
- QStringList filters;
- QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
- for ( ; it != aFilterMapSTL.end(); ++it )
- filters.push_back( it.key() );
-
- SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
- fd->setWindowTitle( aTitle );
- fd->setFilters( filters );
- fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
- if ( !anInitialPath.isEmpty() )
- fd->setDirectory( anInitialPath );
- fd->selectFile(anIObject->getName());
- bool is_ok = false;
- while (!is_ok) {
- if ( fd->exec() )
- aFilename = fd->selectedFile();
- aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false;
- is_ok = true;
- }
- delete fd;
- }
- else { // Export to MED
- QStringList filters;
- QString aDefaultFilter;
- QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
- for ( ; it != aFilterMap.end(); ++it ) {
- filters.push_back( it.key() );
- if (it.value() == SMESH::MED_V2_2)
- aDefaultFilter = it.key();
- }
+ aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode
+ aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode
+ }
+ break;
+ default:
+ return;
+ }
- //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
- SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
- ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
- fd->setWindowTitle( aTitle );
- fd->setFilters( filters );
- //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
- fd->selectFilter(aDefaultFilter);
- fd->SetChecked(toCreateGroups);
- if ( !anInitialPath.isEmpty() )
- fd->setDirectory( anInitialPath );
- fd->selectFile(anIObject->getName());
- bool is_ok = false;
- while (!is_ok) {
- if ( fd->exec() )
- aFilename = fd->selectedFile();
- aFormat = aFilterMap[fd->selectedFilter()];
- is_ok = true;
- if ( !aFilename.isEmpty()
- && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
- && aFormat==SMESH::MED_V2_1) {
- int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
- if (aRet != SUIT_MessageBox::Yes) {
- is_ok = false;
- }
- }
+ QString aFilename;
+ SMESH::MED_VERSION aFormat;
+ // Init the parameter with the default value
+ bool aIsASCII_STL = true;
+ bool toCreateGroups = false;
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( resMgr )
+ toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
+
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+
+ if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
+ if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
+ aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
+ aFilter, aTitle, false);
+ }
+ else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
+ QStringList filters;
+ QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
+ for ( ; it != aFilterMapSTL.end(); ++it )
+ filters.push_back( it.key() );
+
+ SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+ fd->setWindowTitle( aTitle );
+ fd->setFilters( filters );
+ fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
+ bool is_ok = false;
+ while (!is_ok) {
+ if ( fd->exec() )
+ aFilename = fd->selectedFile();
+ aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false;
+ is_ok = true;
+ }
+ delete fd;
+ }
+ else { // Export to MED
+ QStringList filters;
+ QString aDefaultFilter;
+ QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
+ for ( ; it != aFilterMap.end(); ++it ) {
+ filters.push_back( it.key() );
+ if (it.value() == SMESH::MED_V2_2)
+ aDefaultFilter = it.key();
+ }
+
+ //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
+ ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
+ fd->setWindowTitle( aTitle );
+ fd->setFilters( filters );
+ //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+ fd->selectFilter(aDefaultFilter);
+ fd->SetChecked(toCreateGroups);
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
+ bool is_ok = false;
+ while (!is_ok) {
+ if ( fd->exec() )
+ aFilename = fd->selectedFile();
+ aFormat = aFilterMap[fd->selectedFilter()];
+ is_ok = true;
+ if ( !aFilename.isEmpty()
+ && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
+ && aFormat==SMESH::MED_V2_1) {
+ int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
+ if (aRet != SUIT_MessageBox::Yes) {
+ is_ok = false;
}
- toCreateGroups = fd->IsChecked();
- delete fd;
}
- if ( !aFilename.isEmpty() ) {
- // Check whether the file already exists and delete it if yes
- QFile aFile( aFilename );
- if ( aFile.exists() )
- aFile.remove();
- SUIT_OverrideCursor wc;
-
- try {
- bool Renumber = false;
- // PAL 14172 : Check of we have to renumber or not from the preferences before export
- if (resMgr)
- Renumber= resMgr->booleanValue("SMESH","renumbering");
- if (Renumber){
- SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
- aMeshEditor->RenumberNodes();
- aMeshEditor->RenumberElements();
- if ( SMESHGUI::automaticUpdate() )
- SMESH::UpdateView();
- }
- switch ( theCommandID ) {
- case 125:
- case 122:
- aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
- break;
- case 124:
- case 121:
- aMesh->ExportDAT( aFilename.toLatin1().data() );
- break;
- case 126:
- case 123:
- aMesh->ExportUNV( aFilename.toLatin1().data() );
- break;
- case 140:
- case 141:
- aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
- break;
- default:
- break;
- }
- }
- catch (const SALOME::SALOME_Exception& S_ex){
- wc.suspend();
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_EXPORT_FAILED"));
- wc.resume();
- }
- }
+ }
+ toCreateGroups = fd->IsChecked();
+ delete fd;
+ }
+ if ( !aFilename.isEmpty() ) {
+ // Check whether the file already exists and delete it if yes
+ QFile aFile( aFilename );
+ if ( aFile.exists() )
+ aFile.remove();
+ SUIT_OverrideCursor wc;
+
+ try {
+ bool Renumber = false;
+ // PAL 14172 : Check of we have to renumber or not from the preferences before export
+ if (resMgr)
+ Renumber= resMgr->booleanValue("SMESH","renumbering");
+ if (Renumber){
+ SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
+ aMeshEditor->RenumberNodes();
+ aMeshEditor->RenumberElements();
+ if ( SMESHGUI::automaticUpdate() )
+ SMESH::UpdateView();
+ }
+ switch ( theCommandID ) {
+ case 125:
+ case 122:
+ aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
+ break;
+ case 124:
+ case 121:
+ aMesh->ExportDAT( aFilename.toLatin1().data() );
+ break;
+ case 126:
+ case 123:
+ aMesh->ExportUNV( aFilename.toLatin1().data() );
+ break;
+ case 140:
+ case 141:
+ aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
+ break;
+ default:
+ break;
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex){
+ wc.suspend();
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_EXPORT_FAILED"));
+ wc.resume();
}
}
}
_PTR(AttributeIOR) anIOR;
int objectCount = 0;
+ QString aNameList;
QString aParentComponent = QString::null;
+ Handle(SALOME_InteractiveObject) anIO;
for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
{
- _PTR(SObject) aSO = aStudy->FindObjectID(anIt.Value()->getEntry());
+ anIO = anIt.Value();
+ QString cur = anIO->getComponentDataType();
+ _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
if (aSO) {
- // check if object is not reference
- _PTR(SObject) refobj;
- if ( !aSO->ReferencedObject( refobj ) )
- objectCount++;
+ // check if object is reference
+ _PTR(SObject) aRefSObj;
+ aNameList.append("\n - ");
+ if ( aSO->ReferencedObject( aRefSObj ) ) {
+ QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
+ aNameList.append( aRefName );
+ cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
+ }
+ else
+ aNameList.append(anIO->getName());
+ objectCount++;
}
- QString cur = anIt.Value()->getComponentDataType();
if( aParentComponent.isNull() )
aParentComponent = cur;
else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
if (SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_REALLY_DELETE"),
+ QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ),
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
return;
if ( engineIOR() == anIOR->Value().c_str() )
continue;
}
-
- _PTR(SObject) refobj;
- if ( aSO && aSO->ReferencedObject( refobj ) )
- continue; // skip references
+ //Check the referenced object
+ _PTR(SObject) aRefSObject;
+ if ( aSO && aSO->ReferencedObject( aRefSObject ) )
+ aSO = aRefSObject; // Delete main Object instead of reference
// put the whole hierarchy of sub-objects of the selected SO into a list and
// then treat them all starting from the deepest objects (at list back)
}*/
break;
}
+ case 806: // CREATE GEO GROUP
+ {
+ startOperation( 806 );
+ break;
+ }
case 801: // CREATE GROUP
{
if ( !vtkwnd )
createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
+ createSMESHAction( 806, "CREATE_GEO_GROUP","ICON_CREATE_GEO_GROUP" );
createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" );
createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
createMenu( separator(), fileId );
- int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
- exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
+ int importId = createMenu( tr( "MEN_IMPORT" ), fileId, -1, 10 ),
+ exportId = createMenu( tr( "MEN_EXPORT" ), fileId, -1, 10 ),
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
createMenu( 701, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 801, meshId, -1 );
+ createMenu( 806, meshId, -1 );
createMenu( 802, meshId, -1 );
createMenu( 803, meshId, -1 );
createMenu( separator(), meshId, -1 );
createTool( 701, meshTb );
createTool( separator(), meshTb );
createTool( 801, meshTb );
+ createTool( 806, meshTb );
createTool( 802, meshTb );
createTool( 803, meshTb );
createTool( separator(), meshTb );
createPopupItem( 903, OB, mesh_group ); // WHAT_IS
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 801, OB, mesh ); // CREATE_GROUP
+ createPopupItem( 806, OB, mesh ); // CREATE_GEO_GROUP
createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS
case 704: // Edit mesh/sub-mesh
op = new SMESHGUI_MeshOp( false );
break;
+ case 806: // Create group on geom
+ op = new SMESHGUI_GroupOnShapeOp();
+ break;
case 417: //convert to quadratic
op = new SMESHGUI_ConvToQuadOp();
break;