implement generic uIso/vIso methods in GeometrySurfacePy
This commit is contained in:
@@ -42,24 +42,19 @@
|
||||
|
||||
#include "OCCError.h"
|
||||
#include "Geometry.h"
|
||||
#include "GeometrySurfacePy.h"
|
||||
#include "GeometrySurfacePy.cpp"
|
||||
#include "GeometryCurvePy.h"
|
||||
#include "BSplineSurfacePy.h"
|
||||
#include <Mod/Part/App/GeometrySurfacePy.h>
|
||||
#include <Mod/Part/App/GeometrySurfacePy.cpp>
|
||||
#include <Mod/Part/App/GeometryCurvePy.h>
|
||||
#include <Mod/Part/App/BSplineSurfacePy.h>
|
||||
|
||||
#include "TopoShape.h"
|
||||
#include "TopoShapePy.h"
|
||||
#include "TopoShapeFacePy.h"
|
||||
#include <Mod/Part/App/LinePy.h>
|
||||
#include <Mod/Part/App/BezierCurvePy.h>
|
||||
#include <Mod/Part/App/BSplineCurvePy.h>
|
||||
#include <Mod/Part/App/CirclePy.h>
|
||||
|
||||
// TODO: This should be somewhere globally, but where?
|
||||
// ------------------------------
|
||||
# include <Geom_Circle.hxx>
|
||||
# include <Geom_Ellipse.hxx>
|
||||
# include <Geom_Hyperbola.hxx>
|
||||
# include <Geom_Line.hxx>
|
||||
# include <Geom_OffsetCurve.hxx>
|
||||
# include <Geom_Parabola.hxx>
|
||||
# include <Geom_TrimmedCurve.hxx>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
#include <Mod/Part/App/TopoShapeFacePy.h>
|
||||
|
||||
const Py::Object makeGeometryCurvePy(const Handle_Geom_Curve& c)
|
||||
{
|
||||
@@ -255,6 +250,102 @@ PyObject* GeometrySurfacePy::bounds(PyObject * args)
|
||||
return Py::new_reference_to(bound);
|
||||
}
|
||||
|
||||
PyObject* GeometrySurfacePy::uIso(PyObject * args)
|
||||
{
|
||||
double v;
|
||||
if (!PyArg_ParseTuple(args, "d", &v))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Handle_Geom_Curve c = surf->UIso(v);
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle_Geom_TrimmedCurve aCurve = Handle_Geom_TrimmedCurve::DownCast(c);
|
||||
return new GeometryCurvePy(new GeomTrimmedCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
|
||||
Handle_Geom_BezierCurve aCurve = Handle_Geom_BezierCurve::DownCast(c);
|
||||
return new BezierCurvePy(new GeomBezierCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
Handle_Geom_BSplineCurve aCurve = Handle_Geom_BSplineCurve::DownCast(c);
|
||||
return new BSplineCurvePy(new GeomBSplineCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
Handle_Geom_Line aLine = Handle_Geom_Line::DownCast(c);
|
||||
GeomLineSegment* line = new GeomLineSegment();
|
||||
Handle_Geom_TrimmedCurve this_curv = Handle_Geom_TrimmedCurve::DownCast
|
||||
(line->handle());
|
||||
Handle_Geom_Line this_line = Handle_Geom_Line::DownCast
|
||||
(this_curv->BasisCurve());
|
||||
this_line->SetLin(aLine->Lin());
|
||||
return new LinePy(line);
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Handle_Geom_Circle aCurve = Handle_Geom_Circle::DownCast(c);
|
||||
return new CirclePy(new GeomCircle(aCurve));
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_NotImplementedError, "Iso curve is of type '%s'",
|
||||
c->DynamicType()->Name());
|
||||
return 0;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* GeometrySurfacePy::vIso(PyObject * args)
|
||||
{
|
||||
double v;
|
||||
if (!PyArg_ParseTuple(args, "d", &v))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
Handle_Geom_Surface surf = Handle_Geom_Surface::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Handle_Geom_Curve c = surf->VIso(v);
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||
Handle_Geom_TrimmedCurve aCurve = Handle_Geom_TrimmedCurve::DownCast(c);
|
||||
return new GeometryCurvePy(new GeomTrimmedCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
|
||||
Handle_Geom_BezierCurve aCurve = Handle_Geom_BezierCurve::DownCast(c);
|
||||
return new BezierCurvePy(new GeomBezierCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
|
||||
Handle_Geom_BSplineCurve aCurve = Handle_Geom_BSplineCurve::DownCast(c);
|
||||
return new BSplineCurvePy(new GeomBSplineCurve(aCurve));
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_Line))) {
|
||||
Handle_Geom_Line aLine = Handle_Geom_Line::DownCast(c);
|
||||
GeomLineSegment* line = new GeomLineSegment();
|
||||
Handle_Geom_TrimmedCurve this_curv = Handle_Geom_TrimmedCurve::DownCast
|
||||
(line->handle());
|
||||
Handle_Geom_Line this_line = Handle_Geom_Line::DownCast
|
||||
(this_curv->BasisCurve());
|
||||
this_line->SetLin(aLine->Lin());
|
||||
return new LinePy(line);
|
||||
}
|
||||
if (c->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Handle_Geom_Circle aCurve = Handle_Geom_Circle::DownCast(c);
|
||||
return new CirclePy(new GeomCircle(aCurve));
|
||||
}
|
||||
|
||||
PyErr_Format(PyExc_NotImplementedError, "Iso curve is of type '%s'",
|
||||
c->DynamicType()->Name());
|
||||
return 0;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* GeometrySurfacePy::isUPeriodic(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
|
||||
Reference in New Issue
Block a user