Implement GeometryCurvePy::length
This commit is contained in:
parent
a7e3f0539d
commit
f43f70f395
|
@ -26,6 +26,12 @@
|
||||||
<UserDocu>Discretizes the curve using a given deflection or number of points and returns a list of points</UserDocu>
|
<UserDocu>Discretizes the curve using a given deflection or number of points and returns a list of points</UserDocu>
|
||||||
</Documentation>
|
</Documentation>
|
||||||
</Methode>
|
</Methode>
|
||||||
|
<Methode Name="length">
|
||||||
|
<Documentation>
|
||||||
|
<UserDocu>Computes the length of a curve
|
||||||
|
length([uMin,uMax,Tol]) -> Float</UserDocu>
|
||||||
|
</Documentation>
|
||||||
|
</Methode>
|
||||||
<Methode Name="value">
|
<Methode Name="value">
|
||||||
<Documentation>
|
<Documentation>
|
||||||
<UserDocu>Computes the point of parameter u on this curve</UserDocu>
|
<UserDocu>Computes the point of parameter u on this curve</UserDocu>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
# include <gp_Vec.hxx>
|
# include <gp_Vec.hxx>
|
||||||
# include <gp_Pln.hxx>
|
# include <gp_Pln.hxx>
|
||||||
# include <GCPnts_UniformAbscissa.hxx>
|
# include <GCPnts_UniformAbscissa.hxx>
|
||||||
|
# include <GCPnts_AbscissaPoint.hxx>
|
||||||
# include <Geom2dAPI_InterCurveCurve.hxx>
|
# include <Geom2dAPI_InterCurveCurve.hxx>
|
||||||
# include <GeomAPI.hxx>
|
# include <GeomAPI.hxx>
|
||||||
# include <Geom_Geometry.hxx>
|
# include <Geom_Geometry.hxx>
|
||||||
|
@ -156,6 +157,31 @@ PyObject* GeometryCurvePy::discretize(PyObject *args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* GeometryCurvePy::length(PyObject *args)
|
||||||
|
{
|
||||||
|
Handle_Geom_Geometry g = getGeometryPtr()->handle();
|
||||||
|
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
|
||||||
|
try {
|
||||||
|
if (!c.IsNull()) {
|
||||||
|
double u=c->FirstParameter();
|
||||||
|
double v=c->LastParameter();
|
||||||
|
double t=Precision::Confusion();
|
||||||
|
if (!PyArg_ParseTuple(args, "|ddd", &u,&v,&t))
|
||||||
|
return 0;
|
||||||
|
double len = GCPnts_AbscissaPoint::Length(GeomAdaptor_Curve(c),u,v,t);
|
||||||
|
return PyFloat_FromDouble(len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject* GeometryCurvePy::value(PyObject *args)
|
PyObject* GeometryCurvePy::value(PyObject *args)
|
||||||
{
|
{
|
||||||
Handle_Geom_Geometry g = getGeometryPtr()->handle();
|
Handle_Geom_Geometry g = getGeometryPtr()->handle();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user