0018862: EDF 657 GEOM : to be able to create an arc of ellipse

This commit is contained in:
dmv 2008-11-07 12:20:55 +00:00
parent 88100d9138
commit 7dde2fd90a
24 changed files with 403 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -29,6 +29,17 @@ Point, End Point, boolean Sense)</em>
\image html arc2.png
Finally, it is possible to create an <b>Arc of Ellipse</b>, which is also done by three points:
the Arguments <b>Point 1</b>, <b>Point 2</b> and the <b>Center Point</b>. The arc is built on the Ellipse that
lies in the plane defined by the three points, with the center in the <b>Center point</b>.
The major radius of the Ellipse is defined by the distance between the <b>Center Point</b> and
the most remote Argument point. The minor radius is defined by the shortest distance between the
other Argument point and the major radius.
\n <b>TUI Command:</b> <em>geompy.MakeArcOfEllipse(Center Point, First Point, Second Point)</em>
\n <b>Arguments:</b> Name + 3 vertices.
\image html arcofellipse2.png
\n <b>Examples:</b>
\image html arcsn.png
@ -40,4 +51,10 @@ Point, End Point, boolean Sense)</em>
\image html arcsn2.png
<center>Reversed arc.</center>
\image html arcofellipse1.png
<center>Arc Of Ellipse.</center>
Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_arc "Basic Geometric Objects".
*/

View File

@ -133,6 +133,39 @@ gg.createAndDisplayGO(id_vector)
gg.createAndDisplayGO(id_ellipse)
\endcode
\anchor tui_creation_arc
<br><h2>Creation of an Arc</h2>
\code
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create vertices
p0 = geompy.MakeVertex(0., 0., 0.)
p1 = geompy.MakeVertex(100., 0., 0.)
p2 = geompy.MakeVertex(50., 0., 50.)
# create an arc from a three points
arc1 = geompy.MakeArc(p0, p1, p2)
# create an arc from a center point, a start point and end point
arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
# create an arc from a center point, a major point and minor point
arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
# add objects in the study
id_arc1 = geompy.addToStudy(arc1, "Arc 1")
id_arc2 = geompy.addToStudy(arc2, "Arc 2")
id_arc3 = geompy.addToStudy(arc3, "Arc 3")
# display the arcs
gg.createAndDisplayGO(id_arc1)
gg.createAndDisplayGO(id_arc2)
gg.createAndDisplayGO(id_arc3)
\endcode
\anchor tui_creation_curve
<br><h2>Creation of a Curve</h2>

View File

@ -2096,6 +2096,17 @@ module GEOM
in GEOM_Object thePnt2,
in boolean theSense);
/*!
* Create an arc of ellipse of center C and two points P1 P2.
* \param theCenter Center point of the arc.
* \param thePnt1 Major radius is distance from center to Pnt1.
* \param thePnt2 define a plane and Minor radius as a shortest distance from Pnt2 to vector Center->Pnt1.
* \return New GEOM_Object, containing the created arc.
*/
GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter,
in GEOM_Object thePnt1,
in GEOM_Object thePnt2);
/*!
* Create a polyline on the set of points.

View File

@ -480,6 +480,9 @@ module GEOM
in GEOM_Object thePnt1,
in GEOM_Object thePnt2,
in boolean theSense) ;
GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter,
in GEOM_Object thePnt1,
in GEOM_Object thePnt2) ;
GEOM_Object MakePolyline (in GEOM_List thePoints) ;
GEOM_Object MakeSplineBezier (in GEOM_List thePoints) ;
GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints) ;

View File

@ -4224,6 +4224,38 @@
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>MakeArcOfEllipse</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>thePnt1</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>thePnt2</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>thePnt3</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>GEOM_Object</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>MakePolyline</service-name>
<service-author></service-author>

View File

@ -38,6 +38,8 @@ ImportExport \
ShHealing \
angle.png \
arc.png \
arccenter.png \
arcofellipse.png \
archimede.png \
axisinertia.png \
basicproperties.png \
@ -203,7 +205,6 @@ free_faces.png \
propagate.png \
redo.png \
undo.png \
arccenter.png \
glue2.png \
remove_extra_edges.png \
coordsys.png \

BIN
resources/arcofellipse.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

View File

@ -58,6 +58,7 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_OF_ELLIPSE" ) ) );
setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
@ -65,8 +66,7 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
mainFrame()->RadioButton3->setIcon( image3 );
Group3Pnts = new DlgRef_3Sel( centralWidget() );
@ -109,10 +109,30 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
Group3Pnts3 = new DlgRef_3Sel( centralWidget() );
Group3Pnts3->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
Group3Pnts3->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
Group3Pnts3->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
Group3Pnts3->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
Group3Pnts3->LineEdit1->setReadOnly( true );
Group3Pnts3->LineEdit2->setReadOnly( true );
Group3Pnts3->LineEdit3->setReadOnly( true );
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
Group3Pnts3->PushButton1->setIcon(image2);
Group3Pnts3->PushButton2->setIcon(image2);
Group3Pnts3->PushButton3->setIcon(image2);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group3Pnts );
layout->addWidget( Group3Pnts2 );
layout->addWidget( Group3Pnts3 );
setHelpFileName( "create_arc_page.html" );
@ -169,6 +189,14 @@ void BasicGUI_ArcDlg::Init()
connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts3->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts3->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
@ -211,9 +239,6 @@ bool BasicGUI_ArcDlg::ClickOnApply()
//=================================================================================
void BasicGUI_ArcDlg::SelectionIntoArgument()
{
if ( getConstructorId() != 0 && getConstructorId() != 1 )
return;
myEditCurrentArgument->setText( "" );
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@ -234,6 +259,12 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
return;
break;
case 2:
if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
return;
break;
}
}
// nbSel == 1
@ -314,6 +345,23 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
Group3Pnts2->PushButton1->click();
}
break;
case 2:
if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
myPoint1 = aSelectedObject;
if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
Group3Pnts3->PushButton2->click();
}
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
myPoint2 = aSelectedObject;
if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
Group3Pnts3->PushButton3->click();
}
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
myPoint3 = aSelectedObject;
if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
Group3Pnts3->PushButton1->click();
}
break;
}
}
@ -384,6 +432,32 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument()
Group3Pnts2->LineEdit3->setEnabled(true);
}
break;
case 2:
if ( send == Group3Pnts3->PushButton1 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit1;
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
}
else if ( send == Group3Pnts3->PushButton2 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit2;
Group3Pnts3->PushButton1->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(false);
Group3Pnts3->LineEdit2->setEnabled(true);
Group3Pnts3->LineEdit3->setEnabled(false);
}
else if ( send == Group3Pnts3->PushButton3 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit3;
Group3Pnts3->PushButton1->setDown(false);
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(false);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(true);
}
break;
}
myEditCurrentArgument->setFocus();
// SelectionIntoArgument();
@ -400,7 +474,8 @@ void BasicGUI_ArcDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) {
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ||
send == Group3Pnts3->LineEdit1 || send == Group3Pnts3->LineEdit2 || send == Group3Pnts3->LineEdit3 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -474,6 +549,14 @@ bool BasicGUI_ArcDlg::isValid( QString& msg )
return false;
break;
}
case 2:
{
if (Group3Pnts3->LineEdit1->text().trimmed().isEmpty() ||
Group3Pnts3->LineEdit2->text().trimmed().isEmpty() ||
Group3Pnts3->LineEdit3->text().trimmed().isEmpty())
return false;
break;
}
}
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
@ -506,6 +589,14 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects )
}
break;
}
case 2:
{
if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcOfEllipse( myPoint1, myPoint2, myPoint3 );
res = true;
}
break;
}
}
if ( !anObj->_is_nil() ) {
objects.push_back( anObj._retn() );
@ -527,8 +618,9 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
Group3Pnts2->hide();
Group3Pnts->show();
Group3Pnts2->hide();
Group3Pnts3->hide();
Group3Pnts->PushButton1->setDown(true);
Group3Pnts->PushButton2->setDown(false);
Group3Pnts->PushButton3->setDown(false);
@ -550,6 +642,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
Group3Pnts->hide();
Group3Pnts2->show();
Group3Pnts3->hide();
Group3Pnts2->PushButton1->setDown(true);
Group3Pnts2->PushButton2->setDown(false);
Group3Pnts2->PushButton3->setDown(false);
@ -564,6 +657,28 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
myEditCurrentArgument = Group3Pnts2->LineEdit1;
break;
}
case 2:
{
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
Group3Pnts->hide();
Group3Pnts2->hide();
Group3Pnts3->show();
Group3Pnts3->PushButton1->setDown(true);
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setText( "" );
Group3Pnts3->LineEdit2->setText( "" );
Group3Pnts3->LineEdit3->setText( "" );
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
myEditCurrentArgument = Group3Pnts3->LineEdit1;
break;
}
}
qApp->processEvents();
@ -608,6 +723,11 @@ void BasicGUI_ArcDlg::addSubshapesToStudy()
objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
break;
case 2:
objMap[Group3Pnts3->LineEdit1->text()] = myPoint1;
objMap[Group3Pnts3->LineEdit2->text()] = myPoint2;
objMap[Group3Pnts3->LineEdit3->text()] = myPoint3;
break;
}
addSubshapesToFather( objMap );
}

View File

@ -59,6 +59,7 @@ private:
DlgRef_3Sel* Group3Pnts;
DlgRef_3Sel1Check* Group3Pnts2;
DlgRef_3Sel* Group3Pnts3;
private slots:
void ClickOnOk();

View File

@ -18,6 +18,10 @@
<source>ICON_DLG_ARC_CENTER</source>
<translation>arccenter.png</translation>
</message>
<message>
<source>ICON_DLG_ARC_OF_ELLIPSE</source>
<translation>arcofellipse.png</translation>
</message>
<message>
<source>ICON_DLG_BASICPROPERTIES</source>
<translation>basicproperties.png</translation>

View File

@ -36,12 +36,16 @@
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeCircle.hxx>
#include <GC_MakeArcOfEllipse.hxx>
#include <GC_MakeEllipse.hxx>
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include "utilities.h"
@ -77,7 +81,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if ((aType == CIRC_ARC_THREE_PNT) || (aType == CIRC_ARC_CENTER))
if ((aType == CIRC_ARC_THREE_PNT) || (aType == CIRC_ARC_CENTER) || (aType == ELLIPSE_ARC_CENTER_TWO_PNT))
{
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
@ -107,9 +111,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
{
GC_MakeArcOfCircle arc (aP1, aP2, aP3);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
}
else // CIRC_ARC_CENTER
{
} else if ( aType == CIRC_ARC_CENTER ) { // CIRC_ARC_CENTER
Standard_Boolean sense = aCI.GetSense();
Standard_Real aRad = aP1.Distance(aP2);
@ -125,9 +127,29 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
GC_MakeArcOfCircle arc (aGeomCirc->Circ(), aP2, aP3, Standard_True);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
} else if ( aType == ELLIPSE_ARC_CENTER_TWO_PNT ) { // ELLIPSE_ARC_CENTER_TWO_PNT
if ( aP1.Distance(aP2) <= aP1.Distance(aP3) ) {
// Standard_ConstructionError::Raise("Arc creation aborted: the distance from Center Point to Point 1 needs to be bigger than the distance from Center Point to Point 2");
cout << "aP1.Distance(aP2) <= aP1.Distance(aP3)" << endl;
gp_Pnt aTmpP = aP2;
aP2 = aP3;
aP3 = aTmpP;
}
GC_MakeEllipse ellipse (aP2, aP3, aP1);
Handle(Geom_Ellipse) aGeomEllipse = ellipse.Value();
gp_Vec aV1 (aP1, aP2);
gp_Vec aV2 (aP1, aP3);
double alpha = fabs(aV1.Angle(aV2));
GC_MakeArcOfEllipse arc (aGeomEllipse->Elips(), aP2, aP3, Standard_True);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
}
}
} else {
}
else {
}
if (aShape.IsNull()) return 0;

View File

@ -509,6 +509,67 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Objec
return anArc;
}
//=============================================================================
/*!
* MakeArcOfEllipse
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3)
{
SetErrorCode(KO);
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle Arc object
Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE_ARC);
//Add a new Circle Arc function
Handle(GEOM_Function) aFunction =
anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
GEOMImpl_IArc aCI (aFunction);
Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
aCI.SetPoint1(aRefPnt1);
aCI.SetPoint2(aRefPnt2);
aCI.SetPoint3(aRefPnt3);
//Compute the Arc value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Arc 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) << anArc << " = geompy.MakeArcOfEllipse("
<< thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
SetErrorCode(OK);
return anArc;
}
//=============================================================================
/*!
* MakeSplineBezier

View File

@ -60,6 +60,10 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
Handle(GEOM_Object) thePnt3,
bool theSense);
Standard_EXPORT Handle(GEOM_Object) MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3);
Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list<Handle(GEOM_Object)> thePoints);
Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list<Handle(GEOM_Object)> thePoints);

View File

@ -85,6 +85,8 @@
#define GEOM_SHAPES_ON_SHAPE 42
#define GEOM_ELLIPSE_ARC 43
//GEOM_Function types
@ -215,6 +217,7 @@
#define CIRC_ARC_THREE_PNT 1
#define CIRC_ARC_CENTER 2
#define ELLIPSE_ARC_CENTER_TWO_PNT 3
#define FILLET_SHAPE_ALL 1
#define FILLET_SHAPE_EDGES 2

View File

@ -273,6 +273,43 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcCenter
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeArc
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcOfEllipse
(GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
//Get the reference points
Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
(thePnt1->GetStudyID(), thePnt1->GetEntry());
Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
(thePnt2->GetStudyID(), thePnt2->GetEntry());
Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
(thePnt3->GetStudyID(), thePnt3->GetEntry());
if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
// Make Arc
Handle(GEOM_Object) anObject =
GetOperations()->MakeArcOfEllipse(aPnt1, aPnt2, aPnt3);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePolyline

View File

@ -65,6 +65,10 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
GEOM::GEOM_Object_ptr thePnt3,
bool theSense);
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints);
GEOM::GEOM_Object_ptr MakeSplineBezier (const GEOM::ListOfGO& thePoints);

View File

@ -2545,6 +2545,21 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcCenter (GEOM::GEOM_Object_ptr theCen
return anObj;
}
//=============================================================================
// MakeArcOfEllipse:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3)
{
beginService( " GEOM_Superv_i::MakeArcOfEllipse" );
MESSAGE("GEOM_Superv_i::MakeArcOfEllipse");
getCurvesOp();
GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeArcOfEllipse(thePnt1, thePnt2, thePnt3);
endService( " GEOM_Superv_i::MakeArcOfEllipse" );
return anObj;
}
//=============================================================================
// MakePolyline:
//=============================================================================

View File

@ -557,6 +557,9 @@ public:
GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
CORBA::Boolean theSense);
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints);
GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints);
GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints);

View File

@ -92,6 +92,7 @@ def TestAll (geompy, math):
Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
@ -292,6 +293,8 @@ def TestAll (geompy, math):
id_Plane1 = geompy.addToStudy(Plane1, "Plane by 3 points")
id_Arc = geompy.addToStudy(Arc, "Arc")
id_Arc2 = geompy.addToStudy(Arc2, "Arc2")
id_Arc3 = geompy.addToStudy(Arc3, "Arc3")
id_Circle = geompy.addToStudy(Circle, "Circle")
id_Circle1 = geompy.addToStudy(Circle1, "Circle by 3 points")
id_Circle2 = geompy.addToStudy(Circle2, "Circle by center and 2 points")

View File

@ -493,6 +493,19 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("MakeArcCenter", self.CurvesOp)
return anObj
## Create an arc of ellipse, of center and two points.
# @param theCenter Center of the arc.
# @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
# @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
# @return New GEOM_Object, containing the created arc.
#
# @ref swig_MakeArc "Example"
def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
return anObj
## Create a circle with given center, normal vector and radius.
# @param thePnt Circle center.
# @param theVec Vector, normal to the plane of the circle.