implement Curve2d

This commit is contained in:
wmayer 2016-12-03 11:01:44 +01:00
parent 9864684f1c
commit 6de10d4fab
2 changed files with 146 additions and 150 deletions

View File

@ -13,7 +13,7 @@
<Documentation>
<Author Licence="LGPL" Name="Werner Mayer" EMail="wmayer@users.sourceforge.net" />
<UserDocu>
The abstract class GeometryCurve is the root class of all curve objects.
The abstract class Geom2dCurve is the root class of all curve objects.
</UserDocu>
</Documentation>
<Methode Name="reverse">
@ -26,7 +26,6 @@
<UserDocu>Return the shape for the geometry.</UserDocu>
</Documentation>
</Methode>
<!--
<Methode Name="discretize" Const="true" Keyword="true">
<Documentation>
<UserDocu>Discretizes the curve and returns a list of points.
@ -50,7 +49,7 @@ then the behaviour is as if using the keyword 'Distance'.
Example:
import Part
c=Part.Circle()
c=PartGeom2d.Circle2d()
c.Radius=5
p=c.discretize(Number=50,First=3.14)
s=Part.Compound([Part.Vertex(i) for i in p])
@ -75,30 +74,28 @@ length([uMin,uMax,Tol]) -> Float</UserDocu>
parameterAtDistance([abscissa, startingParameter]) -> Float the</UserDocu>
</Documentation>
</Methode>
-->
<Methode Name="value">
<Documentation>
<UserDocu>Computes the point of parameter u on this curve</UserDocu>
</Documentation>
</Methode>
<!--
<Methode Name="tangent">
<Documentation>
<UserDocu>Computes the tangent of parameter u on this curve</UserDocu>
</Documentation>
</Methode>
<Methode Name="parameter">
<Methode Name="parameter">
<Documentation>
<UserDocu>Returns the parameter on the curve
of the nearest orthogonal projection of the point.</UserDocu>
</Documentation>
</Methode>
<Methode Name="normal" Const="true">
<Methode Name="normal" Const="true">
<Documentation>
<UserDocu>Vector = normal(pos) - Get the normal vector at the given parameter [First|Last] if defined</UserDocu>
</Documentation>
</Methode>
<Methode Name="curvature" Const="true">
<Methode Name="curvature" Const="true">
<Documentation>
<UserDocu>Float = curvature(pos) - Get the curvature at the given parameter [First|Last] if defined</UserDocu>
</Documentation>
@ -108,21 +105,14 @@ of the nearest orthogonal projection of the point.</UserDocu>
<UserDocu>Vector = centerOfCurvature(float pos) - Get the center of curvature at the given parameter [First|Last] if defined</UserDocu>
</Documentation>
</Methode>
<Methode Name="intersect" Const="true">
<Documentation>
<UserDocu>
Returns all intersection points and curve segments between the curve and the curve/surface.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="intersectCC" Const="true">
<Documentation>
<UserDocu>
Returns all intersection points between this curve and the given curve.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="toBSpline">
<Methode Name="intersectCC" Const="true">
<Documentation>
<UserDocu>
Returns all intersection points between this curve and the given curve.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="toBSpline">
<Documentation>
<UserDocu>
Converts a curve of any type (only part from First to Last)
@ -130,7 +120,7 @@ of the nearest orthogonal projection of the point.</UserDocu>
</UserDocu>
</Documentation>
</Methode>
<Methode Name="approximateBSpline">
<Methode Name="approximateBSpline">
<Documentation>
<UserDocu>
Approximates a curve of any type to a B-Spline curve
@ -138,7 +128,6 @@ of the nearest orthogonal projection of the point.</UserDocu>
</UserDocu>
</Documentation>
</Methode>
-->
<Attribute Name="Continuity" ReadOnly="true">
<Documentation>
<UserDocu>

View File

@ -33,35 +33,28 @@
# include <GCPnts_QuasiUniformDeflection.hxx>
# include <GCPnts_AbscissaPoint.hxx>
# include <Geom2dAPI_InterCurveCurve.hxx>
# include <GeomAPI.hxx>
# include <Geom_Geometry.hxx>
# include <Geom_Curve.hxx>
# include <Geom_Plane.hxx>
# include <Geom_Surface.hxx>
# include <Geom2d_Geometry.hxx>
# include <Geom2d_Curve.hxx>
# include <Geom2dAdaptor_Curve.hxx>
# include <GeomFill.hxx>
# include <GeomLProp_CLProps.hxx>
# include <Geom_RectangularTrimmedSurface.hxx>
# include <Geom_BSplineSurface.hxx>
# include <Geom2dLProp_CLProps2d.hxx>
# include <Precision.hxx>
# include <GeomAPI_ProjectPointOnCurve.hxx>
# include <GeomConvert_ApproxCurve.hxx>
# include <Geom2dAPI_ProjectPointOnCurve.hxx>
# include <Geom2dConvert_ApproxCurve.hxx>
# include <Standard_Failure.hxx>
# include <Standard_NullValue.hxx>
# include <ShapeConstruct_Curve.hxx>
# include <GeomAPI_IntCS.hxx>
# include <Geom2dAPI_ExtremaCurveCurve.hxx>
# include <BRepBuilderAPI_MakeEdge2d.hxx>
# include <BRepBuilderAPI_MakeEdge.hxx>
#endif
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
#include <Mod/Part/App/Geometry.h>
#include <Mod/Part/App/Geometry2d.h>
#include <Mod/Part/App/GeometrySurfacePy.h>
#include <Mod/Part/App/Geom2d/BSplineCurve2dPy.h>
#include <Mod/Part/App/Geom2d/Curve2dPy.h>
#include <Mod/Part/App/Geom2d/Curve2dPy.cpp>
#include <Mod/Part/App/GeometrySurfacePy.h>
#include <Mod/Part/App/OCCError.h>
#include <Mod/Part/App/TopoShape.h>
@ -188,7 +181,6 @@ PyObject* Curve2dPy::toShape(PyObject *args)
return 0;
}
#if 0
PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
{
try {
@ -200,59 +192,57 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
}
Geom2dAdaptor_Curve adapt(c);
bool uniformAbscissaPoints = false;
bool uniformAbscissaDistance = false;
int numPoints = -1;
double distance = -1;
double first = adapt.FirstParameter();
double last = adapt.LastParameter();
// use no kwds
PyObject* dist_or_num;
if (PyArg_ParseTuple(args, "O", &dist_or_num)) {
if (PyInt_Check(dist_or_num)) {
numPoints = PyInt_AsLong(dist_or_num);
uniformAbscissaPoints = true;
}
else if (PyFloat_Check(dist_or_num)) {
distance = PyFloat_AsDouble(dist_or_num);
uniformAbscissaDistance = true;
}
else {
PyErr_SetString(PyExc_TypeError, "Either int or float expected");
return 0;
}
}
else {
// use Number kwds
static char* kwds_numPoints[] = {"Number","First","Last",NULL};
PyErr_Clear();
if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) {
uniformAbscissaPoints = true;
}
else {
// use Abscissa kwds
static char* kwds_Distance[] = {"Distance","First","Last",NULL};
PyErr_Clear();
if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) {
uniformAbscissaDistance = true;
}
}
}
if (uniformAbscissaPoints || uniformAbscissaDistance) {
// use Number kwds
static char* kwds_numPoints[] = {"Number","First","Last",NULL};
PyErr_Clear();
int numPoints = -1;
if (PyArg_ParseTupleAndKeywords(args, kwds, "i|dd", kwds_numPoints, &numPoints, &first, &last)) {
GCPnts_UniformAbscissa discretizer;
if (uniformAbscissaPoints)
discretizer.Initialize (adapt, numPoints, first, last);
else
discretizer.Initialize (adapt, distance, first, last);
discretizer.Initialize (adapt, numPoints, first, last);
if (discretizer.IsDone () && discretizer.NbPoints () > 0) {
Py::List points;
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
points.append(Py::asObject(new Base::Vector2dPy(p.X(),p.Y())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PartExceptionOCCError, "Discretization of curve failed");
return 0;
}
}
// use Distance kwds
static char* kwds_Distance[] = {"Distance","First","Last",NULL};
PyErr_Clear();
double distance = -1;
if (PyArg_ParseTupleAndKeywords(args, kwds, "d|dd", kwds_Distance, &distance, &first, &last)) {
GCPnts_UniformAbscissa discretizer;
discretizer.Initialize (adapt, distance, first, last);
if (discretizer.IsDone () && discretizer.NbPoints () > 0) {
Py::List points;
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -274,7 +264,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt p = discretizer.Value (i);
points.append(Py::Vector(Base::Vector3d(p.X(),p.Y(),p.Z())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -298,7 +293,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt p = discretizer.Value (i);
points.append(Py::Vector(Base::Vector3d(p.X(),p.Y(),p.Z())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -320,7 +320,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt2d p = adapt.Value (discretizer.Parameter (i));
points.append(Py::asObject(new Base::Vector2dPy(p.X(),p.Y())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -342,7 +347,12 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt p = discretizer.Value (i);
points.append(Py::Vector(Base::Vector3d(p.X(),p.Y(),p.Z())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p.X()));
arg.setItem(1, Py::Float(p.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -365,7 +375,7 @@ PyObject* Curve2dPy::discretize(PyObject *args, PyObject *kwds)
PyObject* Curve2dPy::length(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u=c->FirstParameter();
@ -373,7 +383,7 @@ PyObject* Curve2dPy::length(PyObject *args)
double t=Precision::Confusion();
if (!PyArg_ParseTuple(args, "|ddd", &u,&v,&t))
return 0;
GeomAdaptor_Curve adapt(c);
Geom2dAdaptor_Curve adapt(c);
double len = GCPnts_AbscissaPoint::Length(adapt,u,v,t);
return PyFloat_FromDouble(len);
}
@ -391,14 +401,14 @@ PyObject* Curve2dPy::length(PyObject *args)
PyObject* Curve2dPy::parameterAtDistance(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double abscissa;
double u = 0;
if (!PyArg_ParseTuple(args, "d|d", &abscissa,&u))
return 0;
GeomAdaptor_Curve adapt(c);
Geom2dAdaptor_Curve adapt(c);
GCPnts_AbscissaPoint abscissaPoint(adapt,abscissa,u);
double parm = abscissaPoint.Parameter();
return PyFloat_FromDouble(parm);
@ -413,7 +423,7 @@ PyObject* Curve2dPy::parameterAtDistance(PyObject *args)
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
#endif
PyObject* Curve2dPy::value(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
@ -442,25 +452,28 @@ PyObject* Curve2dPy::value(PyObject *args)
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
#if 0
PyObject* Curve2dPy::tangent(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u;
if (!PyArg_ParseTuple(args, "d", &u))
return 0;
gp_Dir dir;
Py::Tuple tuple(1);
GeomLProp_CLProps prop(c,u,2,Precision::Confusion());
gp_Dir2d dir;
Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion());
if (prop.IsTangentDefined()) {
prop.Tangent(dir);
tuple.setItem(0, Py::Vector(Base::Vector3d(dir.X(),dir.Y(),dir.Z())));
}
return Py::new_reference_to(tuple);
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(dir.X()));
arg.setItem(1, Py::Float(dir.Y()));
return Py::new_reference_to(method.apply(arg));
}
}
catch (Standard_Failure) {
@ -476,16 +489,22 @@ PyObject* Curve2dPy::tangent(PyObject *args)
PyObject* Curve2dPy::normal(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u;
if (!PyArg_ParseTuple(args, "d", &u))
return 0;
gp_Dir dir;
GeomLProp_CLProps prop(c,u,2,Precision::Confusion());
gp_Dir2d dir;
Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion());
prop.Normal(dir);
return new Base::VectorPy(new Base::Vector3d(dir.X(),dir.Y(),dir.Z()));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(dir.X()));
arg.setItem(1, Py::Float(dir.Y()));
return Py::new_reference_to(method.apply(arg));
}
}
catch (Standard_Failure) {
@ -501,13 +520,13 @@ PyObject* Curve2dPy::normal(PyObject *args)
PyObject* Curve2dPy::curvature(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u;
if (!PyArg_ParseTuple(args, "d", &u))
return 0;
GeomLProp_CLProps prop(c,u,2,Precision::Confusion());
Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion());
double C = prop.Curvature();
return Py::new_reference_to(Py::Float(C));
}
@ -525,16 +544,22 @@ PyObject* Curve2dPy::curvature(PyObject *args)
PyObject* Curve2dPy::centerOfCurvature(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u;
if (!PyArg_ParseTuple(args, "d", &u))
return 0;
GeomLProp_CLProps prop(c,u,2,Precision::Confusion());
gp_Pnt V ;
prop.CentreOfCurvature(V);
return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z()));
Geom2dLProp_CLProps2d prop(c,u,2,Precision::Confusion());
gp_Pnt2d pnt ;
prop.CentreOfCurvature(pnt);
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(pnt.X()));
arg.setItem(1, Py::Float(pnt.Y()));
return Py::new_reference_to(method.apply(arg));
}
}
catch (Standard_Failure) {
@ -550,15 +575,15 @@ PyObject* Curve2dPy::centerOfCurvature(PyObject *args)
PyObject* Curve2dPy::parameter(PyObject *args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
PyObject *p;
if (!PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &p))
if (!PyArg_ParseTuple(args, "O!", Base::Vector2dPy::type_object(), &p))
return 0;
Base::Vector3d v = Py::Vector(p, false).toVector();
gp_Pnt pnt(v.x,v.y,v.z);
GeomAPI_ProjectPointOnCurve ppc(pnt, c);
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
gp_Pnt2d pnt(v.x,v.y);
Geom2dAPI_ProjectPointOnCurve ppc(pnt, c);
double val = ppc.LowerDistanceParameter();
return Py::new_reference_to(Py::Float(val));
}
@ -576,7 +601,7 @@ PyObject* Curve2dPy::parameter(PyObject *args)
PyObject* Curve2dPy::toBSpline(PyObject * args)
{
Handle_Geom2d_Geometry g = getGeometry2dPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
Handle_Geom2d_Curve c = Handle_Geom2d_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u,v;
@ -585,10 +610,10 @@ PyObject* Curve2dPy::toBSpline(PyObject * args)
if (!PyArg_ParseTuple(args, "|dd", &u,&v))
return 0;
ShapeConstruct_Curve scc;
Handle_Geom_BSplineCurve spline = scc.ConvertToBSpline(c, u, v, Precision::Confusion());
Handle_Geom2d_BSplineCurve spline = scc.ConvertToBSpline(c, u, v, Precision::Confusion());
if (spline.IsNull())
Standard_NullValue::Raise("Conversion to B-Spline failed");
return new BSplineCurvePy(new GeomBSplineCurve(spline));
return new BSplineCurve2dPy(new Geom2dBSplineCurve(spline));
}
}
catch (Standard_Failure) {
@ -629,10 +654,10 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args)
absShape = GeomAbs_C2;
try {
Handle_Geom_Curve self = Handle_Geom_Curve::DownCast(getGeometry2dPtr()->handle());
GeomConvert_ApproxCurve approx(self, tolerance, absShape, maxSegment, maxDegree);
Handle_Geom2d_Curve self = Handle_Geom2d_Curve::DownCast(getGeometry2dPtr()->handle());
Geom2dConvert_ApproxCurve approx(self, tolerance, absShape, maxSegment, maxDegree);
if (approx.IsDone()) {
return new BSplineCurvePy(new GeomBSplineCurve(approx.Curve()));
return new BSplineCurve2dPy(new Geom2dBSplineCurve(approx.Curve()));
}
else if (approx.HasResult()) {
std::stringstream str;
@ -651,7 +676,7 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args)
return 0;
}
}
#endif
Py::String Curve2dPy::getContinuity(void) const
{
GeomAbs_Shape c = Handle_Geom2d_Curve::DownCast
@ -719,7 +744,7 @@ int Curve2dPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}
#if 0
PyObject* Curve2dPy::intersectCC(PyObject *args)
{
Handle_Geom2d_Curve curve1 = Handle_Geom2d_Curve::DownCast(getGeometry2dPtr()->handle());
@ -727,7 +752,7 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
if (!curve1.IsNull()) {
PyObject *p;
double prec = Precision::Confusion();
if (!PyArg_ParseTuple(args, "O!|d", &(Part::GeometrySurfacePy::Type), &p, &prec))
if (!PyArg_ParseTuple(args, "O!|d", &(Part::Curve2dPy::Type), &p, &prec))
return 0;
Handle_Geom2d_Curve curve2 = Handle_Geom2d_Curve::DownCast(static_cast<Geometry2dPy*>(p)->getGeometry2dPtr()->handle());
Geom2dAPI_ExtremaCurveCurve intersector(curve1, curve2,
@ -746,7 +771,13 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
continue;
gp_Pnt2d p1, p2;
intersector.Points(i, p1, p2);
points.append(Py::asObject(new Base::Vector2dPy(p1.X(), p1.Y())));
Py::Module module("__FreeCADBase__");
Py::Callable method(module.getAttr("Vector2d"));
Py::Tuple arg(2);
arg.setItem(0, Py::Float(p1.X()));
arg.setItem(1, Py::Float(p1.Y()));
points.append(method.apply(arg));
}
return Py::new_reference_to(points);
@ -761,27 +792,3 @@ PyObject* Curve2dPy::intersectCC(PyObject *args)
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
return 0;
}
// General intersection function
PyObject* Curve2dPy::intersect(PyObject *args)
{
Handle_Geom_Curve curve = Handle_Geom_Curve::DownCast(getGeometry2dPtr()->handle());
try {
if (!curve.IsNull()) {
PyObject *p;
double prec = Precision::Confusion();
if (PyArg_ParseTuple(args, "O!|d", &(Part::GeometryCurvePy::Type), &p, &prec))
return intersectCC(args);
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
return 0;
}
#endif