From 18c678759eafb95646a369f2837ea15a09961b3e Mon Sep 17 00:00:00 2001 From: kgv Date: Mon, 6 Dec 2021 22:23:24 +0300 Subject: [PATCH] 0032717: Modeling Algorithms - BRepBuilderAPI_Copy should not remove triangulation from surface-less faces BRepBuilderAPI_Copy now ignores toCopyMesh flag for non-geometric shapes. --- src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx | 15 ++++++++++++--- tests/bugs/modalg_7/bug32717 | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/modalg_7/bug32717 diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx b/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx index 3bd8ce0eb0..36c25a41e5 100644 --- a/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx @@ -59,8 +59,11 @@ public: //! copies it if required Standard_Boolean NewTriangulation(const TopoDS_Face& F, Handle(Poly_Triangulation)& T) Standard_OVERRIDE { - if (!myCopyMesh) + if (!myCopyMesh + && BRep_Tool::IsGeometric (F)) + { return Standard_False; + } TopLoc_Location L; T = BRep_Tool::Triangulation(F, L); @@ -93,8 +96,11 @@ public: //! copies it if required Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE { - if (!myCopyMesh) + if (!myCopyMesh + && BRep_Tool::IsGeometric (E)) + { return Standard_False; + } TopLoc_Location aLoc; P = BRep_Tool::Polygon3D(E, aLoc); @@ -113,8 +119,11 @@ public: Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F, Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE { - if (!myCopyMesh) + if (!myCopyMesh + && BRep_Tool::IsGeometric (E)) + { return Standard_False; + } TopLoc_Location aLoc; Handle(Poly_Triangulation) aTria = BRep_Tool::Triangulation(F, aLoc); diff --git a/tests/bugs/modalg_7/bug32717 b/tests/bugs/modalg_7/bug32717 new file mode 100644 index 0000000000..6c91e34bd7 --- /dev/null +++ b/tests/bugs/modalg_7/bug32717 @@ -0,0 +1,17 @@ +puts "=================================================" +puts "0032717: Modeling Algorithms - BRepBuilderAPI_Copy should not remove triangulation from surface-less faces" +puts "=================================================" +puts "" + +pload XDE MODELING +box b 1 2 3 +incmesh b 1 +checktrinfo b -tri 12 -nod 24 +tclean -geom b +trinfo b +checktrinfo b -tri 12 -nod 24 + +# check that copied triangulation-only shape is copied with triangulation +tcopy b bb +trinfo bb +checktrinfo bb -tri 12 -nod 24