diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc
index 3c992c8f0..b472e12c9 100644
--- a/doc/salome/gui/GEOM/input/creating_point.doc
+++ b/doc/salome/gui/GEOM/input/creating_point.doc
@@ -25,14 +25,22 @@ the position of this point regarding the reference one.
\image html point2.png
-\n Thirdly, we can define a point by an \b Edge and a \b Parameter
+\n Thirdly, we can define a point by an \b Edge and a \b
+[list]
+[*]Parameter
indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the
point is located in the middle of the edge.
\n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter).
\n Arguments: Name + 1 edge + 1 Parameter defining the
position of the point on the given edge.
-
\image html point3.png
+[*]3D co-ordinate of point to project on the given edge
+\n TUI Command: geompy.MakeVertexOnCurveByCoord(Edge,X,Y,Z).
+\n Arguments: Name + 1 edge + 3 coordinate values
+to project point on the given edge.
+\image html point3_2.png
+[/list]
+
\n Fourthly, we can define a point by intersection of two \b Lines.
\n TUI Command: geompy.MakePointOnLinesIntersection(myLine1,myLine2).
@@ -41,14 +49,21 @@ position of the point on the given edge.
\image html point4.png
Example:
-\n Finally, we can define a point by a \b Face and two Parameters: U and \b V
+\n Finally, we can define a point by a \b Face and
+[list]
+[*]Two Parameters: U and \b V
indicating its position on the Face, ranging from 0.0 to 1.0. For example, (0.5; 0.5) means that the
point is located in the middle of the face.
\n TUI Command: geompy.MakeVertexOnSurface(myFace,myUParameter,myVParameter).
\n Arguments: Name + 1 face + 2 Parameters defining the
position of the point on the given face.
-
+[*] 3D co-ordinate of point to project on the given face.
\image html point5.png
+\n TUI Command: geompy.MakeVertexOnSurface(myFace,X,Y,Z).
+\n Arguments: Name + 1 face + 3 coordinate values
+to project point on the given face.
+\image html point5_2.png
+[/list]
Example:
diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
index f36714256..34f782d45 100644
--- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
+++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
@@ -17,9 +17,19 @@ px = geompy.MakeVertex(100., 0., 0.)
py = geompy.MakeVertex(0., 100., 0.)
pz = geompy.MakeVertex(0., 0., 100.)
-# create a curve and a vertex on it
+# create a curve and a vertices on it
Arc = geompy.MakeArc(py, pz, px)
+# create vertex by parameter
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
+#create vertex by point projection
+p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
+
+# create a face and vertices on it
+Add_line = geompy.MakeLineTwoPnt(px, py)
+arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
+p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
+p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face_1, 35, 35, 35)
+
# add objects in the study
id_p0 = geompy.addToStudy(p0, "Vertex 0")
@@ -28,7 +38,10 @@ id_px = geompy.addToStudy(px, "Vertex X")
id_py = geompy.addToStudy(py, "Vertex Y")
id_pz = geompy.addToStudy(pz, "Vertex Z")
id_Arc = geompy.addToStudy(Arc, "Arc")
-id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc")
+id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
+id_p_on_arc2 = geompy.addToStudy(p_on_arc, "Vertex on Arc by point projection")
+id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
+id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
# display vertices
gg.createAndDisplayGO(id_p0)
diff --git a/doc/salome/gui/GEOM/input/tui_test_all.doc b/doc/salome/gui/GEOM/input/tui_test_all.doc
index 4570a965a..9f7c30552 100644
--- a/doc/salome/gui/GEOM/input/tui_test_all.doc
+++ b/doc/salome/gui/GEOM/input/tui_test_all.doc
@@ -23,6 +23,12 @@
\until MakeVertexOnCurve
+\until MakeVertexOnCurveByCoord
+
+\until MakeVertexOnSurface
+
+\until MakeVertexOnSurfaceByCoord
+
\anchor swig_MakeVertexOnLinesIntersection
\until p_on_l1l2
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index f7c1a49a6..a04fcb4c6 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -327,6 +327,19 @@ module GEOM
GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve,
in double theParameter);
+ /*!
+ * Create a point on the given curve, projecting given point
+ * \param theRefCurve The referenced curve.
+ * \param theXParameter X co-ordinate of point to project on curve
+ * \param theYParameter Y co-ordinate of point to project on curve
+ * \param theZParameter Z co-ordinate of point to project on curve
+ * \return New GEOM_Object, containing the created point.
+ */
+ GEOM_Object MakePointOnCurveByCoord (in GEOM_Object theRefCurve,
+ in double theXParameter,
+ in double theYarameter,
+ in double theZPameter);
+
/*!
* Create a point, corresponding to the given parameters on the
* given surface.
@@ -339,6 +352,20 @@ module GEOM
in double theUParameter,
in double theVParameter);
+ /*!
+ * Create a point on the given surface, projecting given point
+ * \param theRefSurf The referenced surface.
+ * \param theXParameter X co-ordinate of point to project on curve
+ * \param theYParameter Y co-ordinate of point to project on curve
+ * \param theZParameter Z co-ordinate of point to project on curve
+ * \return New GEOM_Object, containing the created point.
+ */
+ GEOM_Object MakePointOnSurfaceByCoord (in GEOM_Object theRefSurf,
+ in double theXParameter,
+ in double theYarameter,
+ in double theZPameter);
+
+
/*!
* Create a point, on two lines intersection.
* \param theRefLine1, theRefLine2 The referenced lines.
diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx
index 9b2f525ac..28941e9e2 100644
--- a/src/BasicGUI/BasicGUI_PointDlg.cxx
+++ b/src/BasicGUI/BasicGUI_PointDlg.cxx
@@ -38,7 +38,10 @@
#include
#include
+#include
+#include
#include
+#include
#include
#include
@@ -49,6 +52,16 @@
#include
#include
+#define PARAM_VALUE 0
+#define COORD_VALUE 1
+
+#define POINT_XYZ 0
+#define POINT_REF 1
+#define POINT_EDGE 2
+#define POINT_INTINT 3
+#define POINT_SURF 4
+
+
//=================================================================================
// class : BasicGUI_PointDlg()
// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
@@ -79,6 +92,19 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
mainFrame()->RadioButton5->show();
mainFrame()->RadioButton5->setIcon( image5 );
+ QGroupBox* paramGrp = new QGroupBox( centralWidget() );
+ myParamCoord = new QButtonGroup( paramGrp );
+ QHBoxLayout* boxLayout = new QHBoxLayout( paramGrp );
+ boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
+ QRadioButton* btn = new QRadioButton( tr( "GEOM_PARAM_VALUE" ), paramGrp );
+ myParamCoord->addButton( btn, PARAM_VALUE );
+ boxLayout->addWidget( btn );
+ btn = new QRadioButton( tr( "GEOM_COORD_VALUE" ), paramGrp );
+ myParamCoord->addButton( btn, COORD_VALUE );
+ boxLayout->addWidget( btn );
+ myParamCoord->setExclusive( true );
+ myParamCoord->button( PARAM_VALUE )->setChecked( true );
+
GroupXYZ = new DlgRef_3Spin( centralWidget() );
GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) );
GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) );
@@ -86,13 +112,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) );
GroupOnCurve = new DlgRef_1Sel1Spin( centralWidget() );
- GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) );
+ GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_POINT_ON_EDGE" ) );
GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) );
GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
GroupOnCurve->PushButton1->setIcon( image2 );
GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() );
- GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) );
+ GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_POINT_ON_FACE" ) );
GroupOnSurface->TextLabel1->setText( tr( "GEOM_FACE" ) );
GroupOnSurface->TextLabel2->setText( tr( "GEOM_UPARAMETER" ) );
GroupOnSurface->TextLabel3->setText( tr( "GEOM_VPARAMETER" ) );
@@ -114,7 +140,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
GroupLineIntersection->PushButton2->setIcon( image2 );
GroupLineIntersection->LineEdit2->setEnabled(false);
- myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() );
+ myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES_RES" ), centralWidget() );
QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp );
myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 );
myX = new QLineEdit( myCoordGrp );
@@ -128,6 +154,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
+ layout->addWidget( paramGrp );
layout->addWidget( GroupXYZ );
layout->addWidget( GroupOnCurve );
layout->addWidget( GroupOnSurface );
@@ -221,6 +248,9 @@ void BasicGUI_PointDlg::Init()
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+
+ connect( myParamCoord->button( PARAM_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
+ connect( myParamCoord->button( COORD_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupOnCurve->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@@ -280,7 +310,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
globalSelection(); // close local contexts, if any
switch ( constructorId ) {
- case 0:
+ case POINT_XYZ:
{
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
@@ -291,10 +321,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myCoordGrp->hide();
+ myParamCoord->button( PARAM_VALUE )->hide();
+ myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->show();
break;
}
- case 1:
+ case POINT_REF:
{
myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText( "" );
@@ -302,6 +334,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupRefPoint->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ myParamCoord->button( PARAM_VALUE )->hide();
+ myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->hide();
GroupOnCurve->hide();
GroupLineIntersection->hide();
@@ -312,7 +346,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myCoordGrp->show();
break;
}
- case 2:
+ case POINT_EDGE:
{
myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText( "" );
@@ -320,17 +354,19 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupOnCurve->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
- GroupXYZ->hide();
GroupRefPoint->hide();
GroupLineIntersection->hide();
GroupOnSurface->hide();
+ myParamCoord->button( PARAM_VALUE )->show();
+ myParamCoord->button( COORD_VALUE )->show();
GroupOnCurve->show();
-
myCoordGrp->show();
+
+ updateParamCoord( false );
break;
}
- case 3:
+ case POINT_INTINT:
{
myEditCurrentArgument = GroupLineIntersection->LineEdit1;
GroupLineIntersection->LineEdit1->setText( "" );
@@ -344,6 +380,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ myParamCoord->button( PARAM_VALUE )->hide();
+ myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->hide();
GroupRefPoint->hide();
GroupOnCurve->hide();
@@ -354,7 +392,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupLineIntersection->show();
break;
}
- case 4:
+ case POINT_SURF:
{
myEditCurrentArgument = GroupOnSurface->LineEdit1;
myEditCurrentArgument->setText( "" );
@@ -362,14 +400,16 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupOnSurface->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
- GroupXYZ->hide();
GroupRefPoint->hide();
GroupOnCurve->hide();
GroupLineIntersection->hide();
+ myParamCoord->button( PARAM_VALUE )->show();
+ myParamCoord->button( COORD_VALUE )->show();
GroupOnSurface->show();
-
myCoordGrp->show();
+
+ updateParamCoord( false );
break;
}
}
@@ -420,7 +460,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
{
const int id = getConstructorId();
- if ( ( id == 1 || id == 2 || id == 4 ) && myEditCurrentArgument != 0 )
+ if ( ( id == POINT_REF || id == POINT_EDGE || id == POINT_SURF ) && myEditCurrentArgument != 0 )
{
myEditCurrentArgument->setText( "" );
myX->setText( "" );
@@ -442,9 +482,9 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
- if ( id == 2 || id == 3 )
+ if ( id == POINT_EDGE || id == POINT_INTINT )
aNeedType = TopAbs_EDGE;
- else if ( id == 4 )
+ else if ( id == POINT_SURF )
aNeedType = TopAbs_FACE;
TColStd_IndexedMapOfInteger aMap;
@@ -473,7 +513,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
if ( aShape.ShapeType() != aNeedType ) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
- if ( id == 0 ) return;
+ if ( id == POINT_XYZ ) return;
}
}
}
@@ -481,21 +521,21 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
if ( aShape.IsNull() || aShape.ShapeType() != aNeedType)
return;
- if ( id == 0 ) {
+ if ( id == POINT_XYZ ) {
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
}
- else if ( id == 1 ) {
+ else if ( id == POINT_REF ) {
myRefPoint = aSelectedObject;
GroupRefPoint->LineEdit1->setText( aName );
}
- else if ( id == 2 ) {
+ else if ( id == POINT_EDGE ) {
myEdge = aSelectedObject;
GroupOnCurve->LineEdit1->setText( aName );
}
- else if ( id == 3 ) {
+ else if ( id == POINT_INTINT ) {
myEditCurrentArgument->setText( aName );
globalSelection();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
@@ -510,7 +550,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
GroupLineIntersection->PushButton1->click();
}
}
- else if ( id == 4 )
+ else if ( id == POINT_SURF )
{
myFace = aSelectedObject;
GroupOnSurface->LineEdit1->setText( aName );
@@ -667,7 +707,7 @@ double BasicGUI_PointDlg::getVParameter() const
//=================================================================================
void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt )
{
- if ( getConstructorId() == 0 ) {
+ if ( getConstructorId() == POINT_XYZ ) {
GroupXYZ->SpinBox_DX->setValue( thePnt.X() );
GroupXYZ->SpinBox_DY->setValue( thePnt.Y() );
GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() );
@@ -692,14 +732,14 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
bool BasicGUI_PointDlg::isValid( QString& msg )
{
const int id = getConstructorId();
- if ( id == 0 ) {
+ if ( id == POINT_XYZ ) {
bool ok = true;
ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
return ok;
}
- else if ( id == 1 ) {
+ else if ( id == POINT_REF ) {
bool ok = true;
ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
@@ -707,16 +747,30 @@ bool BasicGUI_PointDlg::isValid( QString& msg )
return !myRefPoint->_is_nil() && ok;
}
- else if ( id == 2 ) {
- bool ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
+ else if ( id == POINT_EDGE ) {
+ bool ok = true;
+ if ( myParamCoord->checkedId() == PARAM_VALUE )
+ ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
+ else {
+ ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
return !myEdge->_is_nil() && ok;
}
- else if ( id == 3 )
+ else if ( id == POINT_INTINT )
return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
- else if ( id == 4 ) {
+ else if ( id == POINT_SURF ) {
bool ok = true;
- ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
- ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ if ( myParamCoord->checkedId() == PARAM_VALUE ) {
+ ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ }
+ else {
+ ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+ }
return !myFace->_is_nil() && ok;
}
@@ -735,7 +789,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
QStringList aParameters;
switch ( getConstructorId() ) {
- case 0 :
+ case POINT_XYZ :
{
double x = GroupXYZ->SpinBox_DX->value();
double y = GroupXYZ->SpinBox_DY->value();
@@ -749,7 +803,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
res = true;
break;
}
- case 1 :
+ case POINT_REF :
{
double dx = GroupRefPoint->SpinBox_DX->value();
double dy = GroupRefPoint->SpinBox_DY->value();
@@ -764,36 +818,66 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
res = true;
break;
}
- case 2 :
- anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
- MakePointOnCurve( myEdge, getParameter() );
- aParameters<SpinBox_DX->text();
- res = true;
- break;
- case 3 :
+ case POINT_EDGE :
+ {
+ GEOM::GEOM_IBasicOperations_ptr anOp =
+ GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
+ if ( myParamCoord->checkedId() == PARAM_VALUE ) {
+ anObj = anOp->MakePointOnCurve( myEdge, getParameter() );
+ aParameters<SpinBox_DX->text();
+ } else {
+ double x = GroupXYZ->SpinBox_DX->value();
+ double y = GroupXYZ->SpinBox_DY->value();
+ double z = GroupXYZ->SpinBox_DZ->value();
+
+ aParameters << GroupXYZ->SpinBox_DX->text();
+ aParameters << GroupXYZ->SpinBox_DY->text();
+ aParameters << GroupXYZ->SpinBox_DZ->text();
+
+ anObj = anOp->MakePointOnCurveByCoord( myEdge, x, y, z );
+ }
+ res = true;
+ break;
+ }
+ case POINT_INTINT :
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointOnLinesIntersection( myLine1, myLine2 );
res = true;
break;
- case 4 :
- anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
- MakePointOnSurface( myFace, getUParameter(), getVParameter() );
- aParameters<SpinBox_DX->text();
- aParameters<SpinBox_DY->text();
- res = true;
- break;
+ case POINT_SURF :
+ {
+ GEOM::GEOM_IBasicOperations_ptr anOp =
+ GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
+ if ( myParamCoord->checkedId() == PARAM_VALUE ) {
+ anObj = anOp->MakePointOnSurface( myFace, getUParameter(), getVParameter() );
+ aParameters<SpinBox_DX->text();
+ aParameters<SpinBox_DY->text();
+ } else {
+ double x = GroupXYZ->SpinBox_DX->value();
+ double y = GroupXYZ->SpinBox_DY->value();
+ double z = GroupXYZ->SpinBox_DZ->value();
+
+ aParameters << GroupXYZ->SpinBox_DX->text();
+ aParameters << GroupXYZ->SpinBox_DY->text();
+ aParameters << GroupXYZ->SpinBox_DZ->text();
+
+ anObj = anOp->MakePointOnSurfaceByCoord( myFace, x, y, z );
+ }
+ res = true;
+ break;
+ }
}
- if(!anObj->_is_nil() && !IsPreview() && (getConstructorId()==0 ||
- getConstructorId() == 1 ||
- getConstructorId() == 2 ||
- getConstructorId() == 4) ) {
+ const int id = getConstructorId();
+ if(!anObj->_is_nil() && !IsPreview() && (id == POINT_XYZ ||
+ id == POINT_REF ||
+ id == POINT_EDGE ||
+ id == POINT_SURF) ) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
}
- if ( getConstructorId() == 1 || getConstructorId() == 2 ||
- getConstructorId() == 4 ) {
+ if ( id == POINT_REF || id == POINT_EDGE || id == POINT_SURF ) {
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
aShape.ShapeType() == TopAbs_VERTEX ) {
@@ -825,21 +909,57 @@ void BasicGUI_PointDlg::addSubshapesToStudy()
QMap objMap;
switch ( getConstructorId() ) {
- case 0:
+ case POINT_XYZ:
break;
- case 1:
+ case POINT_REF:
objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
break;
- case 2:
+ case POINT_EDGE:
objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
break;
- case 3:
+ case POINT_INTINT:
objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
break;
- case 4:
+ case POINT_SURF:
objMap[GroupOnSurface->LineEdit1->text()] = myFace;
break;
}
addSubshapesToFather( objMap );
}
+
+//=================================================================================
+// function : ClickParamCoord()
+// purpose :
+//=================================================================================
+void BasicGUI_PointDlg::ClickParamCoord()
+{
+ updateParamCoord( true );
+}
+
+//=================================================================================
+// function : updateParamCoord
+// purpose :
+//=================================================================================
+void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
+{
+ bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
+ GroupXYZ->setShown( !isParam );
+
+ const int id = getConstructorId();
+ if ( id == POINT_EDGE ) {
+ GroupOnCurve->TextLabel2->setShown( isParam );
+ GroupOnCurve->SpinBox_DX->setShown( isParam );
+ }
+ else if ( id == POINT_SURF ) {
+ GroupOnSurface->TextLabel2->setShown( isParam );
+ GroupOnSurface->TextLabel3->setShown( isParam );
+ GroupOnSurface->SpinBox_DX->setShown( isParam );
+ GroupOnSurface->SpinBox_DY->setShown( isParam );
+ }
+ if ( theIsUpdate ) {
+ qApp->processEvents();
+ updateGeometry();
+ resize( minimumSizeHint() );
+ }
+}
diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h
index 1dfd48618..c3f95979e 100644
--- a/src/BasicGUI/BasicGUI_PointDlg.h
+++ b/src/BasicGUI/BasicGUI_PointDlg.h
@@ -36,6 +36,7 @@ class DlgRef_1Sel2Spin;
class QLineEdit;
class QGroupBox;
+class QButtonGroup;
class gp_Pnt;
@@ -68,6 +69,7 @@ private:
double getParameter() const;
double getUParameter() const;
double getVParameter() const;
+ void updateParamCoord(bool theIsUpdate);
private:
GEOM::GEOM_Object_var myEdge;
@@ -86,6 +88,7 @@ private:
QLineEdit* myX;
QLineEdit* myY;
QLineEdit* myZ;
+ QButtonGroup* myParamCoord;
private slots:
void ClickOnOk();
@@ -98,6 +101,7 @@ private slots:
void ConstructorsClicked( int );
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
+ void ClickParamCoord();
};
#endif // BASICGUI_POINTDLG_H
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index eeb6052eb..c8edd2681 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -427,6 +427,10 @@ Please, select face, shell or solid and try again
Coordinates
+
+
+ Result coordinates
+
Create a copy
@@ -1076,8 +1080,20 @@ Please, select face, shell or solid and try again
Parameters
-
- Parametric point
+
+ Point on Edge
+
+
+
+ Point on Face
+
+
+
+ By parameter
+
+
+
+ By coordinate
diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts
index 4ba2ff038..557dd3b1a 100644
--- a/src/GEOMGUI/GEOM_msg_fr.ts
+++ b/src/GEOMGUI/GEOM_msg_fr.ts
@@ -269,6 +269,10 @@
Coordonnes
+
+
+ Resultats coordonnes
+
Create a copy
@@ -726,8 +730,20 @@
Paramtre :
-
- Point paramtrique
+
+ Point sur la Edge
+
+
+
+ Point sur la Face
+
+
+
+ By paramtrique
+
+
+
+ By Coordonnes
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
index 140a887f6..ebba432d7 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
@@ -182,33 +182,68 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
//=============================================================================
/*!
- * MakePointOnCurve
+ * makePointOnGeom
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
- (Handle(GEOM_Object) theCurve, double theParameter)
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
+ (Handle(GEOM_Object) theGeomObj,
+ double theParam1,
+ double theParam2,
+ double theParam3,
+ const PointLocation theLocation)
{
SetErrorCode(KO);
- if (theCurve.IsNull()) return NULL;
+ if (theGeomObj.IsNull()) return NULL;
//Add a new Point object
Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
//Add a new Point function for creation a point relativley another point
- Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_CURVE_PAR);
+ int fType = POINT_CURVE_PAR;
+ switch( theLocation )
+ {
+ case PointOn_CurveByParam: fType = POINT_CURVE_PAR; break;
+ case PointOn_CurveByCoord: fType = POINT_CURVE_COORD; break;
+ case PointOn_SurfaceByParam: fType = POINT_SURFACE_PAR; break;
+ case PointOn_SurfaceByCoord: fType = POINT_SURFACE_COORD; break;
+ default: break;
+ }
+ Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), fType);
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
GEOMImpl_IPoint aPI (aFunction);
- Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
+ Handle(GEOM_Function) aRefFunction = theGeomObj->GetLastFunction();
if (aRefFunction.IsNull()) return NULL;
- aPI.SetCurve(aRefFunction);
- aPI.SetParameter(theParameter);
-
+ switch( theLocation )
+ {
+ case PointOn_CurveByParam:
+ aPI.SetCurve(aRefFunction);
+ aPI.SetParameter(theParam1);
+ break;
+ case PointOn_CurveByCoord:
+ aPI.SetCurve(aRefFunction);
+ aPI.SetX(theParam1);
+ aPI.SetY(theParam2);
+ aPI.SetZ(theParam3);
+ break;
+ case PointOn_SurfaceByParam:
+ aPI.SetSurface(aRefFunction);
+ aPI.SetParameter(theParam1);
+ aPI.SetParameter2(theParam2);
+ break;
+ case PointOn_SurfaceByCoord:
+ aPI.SetSurface(aRefFunction);
+ aPI.SetX(theParam1);
+ aPI.SetY(theParam2);
+ aPI.SetZ(theParam3);
+ default: break;
+ }
+
//Compute the point value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
@@ -226,13 +261,57 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
- << theCurve << ", " << theParameter << ")";
+ switch( theLocation )
+ {
+ case PointOn_CurveByParam:
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
+ << theGeomObj << ", " << theParam1 << ")";
+ break;
+ case PointOn_CurveByCoord:
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ", " << theParam3 << ")";
+ break;
+ case PointOn_SurfaceByParam:
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ")";
+ break;
+ case PointOn_SurfaceByCoord:
+ GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurfaceByCoord("
+ << theGeomObj << ", " << theParam1
+ << ", " << theParam2 << ", " << theParam3 << ")";
+ default: break;
+ }
SetErrorCode(OK);
return aPoint;
}
+//=============================================================================
+/*!
+ * MakePointOnCurve
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
+ (Handle(GEOM_Object) theCurve, double theParameter)
+{
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+}
+
+//=============================================================================
+/*!
+ * MakePointOnCurveByCoord
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
+ (Handle(GEOM_Object) theCurve,
+ double theXParam,
+ double theYParam,
+ double theZParam)
+{
+ return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
+}
//=============================================================================
/*!
@@ -240,54 +319,25 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface
- (Handle(GEOM_Object) theSurface, double theUParameter, double theVParameter)
+ (Handle(GEOM_Object) theSurface,
+ double theUParameter,
+ double theVParameter)
{
- SetErrorCode(KO);
+ return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
+}
- if (theSurface.IsNull()) return NULL;
-
- //Add a new Point object
- Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT);
-
- //Add a new Point function for creation a point relativley another point
- Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(),
- POINT_SURFACE_PAR);
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PointDriver::GetID()) return NULL;
-
- GEOMImpl_IPoint aPI (aFunction);
-
- Handle(GEOM_Function) aRefFunction = theSurface->GetLastFunction();
- if (aRefFunction.IsNull()) return NULL;
-
- aPI.SetSurface(aRefFunction);
- aPI.SetParameter(theUParameter);
- aPI.SetParameter2(theVParameter);
-
- //Compute the point value
- try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("Point driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnSurface("
- << theSurface << ", " << theUParameter
- << ", " << theVParameter << ")";
-
- SetErrorCode(OK);
- return aPoint;
+//=============================================================================
+/*!
+ * MakePointOnSurfaceByCoord
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
+ (Handle(GEOM_Object) theSurface,
+ double theXParam,
+ double theYParam,
+ double theZParam)
+{
+ return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
}
@@ -1014,9 +1064,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
- double theParamU,
- double theParamV,
- double theSize)
+ double theParamU,
+ double theParamV,
+ double theSize)
{
SetErrorCode(KO);
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
index 0d211770e..0b318a72c 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
@@ -40,7 +40,12 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
double theX, double theY, double theZ);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve,
- double theParameter);
+ double theParameter);
+
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve,
+ double theXParam,
+ double theYParam,
+ double theZParam);
Standard_EXPORT Handle(GEOM_Object) MakePointOnLinesIntersection
(Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
@@ -49,6 +54,11 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
double theUParameter,
double theVParameter);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnSurfaceByCoord (Handle(GEOM_Object) theSurface,
+ double theXParam,
+ double theYParam,
+ double theZParam);
+
// Vector
Standard_EXPORT Handle(GEOM_Object) MakeVectorDXDYDZ (double theDX, double theDY, double theDZ);
@@ -56,7 +66,7 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
Handle(GEOM_Object) thePnt2);
Standard_EXPORT Handle(GEOM_Object) MakeTangentOnCurve(const Handle(GEOM_Object)& theCurve,
- double theParameter);
+ double theParameter);
// Line
Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1,
@@ -82,8 +92,8 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakePlane2Vec (Handle(GEOM_Object) theVec1,
Handle(GEOM_Object) theVec2,
- double theSize);
-
+ double theSize);
+
Standard_EXPORT Handle(GEOM_Object) MakePlaneLCS (Handle(GEOM_Object) theFace, double theSize, int theOrientation);
// Marker
@@ -92,10 +102,28 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
double theYDX, double theYDY, double theYDZ);
Standard_EXPORT Handle(GEOM_Object) MakeTangentPlaneOnFace(const Handle(GEOM_Object)& theFace,
- double theParamU,
- double theParamV,
- double theSize);
+ double theParamU,
+ double theParamV,
+ double theSize);
+ private:
+ // Private methods
+
+ //! Enumeration describes point position on geometric object (curve or surface)
+ //! Point location can be determined by parameter (or U, V parameters) or 3D coordinates
+ enum PointLocation
+ {
+ PointOn_CurveByParam,
+ PointOn_CurveByCoord,
+ PointOn_SurfaceByParam,
+ PointOn_SurfaceByCoord
+ };
+
+ Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
+ double theParam1,
+ double theParam2,
+ double theParam3,
+ const PointLocation theLocation);
};
#endif
diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
index accc93779..9a5ebb4c8 100644
--- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
@@ -29,6 +29,8 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
@@ -105,6 +107,23 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
aP = aFP + (aLP - aFP) * aPI.GetParameter();
aPnt = aCurve->Value(aP);
}
+ else if (aType == POINT_CURVE_COORD) {
+ Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_EDGE) {
+ Standard_TypeMismatch::Raise
+ ("Point On Curve creation aborted : curve shape is not an edge");
+ }
+ Standard_Real aFP, aLP;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP);
+ gp_Pnt anInitPnt( aPI.GetX(), aPI.GetY(), aPI.GetZ() );
+ GeomAPI_ProjectPointOnCurve aProj(anInitPnt, aCurve/*, aFP, aLP*/);
+ if ( aProj.NbPoints() <= 0 ) {
+ Standard_ConstructionError::Raise
+ ("Point On Curve creation aborted : cannot project point");
+ }
+ aPnt = aProj.NearestPoint();
+ }
else if (aType == POINT_SURFACE_PAR) {
Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
TopoDS_Shape aRefShape = aRefCurve->GetValue();
@@ -121,6 +140,28 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
Standard_Real V = V1 + (V2-V1) * aPI.GetParameter2();
aPnt = aSurf->Value(U,V);
}
+ else if (aType == POINT_SURFACE_COORD) {
+ Handle(GEOM_Function) aRefCurve = aPI.GetSurface();
+ TopoDS_Shape aRefShape = aRefCurve->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_FACE) {
+ Standard_TypeMismatch::Raise
+ ("Point On Surface creation aborted : surface shape is not a face");
+ }
+ TopoDS_Face F = TopoDS::Face(aRefShape);
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
+ Standard_Real U1,U2,V1,V2;
+ //aSurf->Bounds(U1,U2,V1,V2);
+ ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2);
+
+ gp_Pnt anInitPnt( aPI.GetX(), aPI.GetY(), aPI.GetZ() );
+ GeomAPI_ProjectPointOnSurf aProj( anInitPnt, aSurf/*,
+ U1,U2,V1,V2, Precision::Confusion()*/ );
+ if ( !aProj.IsDone() ) {
+ Standard_ConstructionError::Raise
+ ("Point On Surface creation aborted : cannot project point");
+ }
+ aPnt = aProj.NearestPoint();
+ }
else if (aType == POINT_LINES_INTERSECTION) {
Handle(GEOM_Function) aRef1 = aPI.GetLine1();
Handle(GEOM_Function) aRef2 = aPI.GetLine2();
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index d1f474acf..9105d82c8 100755
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -106,7 +106,8 @@
#define POINT_CURVE_PAR 3
#define POINT_LINES_INTERSECTION 4
#define POINT_SURFACE_PAR 5
-//#define POINT_FACE_PAR 5
+#define POINT_CURVE_COORD 6
+#define POINT_SURFACE_COORD 7
#define VECTOR_TWO_PNT 1
#define VECTOR_DX_DY_DZ 2