From 56c59353bbd7f8535efc707822ac074d7b64e052 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Wed, 11 Aug 2021 21:54:45 +0200 Subject: [PATCH] surface normal --- libsrc/occ/python_occ_shapes.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 5377876e..abd08a04 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 #define OCC_HAVE_DUMP_JSON @@ -617,6 +618,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) surf->D1 (u,v,p,du,dv); return tuple(p,du,dv); }) + + .def("Normal", [] (const Handle(Geom_Surface) & surf, double u, double v) { + GeomLProp_SLProps lprop(surf,u,v,1,1e-8); + if (lprop.IsNormalDefined()) + return lprop.Normal(); + throw Exception("normal not defined"); + }) ;