mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-19 00:40:32 +05:00
Issue 0020755: EDF 1279 MESH : 'Mesh to Pass Through a Point' enhancement
This commit is contained in:
parent
2343a5b385
commit
e533bcb1d7
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
@ -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.
|
||||
|
||||
<em>To create a mesh passing through a point:</em>
|
||||
<em>To displace a node:</em>
|
||||
<ol>
|
||||
<li>From the \b Modification menu choose the <b>Mesh through point</b> item or
|
||||
click <em>"Mesh to pass through a point"</em> button in the toolbar.
|
||||
<li>From the \b Modification menu choose the <b>Move node</b> item or
|
||||
click <em>"Move Node"</em> button in the toolbar.
|
||||
|
||||
\image html mesh_node_to_point.png
|
||||
<center><em>"Mesh to pass through a point" button</em></center>
|
||||
\image html image67.png
|
||||
<center><em>"Move Node" button</em></center>
|
||||
|
||||
The following dialog box shall appear:
|
||||
|
||||
\image html meshtopass.png
|
||||
|
||||
</li>
|
||||
<li>Enter the coordinates of the point.</li>
|
||||
<li>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 <b>Automatic search</b> of the closest node or
|
||||
select the necessary node manually. \b Preview check-box allows to see
|
||||
the results of the operation.</li>
|
||||
<li>Enter the coordinates of the destination point.</li>
|
||||
<li>Check in <b>Find closest to destination</b> 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.</li>
|
||||
<li>Click the \b Apply or \b OK button.</li>
|
||||
</ol>
|
||||
|
||||
<br><b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_mesh_through_point "Mesh through point" operation.
|
||||
\ref tui_moving_nodes "Moving Nodes" operation.
|
||||
|
||||
*/
|
@ -27,10 +27,8 @@ conform free borders, border to side or side elements.</li>
|
||||
within the indicated tolerance.</li>
|
||||
<li>\subpage merging_elements_page "Merge Elements", considered coincident
|
||||
within the indicated tolerance.</li>
|
||||
<li>\subpage moving_nodes_page "Move Nodes" to an arbitrary location
|
||||
<li>\subpage mesh_through_point_page "Move Nodes" to an arbitrary location
|
||||
with consequent transformation of all adjacent elements and edges.</li>
|
||||
<li>\subpage mesh_through_point_page "Make node at a point", existing
|
||||
or created anew.</li>
|
||||
<li>\subpage diagonal_inversion_of_elements_page "Invert an edge" between neighboring triangles.</li>
|
||||
<li>\subpage uniting_two_triangles_page "Unite two triangles".</li>
|
||||
<li>\subpage uniting_set_of_triangles_page "Unite several adjacent triangles".</li>
|
||||
|
@ -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.
|
||||
|
||||
<em>To displace a node:</em>
|
||||
<ol>
|
||||
<li>From the \b Modification menu choose the <b>Move node</b> item or
|
||||
click <em>"Move Node"</em> button in the toolbar.
|
||||
|
||||
\image html image67.png
|
||||
<center><em>"Move Node" button</em></center>
|
||||
|
||||
The following dialog box shall appear:
|
||||
|
||||
\image html movenodes.png
|
||||
|
||||
</li>
|
||||
<li>Enter the ID of the required node in the <b>Node ID</b> 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.</li>
|
||||
<li>Set new coordinates for your node in the \b Coordinates set of fields.</li>
|
||||
<li>Click the \b Apply or <b>Apply and Close</b> button.</li>
|
||||
</ol>
|
||||
|
||||
\image html moving_nodes1.png "The initial mesh"
|
||||
|
||||
\image html moving_nodes2.png "The node has been moved, transforming all adjacent edges"
|
||||
|
||||
<br><b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_moving_nodes "Moving Nodes" operation.
|
||||
|
||||
*/
|
@ -299,19 +299,6 @@ mesh.RenumberElements()
|
||||
\anchor tui_moving_nodes
|
||||
<h2>Moving Nodes</h2>
|
||||
|
||||
\code
|
||||
import SMESH_mechanic
|
||||
|
||||
mesh = SMESH_mechanic.mesh
|
||||
|
||||
# move node #38
|
||||
mesh.MoveNode(38, 20., 10., 0.)
|
||||
\endcode
|
||||
|
||||
<br>
|
||||
\anchor tui_mesh_through_point
|
||||
<h2>Mesh through point</h2>
|
||||
|
||||
\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 )
|
||||
|
@ -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 \
|
||||
|
@ -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 );
|
||||
|
@ -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(),
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
int anId = myDlg->myId->text().toInt();
|
||||
aResult = aMeshEditor->MoveClosestNodeToPoint(myDlg->myX->GetValue(),
|
||||
|
||||
int aResult = aMeshEditor->MoveNode(anId,
|
||||
myDlg->myX->GetValue(),
|
||||
myDlg->myY->GetValue(),
|
||||
myDlg->myZ->GetValue(),
|
||||
anId);
|
||||
}
|
||||
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;
|
||||
|
||||
// find id and/or just compute preview
|
||||
int anId = aPreviewer->MoveClosestNodeToPoint(myDlg->myX->GetValue(),
|
||||
int anId = 0;
|
||||
if ( autoSearch )
|
||||
anId = aPreviewer->FindNodeClosestTo(myDlg->myX->GetValue(),
|
||||
myDlg->myY->GetValue(),
|
||||
myDlg->myZ->GetValue(),
|
||||
myDlg->myId->text().toInt());
|
||||
myDlg->myZ->GetValue());
|
||||
else
|
||||
anId = myDlg->myId->text().toInt();
|
||||
|
||||
// find id and/or just compute preview
|
||||
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 );
|
||||
|
@ -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;
|
||||
|
||||
|
@ -432,7 +432,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MESH_THROU_POINT</source>
|
||||
<translation>Mesh to Pass Through a Point</translation>
|
||||
<translation>Move Node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_MIN_ANG</source>
|
||||
@ -2375,7 +2375,7 @@ Consider saving your work before application crash</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MESH_THROU_POINT</source>
|
||||
<translation>Mesh to pass through a point</translation>
|
||||
<translation>Move Node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MIN_ANG</source>
|
||||
@ -2889,7 +2889,7 @@ Consider saving your work before application crash</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_MESH_THROU_POINT</source>
|
||||
<translation>Mesh to pass through a point</translation>
|
||||
<translation>Move Node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_MIN_ANG</source>
|
||||
@ -4425,28 +4425,24 @@ Please specify them and try again</translation>
|
||||
<name>SMESHGUI_MakeNodeAtPointDlg</name>
|
||||
<message>
|
||||
<source>AUTO_SEARCH</source>
|
||||
<translation>Automatic search</translation>
|
||||
<translation>Find closest to destination</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CAPTION</source>
|
||||
<translation>Mesh to pass through a point</translation>
|
||||
<translation>Move node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CREATE_NEW_METHOD</source>
|
||||
<translation>Create a node</translation>
|
||||
<source>DESTINATION</source>
|
||||
<translation>Destination</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MESH_PASS_THROUGH_POINT</source>
|
||||
<translation>Make a node at point</translation>
|
||||
<source>MOVE_NODE</source>
|
||||
<translation>Move node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>METHOD</source>
|
||||
<translation>Method</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MOVE_EXISTING_METHOD</source>
|
||||
<translation>Move a node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NODE_2MOVE</source>
|
||||
<translation>Node to move</translation>
|
||||
@ -4772,17 +4768,6 @@ It is impossible to read point coordinates from file</translation>
|
||||
<translation><None></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_MoveNodesDlg</name>
|
||||
<message>
|
||||
<source>CAPTION</source>
|
||||
<translation>Move node</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NODE_ID_IS_NOT_DEFINED</source>
|
||||
<translation>Node ID is not defined</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_MultiEditDlg</name>
|
||||
<message>
|
||||
|
@ -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);
|
||||
|
||||
if ( !myPreviewMode )
|
||||
{
|
||||
// Update Python script
|
||||
TPythonDump() << "isDone = " << this << ".MoveNode( "
|
||||
<< NodeID << ", " << x << ", " << y << ", " << z << " )";
|
||||
|
||||
myMesh->SetIsModified( true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user