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
@@ -332,6 +332,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) {
 	  Handle( BRepAdaptor_Curve ) HCurve = new BRepAdaptor_Curve();
@@ -339,7 +348,7 @@
 	  const Handle(Adaptor3d_Curve)& aHCurve = HCurve; // to avoid ambiguity
 	  Constr = new BRepFill_CurveConstraint(aHCurve,
-						CurOrder,
+						orderAdapt,
 						myNbPtsOnCur,
 						myTol3d );
 	}
 	else { // Pas de representation Topologique
@@ -362,7 +371,7 @@
 	  Handle (Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface( CurvOnSurf );
 	  
 	  Constr = new GeomPlate_CurveConstraint(HCurvOnSurf,
-						 CurOrder,
+						 orderAdapt,
 						 myNbPtsOnCur,
 						 myTol3d,
 						 myTolAng,
@@ -382,7 +391,7 @@
 	  Handle (Adaptor3d_CurveOnSurface) HCurvOnSurf = new Adaptor3d_CurveOnSurface( CurvOnSurf );
 
 	  Constr = new BRepFill_CurveConstraint( HCurvOnSurf,
-						 CurOrder,
+						 orderAdapt,
 						 myNbPtsOnCur,
 						 myTol3d,
 						 myTolAng,
