From: vsr Date: Mon, 13 Apr 2009 12:51:18 +0000 (+0000) Subject: 0020154: Implement major axis support for ellipse creation (merge development from... X-Git-Tag: V4_1_5rc1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a84ec0f0834dccb4d3705edd4d63d89031c12e5;p=modules%2Fgeom.git 0020154: Implement major axis support for ellipse creation (merge development from series 5x) --- diff --git a/doc/salome/gui/GEOM/images/ellipse.png b/doc/salome/gui/GEOM/images/ellipse.png index 6bce2c247..bc35ecf47 100755 Binary files a/doc/salome/gui/GEOM/images/ellipse.png and b/doc/salome/gui/GEOM/images/ellipse.png differ diff --git a/doc/salome/gui/GEOM/input/creating_ellipse.doc b/doc/salome/gui/GEOM/input/creating_ellipse.doc index 78972181b..af91be2c5 100644 --- a/doc/salome/gui/GEOM/input/creating_ellipse.doc +++ b/doc/salome/gui/GEOM/input/creating_ellipse.doc @@ -4,14 +4,28 @@ To create an \b Ellipse in the Main Menu select New Entity - > Basic - > Ellipse -\n You can define an \b Ellipse by its Center Point, a \b -Vector giving its normal, and its Major & Minor Radiuses. +\n You can define an \b Ellipse by its Center point, a \b +Vector giving its normal, another vector specifying the direction of +ellipse's Major Axis (optionally) and its Major & Minor Radiuses. \n The \b Result of the operation will be a GEOM_Object (edge). -\n TUI Command: geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor) +\note The parameter Major Axis is optional. It is calculated +automatically basing on the direction of the normal vector (by default +it corresponds to the OX axis of the global coordinate system). + +\note Actual direction of the major axis vector is defined as + Vmaj' = (Vn * Vmaj) * Vn where \em Vn is a normal vector and +\em Vmaj is an original vector of the major axis. + +\n TUI Command (no major axis): geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor) \n Arguments: Name + 1 vertex (for the center) + 1 edge (for the direction) + 1 X Radius + 1 Y Radius. +\n TUI Command (use major axis): geompy.MakeEllipseVec(Point, Vector, RadiusMajor, RadiusMinor, VectorMajor) +\n Arguments: Name + 1 vertex (for the center) + 1 edge (for +the normal direction) + 1 X Radius + 1 Y Radius + 1 edge (for the +major axis direction) + \image html ellipse.png Example: @@ -21,4 +35,4 @@ the direction) + 1 X Radius + 1 Y Radius. Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_ellipse "Basic Geometric Objects". -*/ \ No newline at end of file +*/ 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 d9c30a23b..55e843010 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc @@ -116,21 +116,32 @@ gg = salome.ImportComponentGUI("GEOM") # create vertices p0 = geompy.MakeVertex(0., 0., 0.) -p50 = geompy.MakeVertex(50., 50., 50.) +p1 = geompy.MakeVertex(50., 50., 50.) +p2 = geompy.MakeVertex(0., 50., 0.) -# create a vector from two points -vector = geompy.MakeVector(p0, p50) +# create a normal vector from two points +normal = geompy.MakeVector(p0, p1) + +# create a major axis vector from two points +major = geompy.MakeVector(p0, p2) # create an ellipse from a point, a vector and radiuses -ellipse = geompy.MakeEllipse(p50, vector, 50, 25) +ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25) + +# create an ellipse from a point, a normal vector, radiuses and a major axis vector +ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major) # add objects in the study -id_vector = geompy.addToStudy(vector, "Vector") -id_ellipse = geompy.addToStudy(ellipse,"Ellipse") +id_normal = geompy.addToStudy(normal, "Normal") +id_major = geompy.addToStudy(major, "Major Axis") +id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1") +id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2") # display the ellipse and its normal vector -gg.createAndDisplayGO(id_vector) -gg.createAndDisplayGO(id_ellipse) +gg.createAndDisplayGO(id_normal) +gg.createAndDisplayGO(id_major) +gg.createAndDisplayGO(id_ellipse1) +gg.createAndDisplayGO(id_ellipse2) \endcode \anchor tui_creation_curve @@ -269,4 +280,4 @@ gg.setDisplayMode(id_plane3,1) gg.setTransparency(id_plane3,0.5) \endcode -*/ \ No newline at end of file +*/ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index eb23ae6c7..4cc2a6c16 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2014,6 +2014,21 @@ module GEOM in double theRMajor, in double theRMinor); + /*! + * Create an ellipse with given center, normal vector, main axis vector and radiuses. + * \param thePnt Ellipse center. + * \param theVec Vector, normal to the plane of the ellipse. + * \param theRMajor Major ellipse radius. + * \param theRMinor Minor ellipse radius. + * \param theVecMaj Vector, direction of the ellipse's main axis. + * \return New GEOM_Object, containing the created ellipse. + */ + GEOM_Object MakeEllipseVec (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor, + in GEOM_Object theVecMaj); + /*! * Create an arc of circle, passing through three given points. * \param thePnt1 Start point of the arc. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 57bd686ed..76316bd57 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -459,6 +459,11 @@ module GEOM in GEOM_Object theVec, in double theRMajor, in double theRMinor) ; + GEOM_Object MakeEllipseVec (in GEOM_Object thePnt, + in GEOM_Object theVec, + in double theRMajor, + in double theRMinor, + in GEOM_Object theVecMaj) ; GEOM_Object MakeArc (in GEOM_Object thePnt1, in GEOM_Object thePnt2, in GEOM_Object thePnt3) ; diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index fa364a92e..d2aa86f28 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -70,17 +70,20 @@ BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* p RadioButton2->close(TRUE); RadioButton3->close(TRUE); - GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints = new DlgRef_3Sel2Spin(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); - GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_MAJOR")); - GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MINOR")); + GroupPoints->TextLabel3->setText(tr("%1 (%2)").arg(tr("GEOM_VECTOR_MAJOR")).arg(tr("GEOM_OPTIONAL"))); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MAJOR")); + GroupPoints->TextLabel5->setText(tr("GEOM_RADIUS_MINOR")); GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->PushButton3->setPixmap(image1); GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true ); + GroupPoints->LineEdit3->setReadOnly( true ); Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ @@ -111,7 +114,7 @@ void BasicGUI_EllipseDlg::Init() globalSelection(); // close local contexts, if any localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); @@ -135,9 +138,11 @@ void BasicGUI_EllipseDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); @@ -175,9 +180,10 @@ bool BasicGUI_EllipseDlg::ClickOnApply() initName(); // reset - myPoint = myDir = GEOM::GEOM_Object::_nil(); + myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil(); GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->LineEdit3->setText( "" ); myEditCurrentArgument = GroupPoints->LineEdit1; //globalSelection(GEOM_POINT); globalSelection(); // close local contexts, if any @@ -207,6 +213,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) myMajor = GEOM::GEOM_Object::_nil(); return; } @@ -223,7 +230,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; - if (myEditCurrentArgument == GroupPoints->LineEdit2) + if (myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3) aNeedType = TopAbs_EDGE; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); @@ -260,6 +267,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; + else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) myMajor = aSelectedObject; } displayPreview(); @@ -277,10 +285,11 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument() if ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1; else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; + else if ( send == GroupPoints->PushButton3 ) myEditCurrentArgument = GroupPoints->LineEdit3; myEditCurrentArgument->setFocus(); globalSelection(); // close local contexts, if any - if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) + if ( myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3 ) localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); else localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); @@ -295,7 +304,8 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if ( send == GroupPoints->LineEdit1 || - send == GroupPoints->LineEdit2 ) + send == GroupPoints->LineEdit2 || + send == GroupPoints->LineEdit3 ) { myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); @@ -318,6 +328,7 @@ void BasicGUI_EllipseDlg::ActivateThisDialog() GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit2->setText( "" ); + GroupPoints->LineEdit3->setText( "" ); myPoint = myDir = GEOM::GEOM_Object::_nil(); //globalSelection( GEOM_POINT ); @@ -387,7 +398,10 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) { double aMajorR = GroupPoints->SpinBox_DX->GetValue(); double aMinorR = GroupPoints->SpinBox_DY->GetValue(); - GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); + + GEOM::GEOM_Object_var anObj = myMajor->_is_nil() ? + GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse ( myPoint, myDir, aMajorR, aMinorR ) : + GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipseVec( myPoint, myDir, aMajorR, aMinorR, myMajor ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); @@ -414,6 +428,8 @@ void BasicGUI_EllipseDlg::addSubshapesToStudy() objMap[GroupPoints->LineEdit1->text()] = myPoint; objMap[GroupPoints->LineEdit2->text()] = myDir; + if (!CORBA::is_nil(myMajor)) + objMap[GroupPoints->LineEdit3->text()] = myMajor; addSubshapesToFather( objMap ); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.h b/src/BasicGUI/BasicGUI_EllipseDlg.h index c684cec90..619450e72 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.h +++ b/src/BasicGUI/BasicGUI_EllipseDlg.h @@ -30,7 +30,7 @@ #include "GEOM_BasicGUI.hxx" #include "GEOMBase_Skeleton.h" -#include "DlgRef_2Sel2Spin.h" +#include "DlgRef_3Sel2Spin.h" #include "BasicGUI.h" @@ -59,9 +59,9 @@ private : void Init(); void enterEvent(QEvent* e); - GEOM::GEOM_Object_var myPoint, myDir; + GEOM::GEOM_Object_var myPoint, myDir, myMajor; - DlgRef_2Sel2Spin* GroupPoints; + DlgRef_3Sel2Spin* GroupPoints; private slots: void ClickOnOk(); diff --git a/src/DlgRef/DlgRef_3Sel2Spin.cxx b/src/DlgRef/DlgRef_3Sel2Spin.cxx new file mode 100644 index 000000000..6c256f2de --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Spin.cxx @@ -0,0 +1,56 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// GEOM GEOMGUI : GUI for Geometry component +// File : DlgRef_3Sel2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: +// +#include "DlgRef_3Sel2Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_3Sel2Spin::DlgRef_3Sel2Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_3Sel2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel2Spin::~DlgRef_3Sel2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_3Sel2Spin.h b/src/DlgRef/DlgRef_3Sel2Spin.h new file mode 100644 index 000000000..c39ff6275 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Spin.h @@ -0,0 +1,49 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// GEOM GEOMGUI : GUI for Geometry component +// File : DlgRef_3Sel2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: +// +#ifndef DLGREF_3SEL2SPIN_H +#define DLGREF_3SEL2SPIN_H + +#include "GEOM_DlgRef.hxx" + +#include "DlgRef_3Sel2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class GEOM_DLGREF_EXPORT DlgRef_3Sel2Spin : public DlgRef_3Sel2Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_3Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_3Sel2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // DLGREF_3SEL2SPIN_H diff --git a/src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx new file mode 100644 index 000000000..2d38a170f --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Spin_QTD.cxx @@ -0,0 +1,148 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel2Spin_QTD.ui' +** +** Created: Mon Apr 13 11:59:12 2009 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#include "DlgRef_3Sel2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel2Spin_QTD as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel2Spin_QTD::DlgRef_3Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel2Spin_QTD" ); + DlgRef_3Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + GroupBox1Layout->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel2, 1, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + GroupBox1Layout->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( TextLabel3, 2, 0 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + + GroupBox1Layout->addWidget( PushButton3, 2, 1 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + GroupBox1Layout->addWidget( LineEdit3, 2, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( TextLabel4, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + GroupBox1Layout->addMultiCellLayout( Layout2, 3, 3, 0, 2 ); + Spacer5 = new QSpacerItem( 16, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + GroupBox1Layout->addItem( Spacer5, 4, 1 ); + + DlgRef_3Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); + languageChange(); + resize( QSize(124, 201).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + + // tab order + setTabOrder( PushButton1, LineEdit1 ); + setTabOrder( LineEdit1, PushButton2 ); + setTabOrder( PushButton2, LineEdit2 ); + setTabOrder( LineEdit2, PushButton3 ); + setTabOrder( PushButton3, LineEdit3 ); + setTabOrder( LineEdit3, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel2Spin_QTD::~DlgRef_3Sel2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void DlgRef_3Sel2Spin_QTD::languageChange() +{ + setCaption( tr( "DlgRef_2Sel2Spin_QTD" ) ); + GroupBox1->setTitle( QString::null ); + TextLabel1->setText( tr( "TL1" ) ); + PushButton1->setText( QString::null ); + TextLabel2->setText( tr( "TL2" ) ); + PushButton2->setText( QString::null ); + TextLabel3->setText( tr( "TL3" ) ); + PushButton3->setText( QString::null ); + TextLabel5->setText( tr( "TL5" ) ); + TextLabel4->setText( tr( "TL4" ) ); +} + diff --git a/src/DlgRef/DlgRef_3Sel2Spin_QTD.h b/src/DlgRef/DlgRef_3Sel2Spin_QTD.h new file mode 100644 index 000000000..6a82abc93 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel2Spin_QTD.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel2Spin_QTD.ui' +** +** Created: Mon Apr 13 11:59:11 2009 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#ifndef DLGREF_3SEL2SPIN_QTD_H +#define DLGREF_3SEL2SPIN_QTD_H + +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class QGroupBox; +class QLineEdit; +class QLabel; +class QPushButton; +class QSpinBox; + +class DlgRef_3Sel2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel2Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLabel* TextLabel2; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QLabel* TextLabel3; + QPushButton* PushButton3; + QLineEdit* LineEdit3; + QSpinBox* SpinBox2; + QLabel* TextLabel5; + QLabel* TextLabel4; + QSpinBox* SpinBox1; + +protected: + QGridLayout* DlgRef_3Sel2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QSpacerItem* Spacer5; + QGridLayout* Layout2; + +protected slots: + virtual void languageChange(); + +}; + +#endif // DLGREF_3SEL2SPIN_QTD_H diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index c4ed8ecf1..12013a408 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -49,6 +49,7 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_2Sel1Spin_QTD.cxx \ DlgRef_2Sel2Spin_QTD.cxx \ DlgRef_2Sel3Spin_QTD.cxx \ + DlgRef_3Sel2Spin_QTD.cxx \ DlgRef_1Sel1Spin1Check_QTD.cxx \ DlgRef_2Sel1Spin2Check_QTD.cxx \ DlgRef_2Sel2Spin1Check_QTD.cxx \ @@ -79,6 +80,7 @@ dist_libDlgRef_la_SOURCES = \ DlgRef_2Sel1Spin.cxx \ DlgRef_2Sel2Spin.cxx \ DlgRef_2Sel3Spin.cxx \ + DlgRef_3Sel2Spin.cxx \ DlgRef_1Sel1Spin1Check.cxx \ DlgRef_2Sel1Spin2Check.cxx \ DlgRef_2Sel2Spin1Check.cxx \ @@ -113,6 +115,7 @@ MOC_FILES = \ DlgRef_2Sel1Spin_QTD_moc.cxx \ DlgRef_2Sel2Spin_QTD_moc.cxx \ DlgRef_2Sel3Spin_QTD_moc.cxx \ + DlgRef_3Sel2Spin_QTD_moc.cxx \ DlgRef_2Sel3Spin2Rb_QTD_moc.cxx \ DlgRef_2Sel3Spin2Rb_moc.cxx \ DlgRef_1Sel1Spin1Check_QTD_moc.cxx \ @@ -143,6 +146,7 @@ MOC_FILES = \ DlgRef_2Sel1Spin_moc.cxx \ DlgRef_2Sel2Spin_moc.cxx \ DlgRef_2Sel3Spin_moc.cxx \ + DlgRef_3Sel2Spin_moc.cxx \ DlgRef_1Sel1Spin1Check_moc.cxx \ DlgRef_2Sel1Spin2Check_moc.cxx \ DlgRef_2Sel2Spin1Check_moc.cxx \ @@ -179,6 +183,7 @@ salomeinclude_HEADERS = \ DlgRef_2Sel1Spin_QTD.h \ DlgRef_2Sel2Spin_QTD.h \ DlgRef_2Sel3Spin_QTD.h \ + DlgRef_3Sel2Spin_QTD.h \ DlgRef_1Sel1Spin1Check_QTD.h \ DlgRef_2Sel1Spin2Check_QTD.h \ DlgRef_2Sel2Spin1Check_QTD.h \ @@ -209,6 +214,7 @@ salomeinclude_HEADERS = \ DlgRef_2Sel1Spin.h \ DlgRef_2Sel2Spin.h \ DlgRef_2Sel3Spin.h \ + DlgRef_3Sel2Spin.h \ DlgRef_1Sel1Spin1Check.h \ DlgRef_2Sel1Spin2Check.h \ DlgRef_2Sel2Spin1Check.h \ diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui new file mode 100644 index 000000000..04f58e6be --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Sel2Spin_QTD.ui @@ -0,0 +1,262 @@ + +DlgRef_3Sel2Spin_QTD + + + DlgRef_3Sel2Spin_QTD + + + + 0 + 0 + 124 + 201 + + + + DlgRef_2Sel2Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + LineEdit2 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit3 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 16 + 16 + + + + + + + + + PushButton1 + LineEdit1 + PushButton2 + LineEdit2 + PushButton3 + LineEdit3 + SpinBox1 + SpinBox2 + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index 4f4e471f8..1e2a8bd8e 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -121,5 +121,8 @@ #uic -o DlgRef_3Sel1Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui #uic -o DlgRef_3Sel1Check_QTD.cxx -impl DlgRef_3Sel1Check_QTD.h DlgRef_3Sel1Check_QTD.ui>>>>>>> 1.6.2.3 -uic -o DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui -uic -o DlgRef_3Sel3Spin2Check_QTD.cxx -impl DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui \ No newline at end of file +#uic -o DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui +#uic -o DlgRef_3Sel3Spin2Check_QTD.cxx -impl DlgRef_3Sel3Spin2Check_QTD.h DlgRef_3Sel3Spin2Check_QTD.ui + +uic -o DlgRef_3Sel2Spin_QTD.h DlgRef_3Sel2Spin_QTD.ui +uic -o DlgRef_3Sel2Spin_QTD.cxx -impl DlgRef_3Sel2Spin_QTD.h DlgRef_3Sel2Spin_QTD.ui diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 61da72d2e..df66b8bae 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -732,6 +732,14 @@ msgstr "Major radius :" msgid "GEOM_RADIUS_MINOR" msgstr "Minor radius :" +#Major axis +msgid "GEOM_VECTOR_MAJOR" +msgstr "Major Axis" + +#Optional tag +msgid "GEOM_OPTIONAL" +msgstr "optional" + #Compound msgid "GEOM_COMPOUND" msgstr "Compound" diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx index 15de08566..98c874c60 100644 --- a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx @@ -72,23 +72,68 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; if (aType == ELLIPSE_PNT_VEC_RR) { + // Center Handle(GEOM_Function) aRefPoint = aCI.GetCenter(); - Handle(GEOM_Function) aRefVector = aCI.GetVector(); TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() != TopAbs_VERTEX) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid center argument, must be a point"); + } + gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + // Normal + Handle(GEOM_Function) aRefVector = aCI.GetVector(); TopoDS_Shape aShapeVec = aRefVector->GetValue(); - if (aShapePnt.ShapeType() == TopAbs_VERTEX && - aShapeVec.ShapeType() == TopAbs_EDGE) { - gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + if (aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid normal vector argument, must be a vector or an edge"); + } + TopoDS_Edge anE = TopoDS::Edge(aShapeVec); + TopoDS_Vertex V1, V2; + TopExp::Vertices(anE, V1, V2, Standard_True); + if (V1.IsNull() || V2.IsNull()) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid normal vector argument: cannot retrieve vertices"); + } + gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aV.Magnitude() < gp::Resolution()) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: normal vector of zero length is given"); + } + + // Axes + gp_Ax2 anAxes (aP, aV); + + // Main Axis vector (optional) + Handle(GEOM_Function) aRefVectorMaj = aCI.GetVectorMajor(); + if (!aRefVectorMaj.IsNull()) { + TopoDS_Shape aShapeVec = aRefVectorMaj->GetValue(); + if (aShapeVec.ShapeType() != TopAbs_EDGE) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid major axis vector argument, must be a vector or an edge"); + } TopoDS_Edge anE = TopoDS::Edge(aShapeVec); TopoDS_Vertex V1, V2; TopExp::Vertices(anE, V1, V2, Standard_True); - if (!V1.IsNull() && !V2.IsNull()) { - gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); - gp_Ax2 anAxes (aP, aV); - gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor()); - aShape = BRepBuilderAPI_MakeEdge(anEll).Edge(); + if (V1.IsNull() || V2.IsNull()) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: invalid major axis vector argument: cannot retrieve vertices"); } + gp_Vec aVM (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2)); + if (aVM.Magnitude() < gp::Resolution()) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: major axis vector of zero length is given"); + } + if (aV.IsParallel(aVM, Precision::Angular())) { + Standard_ConstructionError::Raise + ("Ellipse creation aborted: normal and major axis vectors are parallel"); + } + // Axes defined with main axis vector + anAxes = gp_Ax2 (aP, aV, aVM); } + + // Ellipse + gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor()); + aShape = BRepBuilderAPI_MakeEdge(anEll).Edge(); } else { } diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 73b962508..951366f50 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -325,7 +325,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR //============================================================================= Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, - double theRMajor, double theRMinor) + double theRMajor, double theRMinor, + Handle(GEOM_Object) theVecMaj) { SetErrorCode(KO); @@ -354,6 +355,13 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse aCI.SetRMajor(theRMajor); aCI.SetRMinor(theRMinor); + // vector of major axis is optional parameter + if (!theVecMaj.IsNull()) { + Handle(GEOM_Function) aRefVecMaj = theVecMaj->GetLastFunction(); + if (aRefVecMaj.IsNull()) return NULL; + aCI.SetVectorMajor(aRefVecMaj); + } + //Compute the Ellipse value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 @@ -371,8 +379,16 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse } //Make a Python command - GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" - << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + //Make a Python command + if (!theVecMaj.IsNull()) { + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor + << ", " << theVecMaj << ")"; + } + else { + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; + } SetErrorCode(OK); return anEll; diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx index 2231b42ac..36109f8c3 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx @@ -49,7 +49,8 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeEllipse (Handle(GEOM_Object) thePnt, Handle(GEOM_Object) theVec, - double theRMajor, double theRMinor); + double theRMajor, double theRMinor, + Handle(GEOM_Object) theVecMaj); Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1, Handle(GEOM_Object) thePnt2, diff --git a/src/GEOMImpl/GEOMImpl_IEllipse.hxx b/src/GEOMImpl/GEOMImpl_IEllipse.hxx index 8a199e760..8fe39a5f3 100644 --- a/src/GEOMImpl/GEOMImpl_IEllipse.hxx +++ b/src/GEOMImpl/GEOMImpl_IEllipse.hxx @@ -23,10 +23,11 @@ // #include "GEOM_Function.hxx" -#define ELLIPS_ARG_CC 1 -#define ELLIPS_ARG_VV 2 -#define ELLIPS_ARG_RMAJ 3 -#define ELLIPS_ARG_RMIN 4 +#define ELLIPS_ARG_CC 1 +#define ELLIPS_ARG_VV 2 +#define ELLIPS_ARG_RMAJ 3 +#define ELLIPS_ARG_RMIN 4 +#define ELLIPS_ARG_VVMAJ 5 class GEOMImpl_IEllipse { @@ -40,12 +41,16 @@ class GEOMImpl_IEllipse void SetRMajor(double theR) { _func->SetReal(ELLIPS_ARG_RMAJ, theR); } void SetRMinor(double theR) { _func->SetReal(ELLIPS_ARG_RMIN, theR); } + void SetVectorMajor(Handle(GEOM_Function) theV) { _func->SetReference(ELLIPS_ARG_VVMAJ, theV); } + Handle(GEOM_Function) GetCenter() { return _func->GetReference(ELLIPS_ARG_CC); } Handle(GEOM_Function) GetVector() { return _func->GetReference(ELLIPS_ARG_VV); } double GetRMajor() { return _func->GetReal(ELLIPS_ARG_RMAJ); } double GetRMinor() { return _func->GetReal(ELLIPS_ARG_RMIN); } + Handle(GEOM_Function) GetVectorMajor() { return _func->GetReference(ELLIPS_ARG_VVMAJ); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index b0097a5af..21adb1d0c 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -173,17 +173,54 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn(); - //Get the reference points + //Get the arguments Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject (thePnt->GetStudyID(), thePnt->GetEntry()); Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aVecMaj; if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn(); // Make Ellipse Handle(GEOM_Object) anObject = - GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor); + GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + +//============================================================================= +/*! + * MakeEllipseVec + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipseVec + (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, + CORBA::Double theRMajor, double theRMinor, + GEOM::GEOM_Object_ptr theVecMaj) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + //Get the arguments + Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject + (thePnt->GetStudyID(), thePnt->GetEntry()); + Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject + (theVec->GetStudyID(), theVec->GetEntry()); + Handle(GEOM_Object) aVecMaj; + if (!CORBA::is_nil(theVecMaj)) { + aVecMaj = GetOperations()->GetEngine()->GetObject + (theVecMaj->GetStudyID(), theVecMaj->GetEntry()); + if (aVecMaj.IsNull()) return aGEOMObject._retn(); + } + + // Make Ellipse + Handle(GEOM_Object) anObject = + GetOperations()->MakeEllipse(aPnt, aVec, theRMajor, theRMinor, aVecMaj); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh index f26eef628..950839198 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh @@ -57,6 +57,11 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i : GEOM::GEOM_Object_ptr theVector, double theRMajor, double theRMinor); + GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + double theRMajor, double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor); + GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 7918c6cfd..c43faf91d 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -2412,6 +2412,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipse (GEOM::GEOM_Object_ptr theCente return anObj; } +//============================================================================= +// MakeEllipseVec: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, + CORBA::Double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor) +{ + beginService( " GEOM_Superv_i::MakeEllipseVec" ); + MESSAGE("GEOM_Superv_i::MakeEllipseVec"); + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeEllipseVec(theCenter, theVector, theRMajor, theRMinor, theVectorMajor); + endService( " GEOM_Superv_i::MakeEllipseVec" ); + return anObj; +} + //============================================================================= // MakeArc: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 3e94148f5..ae5934130 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -530,6 +530,10 @@ public: GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theVector, CORBA::Double theRMajor, CORBA::Double theRMinor); + GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter, + GEOM::GEOM_Object_ptr theVector, + CORBA::Double theRMajor, CORBA::Double theRMinor, + GEOM::GEOM_Object_ptr theVectorMajor); GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2, GEOM::GEOM_Object_ptr thePnt3); diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 944ee7ccf..d4fc3a2d9 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -534,12 +534,17 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theVec Vector, normal to the plane of the ellipse. # @param theRMajor Major ellipse radius. # @param theRMinor Minor ellipse radius. + # @param theVecMaj Vector, direction of the ellipse's main axis. # @return New GEOM_Object, containing the created ellipse. # # @ref tui_creation_ellipse "Example" - def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor): + def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor, theVecMaj=None): # Example: see GEOM_TestAll.py - anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) + if theVecMaj is not None: + anObj = self.CurvesOp.MakeEllipseVec(thePnt, theVec, theRMajor, theRMinor, theVecMaj) + else: + anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) + pass RaiseIfFailed("MakeEllipse", self.CurvesOp) return anObj