From 56fb4a72fca43c7e19261ab2d5964e1925bafd46 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 31 Aug 2021 00:55:59 +0200 Subject: [PATCH] fix for OCCT 7.4 and older --- libsrc/occ/python_occ_shapes.cpp | 4 ++-- libsrc/occ/vsocc.cpp | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index f589400d..2e058e54 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -105,8 +105,8 @@ void ExtractEdgeData( const TopoDS_Edge & edge, int index, std::vector * int nbnodes = poly -> NbNodes(); for (int j = 1; j < nbnodes; j++) { - auto p0 = occ2ng((T -> Node(poly->Node(j))).Transformed(loc)); - auto p1 = occ2ng((T -> Node(poly->Node(j+1))).Transformed(loc)); + auto p0 = occ2ng((T -> Node(poly->Nodes()(j))).Transformed(loc)); + auto p1 = occ2ng((T -> Node(poly->Nodes()(j+1))).Transformed(loc)); for(auto k : Range(3)) { p[0].push_back(p0[k]); diff --git a/libsrc/occ/vsocc.cpp b/libsrc/occ/vsocc.cpp index da741dd9..d6c76f7d 100644 --- a/libsrc/occ/vsocc.cpp +++ b/libsrc/occ/vsocc.cpp @@ -463,8 +463,11 @@ namespace netgen glBegin (GL_LINE_STRIP); for (int j = 1; j <= nbnodes; j++) { - // gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc); - gp_Pnt p = (T -> Node(aEdgePoly->Nodes()(j))).Transformed(aEdgeLoc); +#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=5 + gp_Pnt p = T -> Node(aEdgePoly->Node(j)).Transformed(aEdgeLoc); +#else + gp_Pnt p = T -> Nodes())(aEdgePoly->Nodes()(j).Transformed(aEdgeLoc); +#endif glVertex3f (p.X(), p.Y(), p.Z()); } glEnd (); @@ -511,8 +514,11 @@ namespace netgen glBegin (GL_LINE_STRIP); for (int j = 1; j <= nbnodes; j++) { - // gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc); - gp_Pnt p = (T -> Node(aEdgePoly->Node(j))).Transformed(aEdgeLoc); +#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=5 + gp_Pnt p = T -> Node(aEdgePoly->Node(j)).Transformed(aEdgeLoc); +#else + gp_Pnt p = (T -> Nodes())(aEdgePoly->Nodes()(j)).Transformed(aEdgeLoc); +#endif glVertex3f (p.X(), p.Y(), p.Z()); } glEnd (); @@ -587,15 +593,23 @@ namespace netgen int ntriangles = triangulation -> NbTriangles(); for (int j = 1; j <= ntriangles; j++) { - Poly_Triangle triangle = (triangulation -> Triangle(j)); +#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=5 + Poly_Triangle triangle = triangulation -> Triangle(j); +#else + Poly_Triangle triangle = triangulation -> Triangles()(j); +#endif + gp_Pnt p[3]; for (int k = 1; k <= 3; k++) p[k-1] = (triangulation -> Node(triangle(k))).Transformed(loc); for (int k = 1; k <= 3; k++) { - // uv = (triangulation -> UVNodes())(triangle(k)); +#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=5 uv = triangulation -> UVNode(triangle(k)); +#else + uv = triangulation -> UVNodes())(triangle(k); +#endif prop.SetParameters (uv.X(), uv.Y()); // surf->D0 (uv.X(), uv.Y(), pnt);