void Mirror (in long_array IDsOfElements,
in AxisStruct Mirror,
- in MirrorType theMirrorType,
+ in MirrorType Type,
in boolean Copy);
ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
in AxisStruct Mirror,
- in MirrorType theMirrorType);
+ in MirrorType Type);
+ SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
+ in AxisStruct Mirror,
+ in MirrorType Type,
+ in boolean CopyGroups,
+ in string MeshName);
void MirrorObject (in SMESH_IDSource theObject,
in AxisStruct Mirror,
- in MirrorType theMirrorType,
+ in MirrorType Type,
in boolean Copy);
ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
in AxisStruct Mirror,
- in MirrorType theMirrorType);
+ in MirrorType Type);
+ SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
+ in AxisStruct Mirror,
+ in MirrorType Type,
+ in boolean CopyGroups,
+ in string MeshName);
void Translate (in long_array IDsOfElements,
in DirStruct Vector,
in boolean Copy);
ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
in DirStruct Vector);
+ SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
+ in DirStruct Vector,
+ in boolean CopyGroups,
+ in string MeshName);
void TranslateObject (in SMESH_IDSource theObject,
in DirStruct Vector,
in boolean Copy);
ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
in DirStruct Vector);
+ SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
+ in DirStruct Vector,
+ in boolean CopyGroups,
+ in string MeshName);
void Rotate (in long_array IDsOfElements,
in AxisStruct Axis,
ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
in AxisStruct Axis,
in double AngleInRadians);
+ SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
+ in AxisStruct Axis,
+ in double AngleInRadians,
+ in boolean CopyGroups,
+ in string MeshName);
void RotateObject (in SMESH_IDSource theObject,
in AxisStruct Axis,
ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
in AxisStruct Axis,
in double AngleInRadians);
+ SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
+ in AxisStruct Axis,
+ in double AngleInRadians,
+ in boolean CopyGroups,
+ in string MeshName);
void FindCoincidentNodes (in double Tolerance,
out array_of_long_array GroupsOfNodes);
#include "SVTK_Selector.h"
#include "SVTK_Selection.h"
#include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
#include "utilities.h"
using namespace std;
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
//=================================================================================
// class : SMESHGUI_RotationDlg()
// purpose :
// Controls for elements selection
TextLabelElements = new QLabel(GroupArguments, "TextLabelElements");
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
- TextLabelElements->setFixedWidth(74);
+ //TextLabelElements->setFixedWidth(74);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton");
SelectElementsButton->setToggleButton(FALSE);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
+ LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 3);
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
- GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3);
// Controls for axis defining
GroupAxis = new QGroupBox(GroupArguments, "GroupAxis");
SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ");
GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7);
- GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
// Controls for angle defining
TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
TextLabelAngle->setText(tr("SMESH_ANGLE"));
- GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
+ GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 2);
SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
- // Controls for "Create a copy" option
- CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
- CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
- GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+ // action switch
+ ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+ ActionGroup->setExclusive(true);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON);
+ GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 2);
// CheckBox for groups generation
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
- GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3);
+
+ // Name of a mesh to create
+ LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+ GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3);
SMESHGUI_RotationDlgLayout->addWidget(GroupArguments, 1, 0);
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
- connect(CheckBoxCopy, SIGNAL(toggled(bool)), SLOT(onCopyChecked(bool)));
+ connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int)));
this->show(); /* displays Dialog */
ConstructorsClicked(0);
+ //SelectionIntoArgument();
+ onActionClicked(MOVE_ELEMS_BUTTON);
resize(0,0); // ??
}
SpinBox_Angle->SetValue(45);
- CheckBoxCopy->setChecked(false);
+ ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
CheckBoxMesh->setChecked(false);
- MakeGroupsCheck->setChecked(false);
- MakeGroupsCheck->setEnabled(false);
+// MakeGroupsCheck->setChecked(false);
+// MakeGroupsCheck->setEnabled(false);
+// onSelectMesh(false);
}
onSelectMesh(CheckBoxMesh->isChecked());
anAxis.vz = SpinBox_DZ->GetValue();
double anAngle = (SpinBox_Angle->GetValue())*PI/180;
- bool toCreateCopy = CheckBoxCopy->isChecked();
-
+ int actionButton = ActionGroup->id( ActionGroup->selected() );
+ bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
try {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
QApplication::setOverrideCursor(Qt::waitCursor);
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->RotateMakeGroups(anElementsId.inout(), anAxis, anAngle);
- else
- aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
+ switch ( actionButton ) {
+ case MOVE_ELEMS_BUTTON:
+ aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
+ break;
+ case COPY_ELEMS_BUTTON:
+ if ( makeGroups )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
+ else
+ aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
+ break;
+ case MAKE_MESH_BUTTON:
+ SMESH::SMESH_Mesh_var mesh =
+ aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
+ LineEditNewMesh->text().latin1());
+ }
QApplication::restoreOverrideCursor();
} catch (...) {
}
SMESH::UpdateView();
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+ actionButton == MAKE_MESH_BUTTON )
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
+ //ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
}
}
MakeGroupsCheck->setChecked(false);
MakeGroupsCheck->setEnabled(false);
}
- else if (CheckBoxCopy->isChecked() ) {
+ else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
MakeGroupsCheck->setEnabled(true);
}
if (CheckBoxMesh->isChecked()) {
}
myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ if (myEditCurrentArgument == (QWidget*)LineEditElements) {
LineEditElements->setText(aString);
+ setNewMeshName();
+ }
myBusy = false;
// OK
}
}
+
//=======================================================================
-//function : onCopyChecked
-//purpose : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose : slot called when an action type changed
//=======================================================================
-void SMESHGUI_RotationDlg::onCopyChecked(bool isOn)
+void SMESHGUI_RotationDlg::onActionClicked(int button)
{
- // enable "MakeGroupsCheck"
- if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
- isOn = false;
- MakeGroupsCheck->setEnabled(isOn);
+ switch ( button ) {
+ case MOVE_ELEMS_BUTTON:
+ MakeGroupsCheck->setEnabled(false);
+ LineEditNewMesh->setEnabled(false);
+ break;
+ case COPY_ELEMS_BUTTON:
+ LineEditNewMesh->setEnabled(false);
+ MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ case MAKE_MESH_BUTTON:
+ LineEditNewMesh->setEnabled(true);
+ MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ }
+ setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose : update contents of LineEditNewMesh
+//=======================================================================
+
+void SMESHGUI_RotationDlg::setNewMeshName()
+{
+ LineEditNewMesh->setText("");
+ if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+ QString name;
+ if ( CheckBoxMesh->isChecked() ) {
+ name = LineEditElements->text();
+ }
+ else {
+ _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+ name = meshSO->GetName();
+ }
+ if ( !name.isEmpty() )
+ LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "rotated"));
+ }
}
//=================================================================================
void hideEvent (QHideEvent*); /* ESC key */
void keyPressEvent(QKeyEvent*);
bool IsAxisOk();
+ void setNewMeshName();
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QLabel* TextLabelAngle;
SMESHGUI_SpinBox* SpinBox_Angle;
- QCheckBox* CheckBoxCopy;
+ //QCheckBox* CheckBoxCopy;
+ QButtonGroup* ActionGroup;
QCheckBox* MakeGroupsCheck;
+ QLineEdit* LineEditNewMesh;
QString myHelpFileName;
void onTextChange (const QString&);
void onSelectMesh (bool toSelectMesh);
void onVectorChanged();
- void onCopyChecked(bool isOn);
+ void onActionClicked(int button);
protected:
QGridLayout* SMESHGUI_RotationDlgLayout;
#include "SVTK_Selector.h"
#include "SVTK_Selection.h"
#include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
#include "utilities.h"
using namespace std;
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
//=================================================================================
// class : SMESHGUI_SymmetryDlg()
// purpose :
//=================================================================================
+
SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* name,
bool modal, WFlags fl)
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
// Controls for elements selection
TextLabelElements = new QLabel(GroupArguments, "TextLabelElements");
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
- TextLabelElements->setFixedWidth(74);
+ //TextLabelElements->setFixedWidth(74);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
+ //GroupArgumentsLayout->addMultiCellWidget(TextLabelElements, 0, 0, 0, 1);
SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton");
SelectElementsButton->setText(tr("" ));
SelectElementsButton->setToggleButton(FALSE);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
+ LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
+ //GroupArgumentsLayout->addWidget(LineEditElements, 0, 3);
+ GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 4);
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
- GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 4);
// Controls for mirror selection
GroupMirror = new QGroupBox(GroupArguments, "GroupMirror");
TextLabelDX = new QLabel(GroupMirror, "TextLabelDX");
TextLabelDX->setText(tr("SMESH_DX"));
+ TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
GroupMirrorLayout->addWidget(TextLabelDX, 1, 2);
SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DX");
TextLabelDY = new QLabel(GroupMirror, "TextLabelDY");
TextLabelDY->setText(tr("SMESH_DY"));
+ TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
GroupMirrorLayout->addWidget(TextLabelDY, 1, 4);
SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DY");
TextLabelDZ = new QLabel(GroupMirror, "TextLabelDZ");
TextLabelDZ->setText(tr("SMESH_DZ"));
+ TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6);
SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DZ");
GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7);
- GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 4);
- // Controls for "Create a copy" option
- CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
- CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
- GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 3, 3, 0, 2);
+ // switch of action type
+ ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+ ActionGroup->setExclusive(true);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON);
+ GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 3, 5, 0, 3);
// CheckBox for groups generation
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
MakeGroupsCheck->setChecked(false);
- GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 4, 4, 0, 2);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 4);
+
+ // Name of a mesh to create
+ LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+ GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 4);
SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments, 1, 0);
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
- connect(CheckBoxCopy, SIGNAL(toggled(bool)), SLOT(onCopyChecked(bool)));
+ connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int)));
this->show(); /* displays Dialog */
ConstructorsClicked(0);
SelectionIntoArgument();
+ onActionClicked(MOVE_ELEMS_BUTTON);
resize(0,0); // ??
}
SpinBox_DY->SetValue(0.0);
SpinBox_DZ->SetValue(0.0);
- CheckBoxCopy->setChecked(false);
+ ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
CheckBoxMesh->setChecked(false);
- MakeGroupsCheck->setChecked(false);
- MakeGroupsCheck->setEnabled(false);
+// MakeGroupsCheck->setChecked(false);
+// MakeGroupsCheck->setEnabled(false);
onSelectMesh(false);
}
}
aMirror.vz = SpinBox_DZ->GetValue();
}
- bool toCreateCopy = CheckBoxCopy->isChecked();
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
if (GetConstructorId() == 2)
aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
+ int actionButton = ActionGroup->id( ActionGroup->selected() );
+ bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+
try {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
QApplication::setOverrideCursor(Qt::waitCursor);
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
- else
- aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
+ switch ( actionButton ) {
+ case MOVE_ELEMS_BUTTON:
+ aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
+ break;
+ case COPY_ELEMS_BUTTON:
+ if ( makeGroups )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
+ else
+ aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
+ break;
+ case MAKE_MESH_BUTTON:
+ SMESH::SMESH_Mesh_var mesh =
+ aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
+ LineEditNewMesh->text().latin1());
+ }
QApplication::restoreOverrideCursor();
} catch (...) {
}
SMESH::UpdateView();
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+ actionButton == MAKE_MESH_BUTTON )
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
ConstructorsClicked(GetConstructorId());
MakeGroupsCheck->setChecked(false);
MakeGroupsCheck->setEnabled(false);
}
- else if (CheckBoxCopy->isChecked() ) {
+ else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
MakeGroupsCheck->setEnabled(true);
}
if (CheckBoxMesh->isChecked()) {
}
myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ if (myEditCurrentArgument == (QWidget*)LineEditElements) {
LineEditElements->setText(aString);
+ setNewMeshName();
+ }
myBusy = false;
// OK
}
//=======================================================================
-//function : onCopyChecked
-//purpose : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose : slot called when an action type changed
//=======================================================================
-void SMESHGUI_SymmetryDlg::onCopyChecked(bool isOn)
+void SMESHGUI_SymmetryDlg::onActionClicked(int button)
{
- // enable "MakeGroupsCheck"
- if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
- isOn = false;
- MakeGroupsCheck->setEnabled(isOn);
+ switch ( button ) {
+ case MOVE_ELEMS_BUTTON:
+ MakeGroupsCheck->setEnabled(false);
+ LineEditNewMesh->setEnabled(false);
+ break;
+ case COPY_ELEMS_BUTTON:
+ LineEditNewMesh->setEnabled(false);
+ MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ case MAKE_MESH_BUTTON:
+ LineEditNewMesh->setEnabled(true);
+ MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ }
+ setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose : update contents of LineEditNewMesh
+//=======================================================================
+
+void SMESHGUI_SymmetryDlg::setNewMeshName()
+{
+ LineEditNewMesh->setText("");
+ if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+ QString name;
+ if ( CheckBoxMesh->isChecked() ) {
+ name = LineEditElements->text();
+ }
+ else {
+ _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+ name = meshSO->GetName();
+ }
+ if ( !name.isEmpty() )
+ LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "mirrored"));
+ }
}
//=================================================================================
void keyPressEvent(QKeyEvent*);
int GetConstructorId();
bool IsMirrorOk();
+ void setNewMeshName();
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QLabel* TextLabelDZ;
SMESHGUI_SpinBox* SpinBox_DZ;
- QCheckBox* CheckBoxCopy;
+ //QCheckBox* CheckBoxCopy;
+ QButtonGroup* ActionGroup;
QCheckBox* MakeGroupsCheck;
+ QLineEdit* LineEditNewMesh;
QString myHelpFileName;
void onTextChange(const QString&);
void onSelectMesh(bool toSelectMesh);
void onVectorChanged();
- void onCopyChecked(bool isOn);
+ void onActionClicked(int button);
protected:
QGridLayout* SMESHGUI_SymmetryDlgLayout;
#include "SVTK_ViewWindow.h"
#include "SVTK_Selector.h"
#include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
#include "utilities.h"
using namespace std;
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
//=================================================================================
// class : SMESHGUI_TranslationDlg()
// purpose :
SelectElementsButton->setToggleButton(FALSE);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
+ LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7);
// Controls for "Create a copy" option
- CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
- CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
- GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+// CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
+// CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
+// GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+
+ // switch of action type
+ ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+ ActionGroup->setExclusive(true);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+ ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON);
+ GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 3);
// CheckBox for groups generation
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
MakeGroupsCheck->setChecked(false);
- GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
+ GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 4, 7);
+
+ // Name of a mesh to create
+ LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+ GroupArgumentsLayout->addMultiCellWidget(LineEditNewMesh, 6, 6, 4, 7);
SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0);
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
- connect(CheckBoxCopy, SIGNAL(toggled(bool)), SLOT(onCopyChecked(bool)));
+ connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int)));
this->show(); /* displays Dialog */
ConstructorsClicked(0);
SelectionIntoArgument();
+ onActionClicked(MOVE_ELEMS_BUTTON);
resize(0,0); // ??
}
SpinBox2_2->SetValue(0.0);
SpinBox2_3->SetValue(0.0);
- CheckBoxCopy->setChecked(false);
+ ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
CheckBoxMesh->setChecked(false);
- MakeGroupsCheck->setChecked(false);
- MakeGroupsCheck->setEnabled(false);
+// MakeGroupsCheck->setChecked(false);
+// MakeGroupsCheck->setEnabled(false);
onSelectMesh(false);
}
}
aVector.PS.z = SpinBox1_3->GetValue();
}
- bool toCreateCopy = CheckBoxCopy->isChecked();
-
+ int actionButton = ActionGroup->id( ActionGroup->selected() );
+ bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
try {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
QApplication::setOverrideCursor(Qt::waitCursor);
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
- SMESH::ListOfGroups_var groups =
- aMeshEditor->TranslateMakeGroups(anElementsId.inout(), aVector);
- else
- aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
+ switch ( actionButton ) {
+ case MOVE_ELEMS_BUTTON:
+ aMeshEditor->Translate(anElementsId, aVector, false);
+ break;
+ case COPY_ELEMS_BUTTON:
+ if ( makeGroups )
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
+ else
+ aMeshEditor->Translate(anElementsId, aVector, true);
+ break;
+ case MAKE_MESH_BUTTON:
+ SMESH::SMESH_Mesh_var mesh =
+ aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
+ LineEditNewMesh->text().latin1());
+ }
QApplication::restoreOverrideCursor();
} catch (...) {
}
SMESH::UpdateView();
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+ if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+ actionButton == MAKE_MESH_BUTTON )
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
ConstructorsClicked(GetConstructorId());
MakeGroupsCheck->setChecked(false);
MakeGroupsCheck->setEnabled(false);
}
- else if (CheckBoxCopy->isChecked() ) {
+ else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
MakeGroupsCheck->setEnabled(true);
}
}
myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ if (myEditCurrentArgument == (QWidget*)LineEditElements) {
LineEditElements->setText(aString);
+ setNewMeshName();
+ }
myBusy = false;
// OK
}
//=======================================================================
-//function : onCopyChecked
-//purpose : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose : slot called when an action type changed
+//=======================================================================
+
+void SMESHGUI_TranslationDlg::onActionClicked(int button)
+{
+ switch ( button ) {
+ case MOVE_ELEMS_BUTTON:
+ MakeGroupsCheck->setEnabled(false);
+ LineEditNewMesh->setEnabled(false);
+ break;
+ case COPY_ELEMS_BUTTON:
+ LineEditNewMesh->setEnabled(false);
+ MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ case MAKE_MESH_BUTTON:
+ LineEditNewMesh->setEnabled(true);
+ MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+ if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+ MakeGroupsCheck->setEnabled(true);
+ else
+ MakeGroupsCheck->setEnabled(false);
+ break;
+ }
+ setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose : update contents of LineEditNewMesh
//=======================================================================
-void SMESHGUI_TranslationDlg::onCopyChecked(bool isOn)
+void SMESHGUI_TranslationDlg::setNewMeshName()
{
- // enable "MakeGroupsCheck"
- if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
- isOn = false;
- MakeGroupsCheck->setEnabled(isOn);
+ LineEditNewMesh->setText("");
+ if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+ QString name;
+ if ( CheckBoxMesh->isChecked() ) {
+ name = LineEditElements->text();
+ }
+ else {
+ _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+ name = meshSO->GetName();
+ }
+ if ( !name.isEmpty() )
+ LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "translated"));
+ }
}
//=================================================================================
void hideEvent (QHideEvent*); /* ESC key */
void keyPressEvent(QKeyEvent*);
int GetConstructorId();
+ void setNewMeshName();
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SMESHGUI_SpinBox* SpinBox2_2;
QLabel* TextLabel2_3;
SMESHGUI_SpinBox* SpinBox2_3;
- QCheckBox* CheckBoxCopy;
+ //QCheckBox* CheckBoxCopy;
+ QButtonGroup* ActionGroup;
QCheckBox* MakeGroupsCheck;
+ QLineEdit* LineEditNewMesh;
QString myHelpFileName;
void ActivateThisDialog() ;
void onTextChange(const QString&);
void onSelectMesh(bool toSelectMesh);
- void onCopyChecked(bool isOn);
+ void onActionClicked(int button);
protected:
QGridLayout* SMESHGUI_TranslationDlgLayout;
const SMESH::AxisStruct & theAxis,
SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
CORBA::Boolean theCopy,
- const bool theMakeGroups)
+ const bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
{
initData();
::SMESH_MeshEditor anEditor( myMesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy) {
storeResult(anEditor);
return mirror(anElementsId, theMirror, theMirrorType, true, true);
}
+//=======================================================================
+//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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
+ {
+ mirror(theIDsOfElements, theMirror, theMirrorType,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".MirrorMakeMesh( "
+ << theIDsOfElements << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ 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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
+ {
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ mirror(anElementsId, theMirror, theMirrorType,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
+ << theObject << ", "
+ << theMirror << ", "
+ << mirrorTypeName(theMirrorType) << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ return mesh._retn();
+}
//=======================================================================
//function : translate
SMESH_MeshEditor_i::translate(const SMESH::long_array & theIDsOfElements,
const SMESH::DirStruct & theVector,
CORBA::Boolean theCopy,
- const bool theMakeGroups)
+ const bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
{
initData();
::SMESH_MeshEditor anEditor( myMesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy)
storeResult(anEditor);
const SMESH::DirStruct& theVector)
{
if ( !myPreviewMode ) {
+ TPythonDump() << "vector = " << theVector;
TPythonDump() << this << ".TranslateObjectMakeGroups( "
<< theObject
<< ", vector )";
return translate(anElementsId, theVector, true, true);
}
+//=======================================================================
+//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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+ translate(theIDsOfElements, theVector,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".TranslateMakeMesh( "
+ << theIDsOfElements << ", "
+ << theVector << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ 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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ translate(anElementsId, theVector,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
+ << theObject << ", "
+ << theVector << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ return mesh._retn();
+}
+
//=======================================================================
//function : rotate
//purpose :
const SMESH::AxisStruct & theAxis,
CORBA::Double theAngle,
CORBA::Boolean theCopy,
- const bool theMakeGroups)
+ const bool theMakeGroups,
+ ::SMESH_Mesh* theTargetMesh)
{
initData();
::SMESH_MeshEditor anEditor( myMesh );
::SMESH_MeshEditor::PGroupIDs groupIds =
- anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+ anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
if(theCopy) {
storeResult(anEditor);
return rotate(anElementsId,theAxis,theAngle,true,true);
}
+//=======================================================================
+//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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+ rotate(theIDsOfElements, theAxis, theAngleInRadians,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".RotateMakeMesh( "
+ << theIDsOfElements << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ return mesh._retn();
+}
+
+//=======================================================================
+//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)
+{
+ TPythonDump pydump; // to prevent dump at mesh creation
+ SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+ if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+ SMESH::long_array_var anElementsId = theObject->GetIDs();
+ rotate(anElementsId, theAxis, theAngleInRadians,
+ false, theCopyGroups, & mesh_i->GetImpl());
+ mesh_i->CreateGroupServants();
+ }
+ if ( !myPreviewMode ) {
+ pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
+ << theObject << ", "
+ << theAxis << ", "
+ << theAngleInRadians << ", "
+ << theCopyGroups << ", '"
+ << theMeshName << "' )";
+ }
+ return mesh._retn();
+}
+
//=======================================================================
//function : FindCoincidentNodes
//purpose :
TPythonDump() << this << ".ConvertFromQuadratic()";
return isDone;
}
+
+//=======================================================================
+//function : makeMesh
+//purpose : create a named imported mesh
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
+{
+ SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
+ SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh();
+ SALOMEDS::Study_var study = gen->GetCurrentStudy();
+ SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, mesh );
+ gen->SetName( meshSO, theMeshName, "Mesh" );
+
+ SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr
+ = builder->FindOrCreateAttribute( meshSO, "AttributePixMap" );
+ SALOMEDS::AttributePixMap::_narrow( anAttr )->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
+
+ return mesh._retn();
+}
const SMESH::AxisStruct& Axis,
CORBA::Double AngleInRadians);
+ SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array& IDsOfElements,
+ const SMESH::AxisStruct& Mirror,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+ SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Mirror,
+ SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+ SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
+ const SMESH::DirStruct& Vector,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+ SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::DirStruct& Vector,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+ SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
+ const SMESH::AxisStruct& Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+ SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
+ const SMESH::AxisStruct& Axis,
+ CORBA::Double AngleInRadians,
+ CORBA::Boolean CopyGroups,
+ const char* MeshName);
+
void FindCoincidentNodes (CORBA::Double Tolerance,
SMESH::array_of_long_array_out GroupsOfNodes);
void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr Object,
const SMESH::AxisStruct & Axis,
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
CORBA::Boolean Copy,
- const bool MakeGroups);
+ const bool MakeGroups,
+ ::SMESH_Mesh* TargetMesh=0);
SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & Vector,
CORBA::Boolean Copy,
- const bool MakeGroups);
+ const bool MakeGroups,
+ ::SMESH_Mesh* TargetMesh=0);
SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
CORBA::Double Angle,
CORBA::Boolean Copy,
- const bool MakeGroups);
+ const bool MakeGroups,
+ ::SMESH_Mesh* TargetMesh=0);
+
+ SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
private: //!< fields
## Reorient all elements of the object
# @param theObject is mesh, submesh or group
def ReorientObject(self, theObject):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.ReorientObject(theObject)
## Fuse neighbour triangles into quadrangles.
# is still performed; theMaxAngle is mesured in radians.
# @return TRUE in case of success, FALSE otherwise.
def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.TriToQuadObject(theObject, GetFunctor(theCriterion), MaxAngle)
## Split quadrangles into triangles.
# @param theObject object to taking list of elements from, is mesh, submesh or group
# @param theCriterion is FT_...; used to choose a diagonal for splitting.
def QuadToTriObject (self, theObject, theCriterion):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.QuadToTriObject(theObject, GetFunctor(theCriterion))
## Split quadrangles into triangles.
## Split quadrangles into triangles.
# @param theObject is object to taking list of elements from, is mesh, submesh or group
def SplitQuadObject (self, theObject, Diag13):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.SplitQuadObject(theObject, Diag13)
## Find better splitting of the given quadrangle.
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
def SmoothObject(self, theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxxAspectRatio, Method):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxxAspectRatio, Method)
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method)
# @param Tolerance tolerance
# @param MakeGroups to generate new groups from existing ones
def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( Axix, geompy.GEOM._objref_GEOM_Object)):
Axix = GetAxisStruct(Axix)
if MakeGroups:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
StepVector = GetDirStruct(StepVector)
if MakeGroups:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
StepVector = GetDirStruct(StepVector)
if MakeGroups:
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( StepVector, geompy.GEOM._objref_GEOM_Object)):
StepVector = GetDirStruct(StepVector)
if MakeGroups:
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geompy.GEOM._objref_GEOM_Object)):
RefPoint = GetPointStruct(RefPoint)
if MakeGroups:
self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
return []
+ ## Create a new mesh by symmetrical copy of mesh elements
+ # @param IDsOfElements list of elements ids
+ # @param Mirror is AxisStruct or geom object(point, line, plane)
+ # @param theMirrorType is POINT, AXIS or PLANE
+ # If the Mirror is geom object this parameter is unnecessary
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
+ Mirror = GetAxisStruct(Mirror)
+ mesh = self.editor.MirrorMakeMesh(IDsOfElements, Mirror, theMirrorType,
+ MakeGroups, NewMeshName)
+ return Mesh(mesh)
+
## Symmetrical copy of object
# @param theObject mesh, submesh or group
# @param Mirror is AxisStruct or geom object(point, line, plane)
# @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
# @param MakeGroups to generate new groups from existing ones (if Copy)
def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
Mirror = GetAxisStruct(Mirror)
if Copy and MakeGroups:
self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
return []
+ ## Create a new mesh by symmetrical copy of object
+ # @param theObject mesh, submesh or group
+ # @param Mirror is AxisStruct or geom object(point, line, plane)
+ # @param theMirrorType is POINT, AXIS or PLANE
+ # If the Mirror is geom object this parameter is unnecessary
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( Mirror, geompy.GEOM._objref_GEOM_Object)):
+ Mirror = GetAxisStruct(Mirror)
+ mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
+ MakeGroups, NewMeshName)
+ return Mesh( mesh )
+
## Translates the elements
# @param IDsOfElements list of elements ids
# @param Vector direction of translation(DirStruct or vector)
self.editor.Translate(IDsOfElements, Vector, Copy)
return []
+ ## Create a new mesh of translated elements
+ # @param IDsOfElements list of elements ids
+ # @param Vector direction of translation(DirStruct or vector)
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
+ Vector = GetDirStruct(Vector)
+ mesh = self.editor.TranslateMakeMesh(IDsOfElements, Vector, MakeGroups, NewMeshName)
+ return Mesh ( mesh )
+
## Translates the object
# @param theObject object to translate(mesh, submesh, or group)
# @param Vector direction of translation(DirStruct or geom vector)
# @param Copy allows to copy the translated elements
# @param MakeGroups to generate new groups from existing ones (if Copy)
def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
Vector = GetDirStruct(Vector)
if Copy and MakeGroups:
self.editor.TranslateObject(theObject, Vector, Copy)
return []
+ ## Create a new mesh from translated object
+ # @param theObject object to translate(mesh, submesh, or group)
+ # @param Vector direction of translation(DirStruct or geom vector)
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( Vector, geompy.GEOM._objref_GEOM_Object)):
+ Vector = GetDirStruct(Vector)
+ mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
+ return Mesh( mesh )
+
## Rotates the elements
# @param IDsOfElements list of elements ids
# @param Axis axis of rotation(AxisStruct or geom line)
self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
return []
+ ## Create a new mesh of rotated elements
+ # @param IDsOfElements list of element ids
+ # @param Axis axis of rotation(AxisStruct or geom line)
+ # @param AngleInRadians angle of rotation(in radians)
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""):
+ if IDsOfElements == []:
+ IDsOfElements = self.GetElementsId()
+ if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)):
+ Axis = GetAxisStruct(Axis)
+ mesh = self.editor.RotateMakeMesh(IDsOfElements, Axis, AngleInRadians,
+ MakeGroups, NewMeshName)
+ return Mesh( mesh )
+
## Rotates the object
# @param theObject object to rotate(mesh, submesh, or group)
# @param Axis axis of rotation(AxisStruct or geom line)
# @param Copy allows to copy the rotated elements
# @param MakeGroups to generate new groups from existing ones (if Copy)
def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)):
Axis = GetAxisStruct(Axis)
if Copy and MakeGroups:
self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
return []
+ ## Create a new mesh from a rotated object
+ # @param theObject object to rotate (mesh, submesh, or group)
+ # @param Axis axis of rotation(AxisStruct or geom line)
+ # @param AngleInRadians angle of rotation(in radians)
+ # @param MakeGroups to generate new groups from existing ones
+ # @param NewMeshName is a name of new mesh to create
+ def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
+ if ( isinstance( theObject, Mesh )):
+ theObject = theObject.GetMesh()
+ if ( isinstance( Axis, geompy.GEOM._objref_GEOM_Object)):
+ Axis = GetAxisStruct(Axis)
+ mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
+ MakeGroups, NewMeshName)
+ return Mesh( mesh )
+
## Find group of nodes close to each other within Tolerance.
# @param Tolerance tolerance value
# @param list of group of nodes