From: ouv Date: Mon, 21 Jun 2010 10:30:03 +0000 (+0000) Subject: Issue 0020755: EDF 1279 MESH : 'Mesh to Pass Through a Point' enhancement X-Git-Tag: translate_resources_09Jul10~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e533bcb1d7b568a1e63e952a9a3c7ecf9e11bcb1;p=modules%2Fsmesh.git Issue 0020755: EDF 1279 MESH : 'Mesh to Pass Through a Point' enhancement --- diff --git a/doc/salome/gui/SMESH/images/meshtopass.png b/doc/salome/gui/SMESH/images/meshtopass.png index 9a5c62e24..1c426783e 100755 Binary files a/doc/salome/gui/SMESH/images/meshtopass.png and b/doc/salome/gui/SMESH/images/meshtopass.png differ diff --git a/doc/salome/gui/SMESH/input/mesh_through_point.doc b/doc/salome/gui/SMESH/input/mesh_through_point.doc index cd0d68ea9..48c91b3ee 100644 --- a/doc/salome/gui/SMESH/input/mesh_through_point.doc +++ b/doc/salome/gui/SMESH/input/mesh_through_point.doc @@ -1,34 +1,33 @@ /*! -\page mesh_through_point_page Mesh through point +\page mesh_through_point_page Moving nodes -\n In mesh you can define a node at a certain point either by creation -of a new node, by movement of the node closest to the point or by +\n In mesh you can define a node at a certain point either +by movement of the node closest to the point or by movement of any node to the point. -To create a mesh passing through a point: +To displace a node:
    -
  1. From the \b Modification menu choose the Mesh through point item or -click "Mesh to pass through a point" button in the toolbar. +
  2. From the \b Modification menu choose the Move node item or +click "Move Node" button in the toolbar. -\image html mesh_node_to_point.png -
    "Mesh to pass through a point" button
    +\image html image67.png +
    "Move Node" button
    The following dialog box shall appear: \image html meshtopass.png
  3. -
  4. Enter the coordinates of the point.
  5. -
  6. Choose one of several methods: you can either \b Create a new node at -the indicated point or Move the existing node to the point. In the -latter case you can check in Automatic search of the closest node or -select the necessary node manually. \b Preview check-box allows to see -the results of the operation.
  7. +
  8. Enter the coordinates of the destination point.
  9. +
  10. Check in Find closest to destination option or +select the necessary node manually (X, Y, Z, dX, dY, dZ fields allow +to see original coordinates and displacement of the node to move). +\b Preview check-box allows to see the results of the operation.
  11. Click the \b Apply or \b OK button.

See Also a sample TUI Script of a -\ref tui_mesh_through_point "Mesh through point" operation. +\ref tui_moving_nodes "Moving Nodes" operation. */ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/modifying_meshes.doc b/doc/salome/gui/SMESH/input/modifying_meshes.doc index 05180eb4b..b086cf915 100644 --- a/doc/salome/gui/SMESH/input/modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/modifying_meshes.doc @@ -27,10 +27,8 @@ conform free borders, border to side or side elements. within the indicated tolerance.
  • \subpage merging_elements_page "Merge Elements", considered coincident within the indicated tolerance.
  • -
  • \subpage moving_nodes_page "Move Nodes" to an arbitrary location +
  • \subpage mesh_through_point_page "Move Nodes" to an arbitrary location with consequent transformation of all adjacent elements and edges.
  • -
  • \subpage mesh_through_point_page "Make node at a point", existing -or created anew.
  • \subpage diagonal_inversion_of_elements_page "Invert an edge" between neighboring triangles.
  • \subpage uniting_two_triangles_page "Unite two triangles".
  • \subpage uniting_set_of_triangles_page "Unite several adjacent triangles".
  • diff --git a/doc/salome/gui/SMESH/input/moving_nodes.doc b/doc/salome/gui/SMESH/input/moving_nodes.doc deleted file mode 100644 index d44ddc249..000000000 --- a/doc/salome/gui/SMESH/input/moving_nodes.doc +++ /dev/null @@ -1,36 +0,0 @@ -/*! - -\page moving_nodes_page Moving nodes - -\n In MESH you can change the location of any node of your mesh. In -this case all adjacent elements (edges) will be also transformed right -after the displaced node. - -To displace a node: -
      -
    1. From the \b Modification menu choose the Move node item or -click "Move Node" button in the toolbar. - -\image html image67.png -
      "Move Node" button
      - -The following dialog box shall appear: - -\image html movenodes.png - -
    2. -
    3. Enter the ID of the required node in the Node ID field or -select this node in the 3D viewer. The coordinates of your node will -be automatically displayed in the \b Coordinates set of fields.
    4. -
    5. Set new coordinates for your node in the \b Coordinates set of fields.
    6. -
    7. Click the \b Apply or Apply and Close button.
    8. -
    - -\image html moving_nodes1.png "The initial mesh" - -\image html moving_nodes2.png "The node has been moved, transforming all adjacent edges" - -
    See Also a sample TUI Script of a -\ref tui_moving_nodes "Moving Nodes" operation. - -*/ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index 2e8f75291..8eee4e048 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -299,19 +299,6 @@ mesh.RenumberElements() \anchor tui_moving_nodes

    Moving Nodes

    -\code -import SMESH_mechanic - -mesh = SMESH_mechanic.mesh - -# move node #38 -mesh.MoveNode(38, 20., 10., 0.) -\endcode - -
    -\anchor tui_mesh_through_point -

    Mesh through point

    - \code from geompy import * from smesh import * @@ -344,16 +331,11 @@ n = mesh.FindNodeClosestTo( -1,-1,-1 ) if not n == node000: raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ) -# check if any node will be found for a point inside a box -n = mesh.FindNodeClosestTo( 100, 100, 100 ) -if not n > 0: - raise "FindNodeClosestTo( 100, 100, 100 ) fails" - # move node000 to a new location x,y,z = -10, -10, -10 -n = mesh.MeshToPassThroughAPoint( x,y,z ) -if not n == node000: - raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ) +n = mesh.MoveNode( n,x,y,z ) +if not n: + raise "MoveNode() returns " + n # check the coordinates of the node000 xyz = mesh.GetNodeXYZ( node000 ) diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index 1030ffd65..c96383c3e 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -52,7 +52,6 @@ salomeinclude_HEADERS = \ SMESHGUI_WhatIsDlg.h \ SMESHGUI_Preferences_ColorDlg.h \ SMESHGUI_Preferences_ScalarBarDlg.h \ - SMESHGUI_MoveNodesDlg.h \ SMESHGUI_AddMeshElementDlg.h \ SMESHGUI_XmlHandler.h \ SMESHGUI_Filter.h \ @@ -116,7 +115,6 @@ dist_libSMESH_la_SOURCES = \ SMESHGUI_WhatIsDlg.cxx \ SMESHGUI_Preferences_ColorDlg.cxx \ SMESHGUI_Preferences_ScalarBarDlg.cxx \ - SMESHGUI_MoveNodesDlg.cxx \ SMESHGUI_AddMeshElementDlg.cxx \ SMESHGUI_XmlHandler.cxx \ SMESHGUI_Filter.cxx \ @@ -188,7 +186,6 @@ MOC_FILES = \ SMESHGUI_WhatIsDlg_moc.cxx \ SMESHGUI_Preferences_ColorDlg_moc.cxx \ SMESHGUI_Preferences_ScalarBarDlg_moc.cxx \ - SMESHGUI_MoveNodesDlg_moc.cxx \ SMESHGUI_AddMeshElementDlg_moc.cxx \ SMESHGUI_FilterDlg_moc.cxx \ SMESHGUI_FilterLibraryDlg_moc.cxx \ diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index f777acbc4..f83165f5f 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -53,7 +53,6 @@ #include "SMESHGUI_MeshOp.h" #include "SMESHGUI_MeshOrderOp.h" #include "SMESHGUI_MeshPatternDlg.h" -#include "SMESHGUI_MoveNodesDlg.h" #include "SMESHGUI_MultiEditDlg.h" #include "SMESHGUI_NodesDlg.h" #include "SMESHGUI_Preferences_ColorDlg.h" @@ -1804,20 +1803,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; } - case 406: // MOVE NODE - { - if ( !vtkwnd ) - { - SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ) ); - break; - } - - if(checkLock(aStudy)) break; - ( new SMESHGUI_MoveNodesDlg( this ) )->show(); - break; - } - case 701: // COMPUTE MESH case 711: // PRECOMPUTE MESH case 712: // EVALUATE MESH @@ -2986,9 +2971,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" ); createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" ); createSMESHAction( 4066, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" ); - createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MESH_THROU_POINT" ); + createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" ); createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" ); - createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" ); createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" ); createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" ); createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" ); @@ -3161,7 +3145,6 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 4066, transfId, -1 ); createMenu( 4068, transfId, -1 ); - createMenu( 406, modifyId, -1 ); createMenu( 4067,modifyId, -1 ); createMenu( 407, modifyId, -1 ); createMenu( 408, modifyId, -1 ); @@ -3262,7 +3245,6 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 4068, addRemTb ); createTool( separator(), addRemTb ); - createTool( 406, modifyTb ); createTool( 4067,modifyTb ); createTool( 407, modifyTb ); createTool( 408, modifyTb ); diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index ee35301f0..36aa22bb4 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -92,7 +92,7 @@ SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg() setWindowTitle(tr("CAPTION")); QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); - aDlgLay->setMargin(MARGIN);; + aDlgLay->setMargin(0); aDlgLay->setSpacing(SPACING); QWidget* aMainFrame = createMainFrame (mainFrame()); @@ -116,7 +116,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) // constructor - QGroupBox* aPixGrp = new QGroupBox(tr("MESH_PASS_THROUGH_POINT"), aFrame); + QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), aFrame); QButtonGroup* aBtnGrp = new QButtonGroup(this); QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); aPixGrpLayout->setMargin(MARGIN); @@ -130,7 +130,7 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) // coordinates - QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame); + QGroupBox* aCoordGrp = new QGroupBox(tr("DESTINATION"), aFrame); QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp); aCoordGrpLayout->setMargin(MARGIN); aCoordGrpLayout->setSpacing(SPACING); @@ -160,19 +160,6 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) aCoordGrpLayout->addWidget(aZLabel); aCoordGrpLayout->addWidget(myZ); - // Method selection - - QGroupBox* aMethodGrp = new QGroupBox(tr("METHOD"), aFrame); - QHBoxLayout* aMethodGrpLayout = new QHBoxLayout(aMethodGrp); - aMethodGrpLayout->setMargin(MARGIN); - aMethodGrpLayout->setSpacing(SPACING); - - myMoveRBtn = new QRadioButton(tr("MOVE_EXISTING_METHOD"), aMethodGrp); - myCreateRBtn = new QRadioButton(tr("CREATE_NEW_METHOD"), aMethodGrp); - - aMethodGrpLayout->addWidget(myMoveRBtn); - aMethodGrpLayout->addWidget(myCreateRBtn); - // node ID myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame); @@ -183,6 +170,62 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) myIdBtn->setCheckable(true); myId = new QLineEdit(myNodeToMoveGrp); myId->setValidator(new SMESHGUI_IdValidator(this, 1)); + + QWidget* aCoordWidget = new QWidget(myNodeToMoveGrp); + + QLabel* aCurrentXLabel = new QLabel(tr("SMESH_X"), aCoordWidget); + myCurrentX = new SMESHGUI_SpinBox(aCoordWidget); + myCurrentX->setButtonSymbols(QAbstractSpinBox::NoButtons); + myCurrentX->setReadOnly(true); + + QLabel* aCurrentYLabel = new QLabel(tr("SMESH_Y"), aCoordWidget); + myCurrentY = new SMESHGUI_SpinBox(aCoordWidget); + myCurrentY->setButtonSymbols(QAbstractSpinBox::NoButtons); + myCurrentY->setReadOnly(true); + + QLabel* aCurrentZLabel = new QLabel(tr("SMESH_Z"), aCoordWidget); + myCurrentZ = new SMESHGUI_SpinBox(aCoordWidget); + myCurrentZ->setButtonSymbols(QAbstractSpinBox::NoButtons); + myCurrentZ->setReadOnly(true); + + QLabel* aDXLabel = new QLabel(tr("SMESH_DX"), aCoordWidget); + myDX = new SMESHGUI_SpinBox(aCoordWidget); + myDX->setButtonSymbols(QAbstractSpinBox::NoButtons); + myDX->setReadOnly(true); + + QLabel* aDYLabel = new QLabel(tr("SMESH_DY"), aCoordWidget); + myDY = new SMESHGUI_SpinBox(aCoordWidget); + myDY->setButtonSymbols(QAbstractSpinBox::NoButtons); + myDY->setReadOnly(true); + + QLabel* aDZLabel = new QLabel(tr("SMESH_DZ"), aCoordWidget); + myDZ = new SMESHGUI_SpinBox(aCoordWidget); + myDZ->setButtonSymbols(QAbstractSpinBox::NoButtons); + myDZ->setReadOnly(true); + + myCurrentX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myCurrentY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myCurrentZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision"); + + QGridLayout* aCoordLayout = new QGridLayout(aCoordWidget); + aCoordLayout->setMargin(0); + aCoordLayout->setSpacing(SPACING); + aCoordLayout->addWidget(aCurrentXLabel, 0, 0); + aCoordLayout->addWidget(myCurrentX, 0, 1); + aCoordLayout->addWidget(aCurrentYLabel, 0, 2); + aCoordLayout->addWidget(myCurrentY, 0, 3); + aCoordLayout->addWidget(aCurrentZLabel, 0, 4); + aCoordLayout->addWidget(myCurrentZ, 0, 5); + aCoordLayout->addWidget(aDXLabel, 1, 0); + aCoordLayout->addWidget(myDX, 1, 1); + aCoordLayout->addWidget(aDYLabel, 1, 2); + aCoordLayout->addWidget(myDY, 1, 3); + aCoordLayout->addWidget(aDZLabel, 1, 4); + aCoordLayout->addWidget(myDZ, 1, 5); + myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp); myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp); @@ -193,22 +236,19 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) myNodeToMoveGrpLayout->addWidget( idLabel, 0, 0 ); myNodeToMoveGrpLayout->addWidget( myIdBtn, 0, 1 ); myNodeToMoveGrpLayout->addWidget( myId, 0, 2 ); - myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 1, 0, 1, 3 ); - myNodeToMoveGrpLayout->addWidget( myPreviewChkBox, 2, 0, 1, 3 ); + myNodeToMoveGrpLayout->addWidget( aCoordWidget, 1, 0, 1, 3 ); + myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 2, 0, 1, 3 ); + myNodeToMoveGrpLayout->addWidget( myPreviewChkBox, 3, 0, 1, 3 ); QVBoxLayout* aLay = new QVBoxLayout(aFrame); aLay->addWidget(aPixGrp); aLay->addWidget(aCoordGrp); - aLay->addWidget(aMethodGrp); aLay->addWidget(myNodeToMoveGrp); connect(myCoordBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - connect(myMoveRBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - connect(myCreateRBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - myMoveRBtn->setChecked(true); myIdBtn->setChecked(true); myAutoSearchChkBox->setChecked(true); @@ -235,19 +275,16 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on) { myCoordBtn->setChecked( !on ); } - else if ( aSender == myMoveRBtn ) // move node method - { - myNodeToMoveGrp->setEnabled( true ); - } - else if ( aSender == myCreateRBtn ) // create node method - { - myNodeToMoveGrp->setEnabled( false ); - myCoordBtn->setChecked( true ); - } } if ( aSender == myAutoSearchChkBox ) // automatic node search { if ( on ) { + myCurrentX->SetValue(0); + myCurrentY->SetValue(0); + myCurrentZ->SetValue(0); + myDX->SetValue(0); + myDY->SetValue(0); + myDZ->SetValue(0); myId->setText(""); myId->setReadOnly ( true ); myIdBtn->setChecked( false ); @@ -281,8 +318,6 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview())); connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); connect(myDlg->myAutoSearchChkBox,SIGNAL (toggled(bool)),SLOT(redisplayPreview())); - connect(myDlg->myMoveRBtn, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); - connect(myDlg->myCreateRBtn, SIGNAL (toggled(bool)),SLOT(redisplayPreview())); } //======================================================================= @@ -321,6 +356,12 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() myDlg->myX->SetValue(0); myDlg->myY->SetValue(0); myDlg->myZ->SetValue(0); + myDlg->myCurrentX->SetValue(0); + myDlg->myCurrentY->SetValue(0); + myDlg->myCurrentZ->SetValue(0); + myDlg->myDX->SetValue(0); + myDlg->myDY->SetValue(0); + myDlg->myDZ->SetValue(0); myDlg->myId->setText(""); myDlg->show(); @@ -394,21 +435,18 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() if (aMeshEditor->_is_nil()) return true; - int aResult = 0; - if ( myDlg->myCreateRBtn->isChecked() ) - { - aResult = aMeshEditor->AddNode(myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue()); - } - else - { - int anId = myDlg->myId->text().toInt(); - aResult = aMeshEditor->MoveClosestNodeToPoint(myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue(), - anId); - } + bool ok; + int anId = myDlg->myId->text().toInt( &ok ); + if( !ok || anId < 1 ) + anId = aMeshEditor->FindNodeClosestTo(myDlg->myX->GetValue(), + myDlg->myY->GetValue(), + myDlg->myZ->GetValue()); + + int aResult = aMeshEditor->MoveNode(anId, + myDlg->myX->GetValue(), + myDlg->myY->GetValue(), + myDlg->myZ->GetValue() ); + if (aResult) { QStringList aParameters; @@ -417,6 +455,12 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() aParameters << myDlg->myZ->text(); aMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + myDlg->myCurrentX->SetValue(0); + myDlg->myCurrentY->SetValue(0); + myDlg->myCurrentZ->SetValue(0); + myDlg->myDX->SetValue(0); + myDlg->myDY->SetValue(0); + myDlg->myDZ->SetValue(0); myDlg->myId->setText(""); SALOME_ListIO aList; @@ -446,7 +490,6 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg ) { bool ok = true; if ( myMeshActor && - myDlg->myMoveRBtn->isChecked() && !myDlg->myAutoSearchChkBox->isChecked() ) { ok = false; @@ -525,6 +568,21 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() myNoPreview = false; redisplayPreview(); } + + if (const SMDS_MeshNode* aCurrentNode = aMesh->FindNode(myDlg->myId->text().toInt())) { + double x = aCurrentNode->X(); + double y = aCurrentNode->Y(); + double z = aCurrentNode->Z(); + double dx = myDlg->myX->GetValue() - x; + double dy = myDlg->myY->GetValue() - y; + double dz = myDlg->myZ->GetValue() - z; + myDlg->myCurrentX->SetValue(x); + myDlg->myCurrentY->SetValue(y); + myDlg->myCurrentZ->SetValue(z); + myDlg->myDX->SetValue(dx); + myDlg->myDY->SetValue(dy); + myDlg->myDZ->SetValue(dz); + } } } } @@ -547,15 +605,22 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() SMESH::MeshPreviewStruct_var aMeshPreviewStruct; bool moveShown = false; - if ( myDlg->myMoveRBtn->isChecked() && // Move method - myMeshActor) + if ( myMeshActor) { const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked(); const bool preview = myDlg->myPreviewChkBox->isChecked(); if ( autoSearch ) + { + myDlg->myCurrentX->SetValue(0); + myDlg->myCurrentY->SetValue(0); + myDlg->myCurrentZ->SetValue(0); + myDlg->myDX->SetValue(0); + myDlg->myDY->SetValue(0); + myDlg->myDZ->SetValue(0); myDlg->myId->setText(""); + } QString msg; - if ( preview && ( autoSearch || isValid( msg ) )) + if ( autoSearch || isValid( msg ) ) { try { SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); @@ -565,11 +630,19 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() { SUIT_OverrideCursor aWaitCursor; + int anId = 0; + if ( autoSearch ) + anId = aPreviewer->FindNodeClosestTo(myDlg->myX->GetValue(), + myDlg->myY->GetValue(), + myDlg->myZ->GetValue()); + else + anId = myDlg->myId->text().toInt(); + // find id and/or just compute preview - int anId = aPreviewer->MoveClosestNodeToPoint(myDlg->myX->GetValue(), - myDlg->myY->GetValue(), - myDlg->myZ->GetValue(), - myDlg->myId->text().toInt()); + aPreviewer->MoveNode(anId, + myDlg->myX->GetValue(), + myDlg->myY->GetValue(), + myDlg->myZ->GetValue()); if ( autoSearch ) { // set found id QString idTxt("%1"); if ( anId > 0 ) @@ -578,6 +651,24 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() idTxt = ""; myDlg->myId->setText( idTxt ); } + + SMESH::double_array* aXYZ = aMesh->GetNodeXYZ( anId ); + if( aXYZ && aXYZ->length() >= 3 ) + { + double x = aXYZ->operator[](0); + double y = aXYZ->operator[](1); + double z = aXYZ->operator[](2); + double dx = myDlg->myX->GetValue() - x; + double dy = myDlg->myY->GetValue() - y; + double dz = myDlg->myZ->GetValue() - z; + myDlg->myCurrentX->SetValue(x); + myDlg->myCurrentY->SetValue(y); + myDlg->myCurrentZ->SetValue(z); + myDlg->myDX->SetValue(dx); + myDlg->myDY->SetValue(dy); + myDlg->myDZ->SetValue(dz); + } + if ( preview ) { // fill preview data aMeshPreviewStruct = aPreviewer->GetPreviewData(); moveShown = ( anId > 0 ); diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 68408d990..8774c8bfa 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -36,7 +36,6 @@ class QGroupBox; class QLineEdit; class QPushButton; class QCheckBox; -class QRadioButton; class SMESHGUI_SpinBox; class SMESHGUI_MeshEditPreview; class SMESHGUI_MakeNodeAtPointDlg; @@ -98,11 +97,15 @@ private: SMESHGUI_SpinBox* myX; SMESHGUI_SpinBox* myY; SMESHGUI_SpinBox* myZ; - QRadioButton* myMoveRBtn; - QRadioButton* myCreateRBtn; QGroupBox* myNodeToMoveGrp; QPushButton* myIdBtn; QLineEdit* myId; + SMESHGUI_SpinBox* myCurrentX; + SMESHGUI_SpinBox* myCurrentY; + SMESHGUI_SpinBox* myCurrentZ; + SMESHGUI_SpinBox* myDX; + SMESHGUI_SpinBox* myDY; + SMESHGUI_SpinBox* myDZ; QCheckBox* myAutoSearchChkBox; QCheckBox* myPreviewChkBox; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 790b7c1a8..5a1866bef 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -432,7 +432,7 @@ MEN_MESH_THROU_POINT - Mesh to Pass Through a Point + Move Node MEN_MIN_ANG @@ -2375,7 +2375,7 @@ Consider saving your work before application crash STB_MESH_THROU_POINT - Mesh to pass through a point + Move Node STB_MIN_ANG @@ -2889,7 +2889,7 @@ Consider saving your work before application crash TOP_MESH_THROU_POINT - Mesh to pass through a point + Move Node TOP_MIN_ANG @@ -4425,28 +4425,24 @@ Please specify them and try again SMESHGUI_MakeNodeAtPointDlg AUTO_SEARCH - Automatic search + Find closest to destination CAPTION - Mesh to pass through a point + Move node - CREATE_NEW_METHOD - Create a node + DESTINATION + Destination - MESH_PASS_THROUGH_POINT - Make a node at point + MOVE_NODE + Move node METHOD Method - - MOVE_EXISTING_METHOD - Move a node - NODE_2MOVE Node to move @@ -4772,17 +4768,6 @@ It is impossible to read point coordinates from file <None> - - SMESHGUI_MoveNodesDlg - - CAPTION - Move node - - - NODE_ID_IS_NOT_DEFINED - Node ID is not defined - - SMESHGUI_MultiEditDlg diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 6887ed0a1..bde96521a 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -3750,16 +3750,39 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID, if ( theNodeSearcher ) theSearchersDeleter.Set( myMesh ); // remove theNodeSearcher if mesh is other - if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly + if ( myPreviewMode ) // make preview data + { + // in a preview mesh, make edges linked to a node + TPreviewMesh tmpMesh; + TIDSortedElemSet linkedNodes; + ::SMESH_MeshEditor::GetLinkedNodes( node, linkedNodes ); + TIDSortedElemSet::iterator nIt = linkedNodes.begin(); + for ( ; nIt != linkedNodes.end(); ++nIt ) + { + SMDS_MeshEdge edge( node, cast2Node( *nIt )); + tmpMesh.Copy( &edge ); + } + // move copied node + node = tmpMesh.GetMeshDS()->FindNode( NodeID ); + if ( node ) + tmpMesh.GetMeshDS()->MoveNode(node, x, y, z); + // fill preview data + ::SMESH_MeshEditor anEditor( & tmpMesh ); + storeResult( anEditor ); + } + else if ( theNodeSearcher ) // move node and update theNodeSearcher data accordingly theNodeSearcher->MoveNode(node, gp_Pnt( x,y,z )); else GetMeshDS()->MoveNode(node, x, y, z); - // Update Python script - TPythonDump() << "isDone = " << this << ".MoveNode( " - << NodeID << ", " << x << ", " << y << ", " << z << " )"; + if ( !myPreviewMode ) + { + // Update Python script + TPythonDump() << "isDone = " << this << ".MoveNode( " + << NodeID << ", " << x << ", " << y << ", " << z << " )"; - myMesh->SetIsModified( true ); + myMesh->SetIsModified( true ); + } return true; }