diff --git a/src/Mod/Part/App/GeometrySurfacePy.xml b/src/Mod/Part/App/GeometrySurfacePy.xml index ddc964d793..4a08292095 100644 --- a/src/Mod/Part/App/GeometrySurfacePy.xml +++ b/src/Mod/Part/App/GeometrySurfacePy.xml @@ -46,6 +46,16 @@ + + + Builds the U isoparametric curve + + + + + Builds the V isoparametric curve + + Returns true if this patch is periodic in the given parametric direction. diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index 792d6f1584..ed2144bf50 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -42,24 +42,19 @@ #include "OCCError.h" #include "Geometry.h" -#include "GeometrySurfacePy.h" -#include "GeometrySurfacePy.cpp" -#include "GeometryCurvePy.h" -#include "BSplineSurfacePy.h" +#include +#include +#include +#include -#include "TopoShape.h" -#include "TopoShapePy.h" -#include "TopoShapeFacePy.h" +#include +#include +#include +#include -// TODO: This should be somewhere globally, but where? -// ------------------------------ -# include -# include -# include -# include -# include -# include -# include +#include +#include +#include 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, "")) diff --git a/src/Mod/Part/App/OffsetSurfacePy.xml b/src/Mod/Part/App/OffsetSurfacePy.xml index 9b35c1e48d..fd88de3f95 100644 --- a/src/Mod/Part/App/OffsetSurfacePy.xml +++ b/src/Mod/Part/App/OffsetSurfacePy.xml @@ -14,16 +14,6 @@ - - - Builds the U isoparametric line of this surface - - - - - Builds the V isoparametric line of this surface - - diff --git a/src/Mod/Part/App/OffsetSurfacePyImp.cpp b/src/Mod/Part/App/OffsetSurfacePyImp.cpp index d7dc4f4940..f897a25b14 100644 --- a/src/Mod/Part/App/OffsetSurfacePyImp.cpp +++ b/src/Mod/Part/App/OffsetSurfacePyImp.cpp @@ -78,18 +78,6 @@ int OffsetSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) } } -PyObject* OffsetSurfacePy::uIso(PyObject *) -{ - PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); - return 0; -} - -PyObject* OffsetSurfacePy::vIso(PyObject *) -{ - PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); - return 0; -} - Py::Float OffsetSurfacePy::getOffsetValue(void) const { Handle_Geom_OffsetSurface surf = Handle_Geom_OffsetSurface::DownCast(getGeometryPtr()->handle()); diff --git a/src/Mod/Part/App/PlateSurfacePy.xml b/src/Mod/Part/App/PlateSurfacePy.xml index dc6c2d4ca7..8a500ca137 100644 --- a/src/Mod/Part/App/PlateSurfacePy.xml +++ b/src/Mod/Part/App/PlateSurfacePy.xml @@ -14,16 +14,6 @@ - - - Builds the U isoparametric line of this surface - - - - - Builds the V isoparametric line of this surface - - Approximate the plate surface to a B-Spline surface diff --git a/src/Mod/Part/App/PlateSurfacePyImp.cpp b/src/Mod/Part/App/PlateSurfacePyImp.cpp index 68ccda567a..860bdce45b 100644 --- a/src/Mod/Part/App/PlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/PlateSurfacePyImp.cpp @@ -185,18 +185,6 @@ PyObject* PlateSurfacePy::makeApprox(PyObject *args, PyObject* kwds) } PY_CATCH_OCC; } -PyObject* PlateSurfacePy::uIso(PyObject * /*args*/) -{ - PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); - return 0; -} - -PyObject* PlateSurfacePy::vIso(PyObject * /*args*/) -{ - PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented"); - return 0; -} - PyObject *PlateSurfacePy::getCustomAttributes(const char* /*attr*/) const { return 0;