mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
0020876: EDF 1246 SMESH: DoubleNodes fonctions available in the GUI
Allow multiple selection of groups as input
This commit is contained in:
parent
e4f7dd39cd
commit
e30e3628ce
@ -772,27 +772,27 @@ module SMESH
|
|||||||
* they not assigned to elements
|
* they not assigned to elements
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
|
* \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
|
boolean DoubleNodes( in long_array theNodes, in long_array theModifiedElems );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
* This method provided for convenience works as DoubleNodes() described above.
|
* This method provided for convenience works as DoubleNodes() described above.
|
||||||
* \param theNodeId - identifier of node to be doubled.
|
* \param theNodeId - identifier of node to be doubled.
|
||||||
* \param theModifiedElems - identifiers of elements to be updated.
|
* \param theModifiedElems - identifiers of elements to be updated.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
|
* \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
|
boolean DoubleNode( in long theNodeId, in long_array theModifiedElems );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
* This method provided for convenience works as DoubleNodes() described above.
|
* This method provided for convenience works as DoubleNodes() described above.
|
||||||
* \param theNodes - group of nodes to be doubled.
|
* \param theNodes - group of nodes to be doubled.
|
||||||
* \param theModifiedElems - group of elements to be updated.
|
* \param theModifiedElems - group of elements to be updated.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups(), DoubleNodeGroupNew()
|
* \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups(), DoubleNodeGroupNew()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
|
boolean DoubleNodeGroup( in SMESH_GroupBase theNodes,
|
||||||
in SMESH_GroupBase theModifiedElems );
|
in SMESH_GroupBase theModifiedElems );
|
||||||
|
|
||||||
@ -809,16 +809,28 @@ module SMESH
|
|||||||
in SMESH_GroupBase theModifiedElems );
|
in SMESH_GroupBase theModifiedElems );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
This method provided for convenience works as DoubleNodes() described above.
|
* This method provided for convenience works as DoubleNodes() described above.
|
||||||
\param theNodes - list of groups of nodes to be doubled
|
* \param theNodes - list of groups of nodes to be doubled
|
||||||
\param theModifiedElems - list of groups of elements to be updated.
|
* \param theModifiedElems - list of groups of elements to be updated.
|
||||||
\return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
\sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
|
* \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeGroups( in ListOfGroups theNodes,
|
boolean DoubleNodeGroups( in ListOfGroups theNodes,
|
||||||
in ListOfGroups theModifiedElems );
|
in ListOfGroups theModifiedElems );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
|
* Works as DoubleNodeGroups() described above, but returns a new group with
|
||||||
|
* newly created nodes.
|
||||||
|
* \param theNodes - list of groups of nodes to be doubled
|
||||||
|
* \param theModifiedElems - list of groups of elements to be updated.
|
||||||
|
* \return a new group with newly created nodes
|
||||||
|
* \sa DoubleNodeGroups()
|
||||||
|
*/
|
||||||
|
SMESH_Group DoubleNodeGroupsNew( in ListOfGroups theNodes,
|
||||||
|
in ListOfGroups theModifiedElems );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
* \param theElems - the list of elements (edges or faces) to be replicated
|
* \param theElems - the list of elements (edges or faces) to be replicated
|
||||||
@ -828,7 +840,7 @@ module SMESH
|
|||||||
* replicated nodes should be associated to.
|
* replicated nodes should be associated to.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodeGroup(), DoubleNodeGroups()
|
* \sa DoubleNodeGroup(), DoubleNodeGroups()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElem( in long_array theElems,
|
boolean DoubleNodeElem( in long_array theElems,
|
||||||
in long_array theNodesNot,
|
in long_array theNodesNot,
|
||||||
in long_array theAffectedElems );
|
in long_array theAffectedElems );
|
||||||
@ -843,7 +855,7 @@ module SMESH
|
|||||||
* The replicated nodes should be associated to affected elements.
|
* The replicated nodes should be associated to affected elements.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
|
* \sa DoubleNodeGroupInRegion(), DoubleNodeGroupsInRegion()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElemInRegion( in long_array theElems,
|
boolean DoubleNodeElemInRegion( in long_array theElems,
|
||||||
in long_array theNodesNot,
|
in long_array theNodesNot,
|
||||||
in GEOM::GEOM_Object theShape );
|
in GEOM::GEOM_Object theShape );
|
||||||
@ -857,7 +869,7 @@ module SMESH
|
|||||||
* should be associated to.
|
* should be associated to.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
|
* \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
|
boolean DoubleNodeElemGroup( in SMESH_GroupBase theElems,
|
||||||
in SMESH_GroupBase theNodesNot,
|
in SMESH_GroupBase theNodesNot,
|
||||||
in SMESH_GroupBase theAffectedElems );
|
in SMESH_GroupBase theAffectedElems );
|
||||||
@ -872,7 +884,7 @@ module SMESH
|
|||||||
* should be associated to.
|
* should be associated to.
|
||||||
* \return a new group with newly created elements
|
* \return a new group with newly created elements
|
||||||
* \sa DoubleNodeElemGroup()
|
* \sa DoubleNodeElemGroup()
|
||||||
*/
|
*/
|
||||||
SMESH_Group DoubleNodeElemGroupNew( in SMESH_GroupBase theElems,
|
SMESH_Group DoubleNodeElemGroupNew( in SMESH_GroupBase theElems,
|
||||||
in SMESH_GroupBase theNodesNot,
|
in SMESH_GroupBase theNodesNot,
|
||||||
in SMESH_GroupBase theAffectedElems );
|
in SMESH_GroupBase theAffectedElems );
|
||||||
@ -887,7 +899,7 @@ module SMESH
|
|||||||
* The replicated nodes should be associated to affected elements.
|
* The replicated nodes should be associated to affected elements.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
|
* \sa DoubleNodesInRegion(), DoubleNodeGroupsInRegion()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems,
|
boolean DoubleNodeElemGroupInRegion( in SMESH_GroupBase theElems,
|
||||||
in SMESH_GroupBase theNodesNot,
|
in SMESH_GroupBase theNodesNot,
|
||||||
in GEOM::GEOM_Object theShape );
|
in GEOM::GEOM_Object theShape );
|
||||||
@ -901,7 +913,7 @@ module SMESH
|
|||||||
* should be associated to.
|
* should be associated to.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
|
* \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElemGroups( in ListOfGroups theElems,
|
boolean DoubleNodeElemGroups( in ListOfGroups theElems,
|
||||||
in ListOfGroups theNodesNot,
|
in ListOfGroups theNodesNot,
|
||||||
in ListOfGroups theAffectedElems );
|
in ListOfGroups theAffectedElems );
|
||||||
@ -916,7 +928,7 @@ module SMESH
|
|||||||
* should be associated to.
|
* should be associated to.
|
||||||
* \return a new group with newly created elements
|
* \return a new group with newly created elements
|
||||||
* \sa DoubleNodeElemGroups()
|
* \sa DoubleNodeElemGroups()
|
||||||
*/
|
*/
|
||||||
SMESH_Group DoubleNodeElemGroupsNew( in ListOfGroups theElems,
|
SMESH_Group DoubleNodeElemGroupsNew( in ListOfGroups theElems,
|
||||||
in ListOfGroups theNodesNot,
|
in ListOfGroups theNodesNot,
|
||||||
in ListOfGroups theAffectedElems );
|
in ListOfGroups theAffectedElems );
|
||||||
@ -931,7 +943,7 @@ module SMESH
|
|||||||
* The replicated nodes should be associated to affected elements.
|
* The replicated nodes should be associated to affected elements.
|
||||||
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
* \return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
|
* \sa DoubleNodeGroupInRegion(), DoubleNodesInRegion()
|
||||||
*/
|
*/
|
||||||
boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems,
|
boolean DoubleNodeElemGroupsInRegion( in ListOfGroups theElems,
|
||||||
in ListOfGroups theNodesNot,
|
in ListOfGroups theNodesNot,
|
||||||
in GEOM::GEOM_Object theShape );
|
in GEOM::GEOM_Object theShape );
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
#include <SALOME_ListIO.hxx>
|
#include <SALOME_ListIO.hxx>
|
||||||
|
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -70,6 +71,22 @@
|
|||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 11
|
#define MARGIN 11
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class BusyLocker
|
||||||
|
\brief Simple 'busy state' flag locker.
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BusyLocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor. Sets passed boolean flag to \c true.
|
||||||
|
BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
|
||||||
|
//! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
|
||||||
|
~BusyLocker() { myBusy = false; }
|
||||||
|
private:
|
||||||
|
bool& myBusy; //! External 'busy state' boolean flag
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor
|
\brief Constructor
|
||||||
@ -218,14 +235,15 @@ SMESHGUI_DuplicateNodesDlg::~SMESHGUI_DuplicateNodesDlg()
|
|||||||
void SMESHGUI_DuplicateNodesDlg::Init()
|
void SMESHGUI_DuplicateNodesDlg::Init()
|
||||||
{
|
{
|
||||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||||
|
myCheckBoxNewGroup->setChecked(true);
|
||||||
|
|
||||||
// Set initial parameters
|
// Set initial parameters
|
||||||
myBusy = false;
|
myBusy = false;
|
||||||
myCurrentLineEdit = myLineEdit1;
|
myCurrentLineEdit = myLineEdit1;
|
||||||
|
|
||||||
myGroup1 = SMESH::SMESH_GroupBase::_nil();
|
myGroups1.clear();
|
||||||
myGroup2 = SMESH::SMESH_GroupBase::_nil();
|
myGroups2.clear();
|
||||||
myGroup3 = SMESH::SMESH_GroupBase::_nil();
|
myGroups3.clear();
|
||||||
|
|
||||||
// Set selection mode
|
// Set selection mode
|
||||||
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
|
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
|
||||||
@ -253,8 +271,9 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
|
|||||||
myLineEdit2->clear();
|
myLineEdit2->clear();
|
||||||
myLineEdit3->clear();
|
myLineEdit3->clear();
|
||||||
|
|
||||||
// Checkbox should be checked by default
|
myGroups1.clear();
|
||||||
myCheckBoxNewGroup->setChecked(true);
|
myGroups2.clear();
|
||||||
|
myGroups3.clear();
|
||||||
|
|
||||||
// Set the first field as current
|
// Set the first field as current
|
||||||
myCurrentLineEdit = myLineEdit1;
|
myCurrentLineEdit = myLineEdit1;
|
||||||
@ -307,10 +326,10 @@ void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
|
|||||||
*/
|
*/
|
||||||
bool SMESHGUI_DuplicateNodesDlg::onApply()
|
bool SMESHGUI_DuplicateNodesDlg::onApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked() || !isValid())
|
if ( mySMESHGUI->isActiveStudyLocked() || !isValid() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
myBusy = true;
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
bool toCreateGroup = myCheckBoxNewGroup->isChecked();
|
bool toCreateGroup = myCheckBoxNewGroup->isChecked();
|
||||||
int operationMode = myGroupConstructors->checkedId();
|
int operationMode = myGroupConstructors->checkedId();
|
||||||
@ -320,28 +339,50 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
|
SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
|
||||||
|
|
||||||
if (operationMode == 0) {
|
if ( operationMode == 0 ) {
|
||||||
if (toCreateGroup) {
|
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
||||||
SMESH::SMESH_GroupBase_ptr aNewGroup =
|
g1->length( myGroups1.count() );
|
||||||
aMeshEditor->DoubleNodeGroupNew(myGroup1, myGroup2);
|
for ( int i = 0; i < myGroups1.count(); i++ )
|
||||||
if (!CORBA::is_nil(aNewGroup))
|
g1[i] = myGroups1[i];
|
||||||
result = true;
|
SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
|
||||||
|
g2->length( myGroups2.count() );
|
||||||
|
for ( int i = 0; i < myGroups2.count(); i++ )
|
||||||
|
g2[i] = myGroups2[i];
|
||||||
|
|
||||||
|
if ( toCreateGroup ) {
|
||||||
|
SMESH::SMESH_GroupBase_var aNewGroup =
|
||||||
|
aMeshEditor->DoubleNodeGroupsNew( g1.in(), g2.in() );
|
||||||
|
result = !CORBA::is_nil( aNewGroup );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
result = aMeshEditor->DoubleNodeGroup(myGroup1, myGroup2);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (toCreateGroup) {
|
SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
|
||||||
|
g1->length( myGroups1.count() );
|
||||||
|
for ( int i = 0; i < myGroups1.count(); i++ )
|
||||||
|
g1[i] = myGroups1[i];
|
||||||
|
SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
|
||||||
|
g2->length( myGroups2.count() );
|
||||||
|
for ( int i = 0; i < myGroups2.count(); i++ )
|
||||||
|
g2[i] = myGroups2[i];
|
||||||
|
SMESH::ListOfGroups_var g3 = new SMESH::ListOfGroups();
|
||||||
|
g3->length( myGroups3.count() );
|
||||||
|
|
||||||
|
for ( int i = 0; i < myGroups3.count(); i++ )
|
||||||
|
g3[i] = myGroups3[i];
|
||||||
|
if ( toCreateGroup ) {
|
||||||
SMESH::SMESH_GroupBase_ptr aNewGroup =
|
SMESH::SMESH_GroupBase_ptr aNewGroup =
|
||||||
aMeshEditor->DoubleNodeElemGroupNew(myGroup1, myGroup2, myGroup3);
|
aMeshEditor->DoubleNodeElemGroupsNew( g1.in(), g2.in(), g3.in() );
|
||||||
if (!CORBA::is_nil(aNewGroup))
|
result = !CORBA::is_nil( aNewGroup );
|
||||||
result = true;
|
}
|
||||||
|
else {
|
||||||
|
result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
result = aMeshEditor->DoubleNodeElemGroup(myGroup1, myGroup2, myGroup3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
@ -358,7 +399,6 @@ bool SMESHGUI_DuplicateNodesDlg::onApply()
|
|||||||
SUIT_MessageBox::warning(this,
|
SUIT_MessageBox::warning(this,
|
||||||
tr("SMESH_WRN_WARNING"),
|
tr("SMESH_WRN_WARNING"),
|
||||||
tr("SMESH_OPERATION_FAILED"));
|
tr("SMESH_OPERATION_FAILED"));
|
||||||
myBusy = false;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,64 +440,67 @@ void SMESHGUI_DuplicateNodesDlg::onClose()
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
|
void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
|
||||||
{
|
{
|
||||||
if (myBusy || !isEnabled()) return;
|
if ( myBusy || !isEnabled() ) return;
|
||||||
|
|
||||||
// Try to get selected group
|
int operationMode = myGroupConstructors->checkedId();
|
||||||
|
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
mySelectionMgr->selectedObjects( aList );
|
mySelectionMgr->selectedObjects( aList );
|
||||||
int aNbSel = aList.Extent();
|
int aNbSel = aList.Extent();
|
||||||
|
|
||||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_nil();
|
QList<SMESH::SMESH_GroupBase_var> aGroups;
|
||||||
if (aNbSel == 1) {
|
|
||||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
|
||||||
aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
|
||||||
|
|
||||||
// Check group type
|
SALOME_ListIteratorOfListIO anIter ( aList );
|
||||||
if (!CORBA::is_nil(aGroup)) {
|
bool ok = true;
|
||||||
int operationMode = myGroupConstructors->checkedId();
|
for ( ; anIter.More() && ok; anIter.Next()) {
|
||||||
SMESH::ElementType aGroupType = aGroup->GetType();
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
|
||||||
bool isTypeValid = true;
|
// check group is selected
|
||||||
|
ok = !CORBA::is_nil( aGroup );
|
||||||
if (operationMode == 0) {
|
// check groups of the same mesh are selected
|
||||||
if ( (myCurrentLineEdit == myLineEdit1 && aGroupType != SMESH::NODE) ||
|
if ( ok ) {
|
||||||
(myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE) )
|
SMESH::SMESH_Mesh_var aMesh1;
|
||||||
isTypeValid = false;
|
if ( !aGroups.isEmpty() ) aMesh1 = aGroups[0]->GetMesh();
|
||||||
}
|
SMESH::SMESH_Mesh_var aMesh2 = aGroup->GetMesh();
|
||||||
else if (operationMode == 1) {
|
ok = CORBA::is_nil( aMesh1 ) || aMesh1->_is_equivalent( aMesh2 );
|
||||||
if ( (myCurrentLineEdit == myLineEdit1 && aGroupType != SMESH::EDGE &&
|
|
||||||
aGroupType != SMESH::FACE) ||
|
|
||||||
(myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE) ||
|
|
||||||
(myCurrentLineEdit == myLineEdit3 && aGroupType == SMESH::NODE) )
|
|
||||||
isTypeValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isTypeValid)
|
|
||||||
aGroup = SMESH::SMESH_GroupBase::_nil();
|
|
||||||
}
|
}
|
||||||
|
// check group of proper type is selected
|
||||||
|
if ( ok ) {
|
||||||
|
SMESH::ElementType aGroupType = aGroup->GetType();
|
||||||
|
if ( operationMode == 0 ) {
|
||||||
|
ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
|
||||||
|
( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
|
||||||
|
aGroupType == SMESH::FACE ) ) ||
|
||||||
|
( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE ) ||
|
||||||
|
( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ok ) aGroups << aGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear current field
|
// Clear current field
|
||||||
myCurrentLineEdit->clear();
|
myCurrentLineEdit->clear();
|
||||||
|
|
||||||
// Set corresponding SMESH group
|
if ( ok && !aGroups.isEmpty() ) {
|
||||||
if (myCurrentLineEdit == myLineEdit1) {
|
if ( myCurrentLineEdit == myLineEdit1 ) myGroups1 = aGroups;
|
||||||
myGroup1 = SMESH::SMESH_Group::_narrow(aGroup);
|
else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2 = aGroups;
|
||||||
|
else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3 = aGroups;
|
||||||
|
myCurrentLineEdit->setText( aGroups.count() == 1 ? aGroups[0]->GetName() :
|
||||||
|
QObject::tr( "SMESH_OBJECTS_SELECTED" ).arg( aGroups.count() ) );
|
||||||
}
|
}
|
||||||
else if (myCurrentLineEdit == myLineEdit2) {
|
else {
|
||||||
myGroup2 = SMESH::SMESH_Group::_narrow(aGroup);
|
if ( myCurrentLineEdit == myLineEdit1 ) myGroups1.clear();
|
||||||
|
else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2.clear();
|
||||||
|
else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3.clear();
|
||||||
|
myCurrentLineEdit->clear();
|
||||||
}
|
}
|
||||||
else if (myCurrentLineEdit == myLineEdit3) {
|
|
||||||
myGroup3 = SMESH::SMESH_Group::_narrow(aGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set group name
|
|
||||||
if (!CORBA::is_nil(aGroup))
|
|
||||||
myCurrentLineEdit->setText(aGroup->GetName());
|
|
||||||
|
|
||||||
// Enable/disable "Apply and Close" and "Apply" buttons
|
// Enable/disable "Apply and Close" and "Apply" buttons
|
||||||
bool isDataValid = isValid();
|
bool isDataValid = isValid();
|
||||||
myButtonOk->setEnabled(isDataValid);
|
myButtonOk->setEnabled( isDataValid );
|
||||||
myButtonApply->setEnabled(isDataValid);
|
myButtonApply->setEnabled( isDataValid );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -488,14 +531,9 @@ void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument()
|
|||||||
*/
|
*/
|
||||||
bool SMESHGUI_DuplicateNodesDlg::isValid()
|
bool SMESHGUI_DuplicateNodesDlg::isValid()
|
||||||
{
|
{
|
||||||
// Only first group (nodes/elemets to duplicate) is mandatory
|
return myGroupConstructors->checkedId() == 1 ?
|
||||||
bool isValid = !CORBA::is_nil(myGroup1);
|
( !myGroups1.isEmpty() && !myGroups3.isEmpty() ) :
|
||||||
|
( !myGroups1.isEmpty() );
|
||||||
// First (elements to duplicate) and last groups should be defined in the second operation mode
|
|
||||||
if (isValid && myGroupConstructors->checkedId() == 1)
|
|
||||||
isValid = !CORBA::is_nil(myGroup3);
|
|
||||||
|
|
||||||
return isValid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,9 +107,9 @@ private:
|
|||||||
SMESHGUI* mySMESHGUI;
|
SMESHGUI* mySMESHGUI;
|
||||||
LightApp_SelectionMgr* mySelectionMgr;
|
LightApp_SelectionMgr* mySelectionMgr;
|
||||||
|
|
||||||
SMESH::SMESH_GroupBase_var myGroup1;
|
QList<SMESH::SMESH_GroupBase_var> myGroups1;
|
||||||
SMESH::SMESH_GroupBase_var myGroup2;
|
QList<SMESH::SMESH_GroupBase_var> myGroups2;
|
||||||
SMESH::SMESH_GroupBase_var myGroup3;
|
QList<SMESH::SMESH_GroupBase_var> myGroups3;
|
||||||
|
|
||||||
bool myBusy;
|
bool myBusy;
|
||||||
|
|
||||||
|
@ -1195,8 +1195,10 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
}
|
}
|
||||||
// DoubleNodeElemGroupNew() -> DoubleNodeElemGroup()
|
// DoubleNodeElemGroupNew() -> DoubleNodeElemGroup()
|
||||||
// DoubleNodeGroupNew() -> DoubleNodeGroup()
|
// DoubleNodeGroupNew() -> DoubleNodeGroup()
|
||||||
|
// DoubleNodeGroupsNew() -> DoubleNodeGroups()
|
||||||
// DoubleNodeElemGroupsNew() -> DoubleNodeElemGroups()
|
// DoubleNodeElemGroupsNew() -> DoubleNodeElemGroups()
|
||||||
if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeGroupNew" || method == "DoubleNodeElemGroupsNew"))
|
if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeElemGroupsNew" ||
|
||||||
|
method == "DoubleNodeGroupNew" || method == "DoubleNodeGroupsNew"))
|
||||||
{
|
{
|
||||||
isPyMeshMethod=true;
|
isPyMeshMethod=true;
|
||||||
theCommand->SetMethod( method.SubString( 1, method.Length()-3));
|
theCommand->SetMethod( method.SubString( 1, method.Length()-3));
|
||||||
|
@ -4898,6 +4898,45 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(const SMESH::ListOfGroups& t
|
|||||||
return aResult;
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
|
||||||
|
* Works as DoubleNodeGroups(), but returns a new group with newly created nodes.
|
||||||
|
* \param theNodes - group of nodes to be doubled.
|
||||||
|
* \param theModifiedElems - group of elements to be updated.
|
||||||
|
* \return a new group with newly created nodes
|
||||||
|
* \sa DoubleNodeGroups()
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
SMESH::SMESH_Group_ptr SMESH_MeshEditor_i::DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
|
||||||
|
const SMESH::ListOfGroups& theModifiedElems )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_Group_var aNewGroup;
|
||||||
|
|
||||||
|
TPythonDump pyDump; // suppress dump by the next line
|
||||||
|
|
||||||
|
bool aResult = DoubleNodeGroups( theNodes, theModifiedElems );
|
||||||
|
|
||||||
|
if ( aResult )
|
||||||
|
{
|
||||||
|
// Create group with newly created nodes
|
||||||
|
SMESH::long_array_var anIds = GetLastCreatedNodes();
|
||||||
|
if (anIds->length() > 0) {
|
||||||
|
string anUnindexedName (theNodes[0]->GetName());
|
||||||
|
string aNewName = generateGroupName(anUnindexedName + "_double");
|
||||||
|
aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
|
||||||
|
aNewGroup->Add(anIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pyDump << "createdNodes = " << this << ".DoubleNodeGroupsNew( " << theNodes << ", "
|
||||||
|
<< theModifiedElems << " )";
|
||||||
|
|
||||||
|
return aNewGroup._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
|
@ -569,7 +569,10 @@ public:
|
|||||||
SMESH::SMESH_GroupBase_ptr theModifiedElems );
|
SMESH::SMESH_GroupBase_ptr theModifiedElems );
|
||||||
|
|
||||||
CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
|
CORBA::Boolean DoubleNodeGroups( const SMESH::ListOfGroups& theNodes,
|
||||||
const SMESH::ListOfGroups& theModifiedElems);
|
const SMESH::ListOfGroups& theModifiedElems );
|
||||||
|
|
||||||
|
SMESH::SMESH_Group_ptr DoubleNodeGroupsNew( const SMESH::ListOfGroups& theNodes,
|
||||||
|
const SMESH::ListOfGroups& theModifiedElems );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
|
@ -4031,7 +4031,9 @@ class Mesh:
|
|||||||
# @param theModifiedElems list of groups of elements to be updated.
|
# @param theModifiedElems list of groups of elements to be updated.
|
||||||
# @return TRUE if operation has been completed successfully, FALSE otherwise
|
# @return TRUE if operation has been completed successfully, FALSE otherwise
|
||||||
# @ingroup l2_modif_edit
|
# @ingroup l2_modif_edit
|
||||||
def DoubleNodeGroups(self, theNodes, theModifiedElems):
|
def DoubleNodeGroups(self, theNodes, theModifiedElems, theMakeGroup=False):
|
||||||
|
if theMakeGroup:
|
||||||
|
return self.editor.DoubleNodeGroupsNew(theNodes, theModifiedElems)
|
||||||
return self.editor.DoubleNodeGroups(theNodes, theModifiedElems)
|
return self.editor.DoubleNodeGroups(theNodes, theModifiedElems)
|
||||||
|
|
||||||
## Creates a hole in a mesh by doubling the nodes of some particular elements
|
## Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||||
|
Loading…
Reference in New Issue
Block a user