From e375bd7c3e8ad45d18a9f78f5a2350eccc9d3e44 Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 21 Apr 2023 10:40:49 +0100 Subject: [PATCH] Modeling Algorithms - UnifySameDomain improvement #371 Extend ShapeUpgrade_UnifySameDomain algorithm working on cases, where SurfaceOfRevolution or SurfaceOfLinearExtrusion was made on basis of TrimmedCurve. Original issue: 0033328 --- .../ShapeUpgrade_UnifySameDomain.cxx | 14 ++++++++++++++ tests/bugs/modalg_8/bug33328_1 | 16 ++++++++++++++++ tests/bugs/modalg_8/bug33328_2 | 16 ++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tests/bugs/modalg_8/bug33328_1 create mode 100644 tests/bugs/modalg_8/bug33328_2 diff --git a/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx b/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx index 679db8b99c..c208deb9d0 100644 --- a/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx @@ -1233,6 +1233,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface, gp_Cylin { Handle(Geom_SurfaceOfRevolution) aRS = Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface); Handle(Geom_Curve) aBasis = aRS->BasisCurve(); + + while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) + { + Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(aBasis); + aBasis = aTc->BasisCurve(); + } + if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) { Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis); @@ -1255,6 +1262,13 @@ static Standard_Boolean getCylinder(Handle(Geom_Surface)& theInSurface, gp_Cylin Handle(Geom_SurfaceOfLinearExtrusion) aLES = Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface); Handle(Geom_Curve) aBasis = aLES->BasisCurve(); + + while (aBasis->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) + { + Handle(Geom_TrimmedCurve) aTc = Handle(Geom_TrimmedCurve)::DownCast(aBasis); + aBasis = aTc->BasisCurve(); + } + if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) { Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis); diff --git a/tests/bugs/modalg_8/bug33328_1 b/tests/bugs/modalg_8/bug33328_1 new file mode 100644 index 0000000000..5069d29953 --- /dev/null +++ b/tests/bugs/modalg_8/bug33328_1 @@ -0,0 +1,16 @@ +puts "================================" +puts "0033328: Modeling Algorithms - UnifySameDomain improvement" +puts "================================" +puts "" + +restore [locate_data_file bug33328_Shell_1.brep] shell + +numshapes shell + +checknbshapes shell -vertex 6 -edge 7 -wire 2 -face 2 -shell 1 -solid 0 + +unifysamedom res shell + +#Warning: BRepTools_ReShape::Replace: shape already recorded + +checknbshapes res -vertex 4 -edge 4 -wire 1 -face 1 -shell 1 -solid 0 diff --git a/tests/bugs/modalg_8/bug33328_2 b/tests/bugs/modalg_8/bug33328_2 new file mode 100644 index 0000000000..794a082c36 --- /dev/null +++ b/tests/bugs/modalg_8/bug33328_2 @@ -0,0 +1,16 @@ +puts "================================" +puts "0033328: Modeling Algorithms - UnifySameDomain improvement" +puts "================================" +puts "" + +restore [locate_data_file bug33328_Shell_2.brep] shell + +numshapes shell + +checknbshapes shell -vertex 6 -edge 7 -wire 2 -face 2 -shell 1 -solid 0 + +unifysamedom res shell + +#Warning: BRepTools_ReShape::Replace: shape already recorded + +checknbshapes res -vertex 4 -edge 4 -wire 1 -face 1 -shell 1 -solid 0