]> OCCT Git - occt.git/commitdiff
Modeling Algorithms - UnifySameDomain improvement #371
authorjfa <jfa@opencascade.com>
Fri, 21 Apr 2023 09:40:49 +0000 (10:40 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Mon, 17 Feb 2025 14:12:49 +0000 (14:12 +0000)
Extend ShapeUpgrade_UnifySameDomain algorithm working on cases,
  where SurfaceOfRevolution or SurfaceOfLinearExtrusion was made on basis of TrimmedCurve.
Original issue: 0033328

src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
tests/bugs/modalg_8/bug33328_1 [new file with mode: 0644]
tests/bugs/modalg_8/bug33328_2 [new file with mode: 0644]

index 679db8b99c5282ff9c391ff0cc69caeb1ae370a0..c208deb9d08abd2c161f72829c43efc9b2d7649f 100644 (file)
@@ -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 (file)
index 0000000..5069d29
--- /dev/null
@@ -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 (file)
index 0000000..794a082
--- /dev/null
@@ -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