Subject: [PATCH 4/7] BRepFill_Filling: Curve constraints confused by implicit cast from GeomAbs_Shape to Standard_Integer
From: blobfish <blobfish@gmx.com>

Date: Tue, 29 Sep 2020 07:47:55 -0400


---
 src/BRepFill/BRepFill_Filling.cxx | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

--- a/src/BRepFill/BRepFill_Filling.cxx
+++ b/src/BRepFill/BRepFill_Filling.cxx
@@ -323,6 +323,15 @@
     CurFace  = SeqOfConstraints(i).myFace;
     CurOrder = SeqOfConstraints(i).myOrder;
 
+    // this silently defaults to C0 with an invalid value,
+    // where before an exception would be
+    // thrown out of curve constraints. Good, Bad?
+    Standard_Integer orderAdapt = 0;
+    if (CurOrder == GeomAbs_G1)
+      orderAdapt = 1;
+    else if (CurOrder == GeomAbs_G2)
+      orderAdapt = 2;
+
     if (CurFace.IsNull())
     {
       if (CurOrder == GeomAbs_C0)
@@ -330,7 +339,7 @@
         Handle(BRepAdaptor_Curve) HCurve = new BRepAdaptor_Curve();
         HCurve->Initialize(CurEdge);
         const Handle(Adaptor3d_Curve)& aHCurve = HCurve; // to avoid ambiguity
-        Constr = new BRepFill_CurveConstraint(aHCurve, CurOrder, myNbPtsOnCur, myTol3d);
+        Constr = new BRepFill_CurveConstraint(aHCurve, orderAdapt, myNbPtsOnCur, myTol3d);
       }
       else
       { // Pas de representation Topologique
@@ -354,7 +363,7 @@
         Handle(Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface(CurvOnSurf);
 
         Constr = new GeomPlate_CurveConstraint(HCurvOnSurf,
-                                               CurOrder,
+                                               orderAdapt,
                                                myNbPtsOnCur,
                                                myTol3d,
                                                myTolAng,
@@ -374,7 +383,7 @@
       Handle(Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface(CurvOnSurf);
 
       Constr = new BRepFill_CurveConstraint(HCurvOnSurf,
-                                            CurOrder,
+                                            orderAdapt,
                                             myNbPtsOnCur,
                                             myTol3d,
                                             myTolAng,
