step-examples/12-2b-nurbs/Gn177.stp
Sources
- OCCT `ShapeCustom_BSplineRestriction::IsConvertSurface` (`src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx:182-192`, specifically `:189-190` `if(myRational && (theSurf->IsURational() || theSurf->IsVRational())) return Standard_True
- ` — the rational-flag trigger for a `Geom_BSplineSurface` target, independent of and orthogonal to the degree/segment-count checks at `:185-188`) @ `bd2a789f15235755ce4d1a3b07379a2e062fdc2e` (verified against source at this commit). The actual re-approximation is performed by `GeomConvert_ApproxSurface` (`ShapeCustom_BSplineRestriction.cxx:668` `GeomConvert_ApproxSurface anApprox(aSurf,aTol3d,aContU,aContV,MaxDeg,MaxDeg,MaxSeg,0)
- `) inside `ShapeCustom_BSplineRestriction::ConvertSurface`, invoked via the public entry point `ShapeCustom::BSplineRestriction` (`ShapeCustom.cxx:165-176`).
Description
A single `ADVANCED_FACE` on a `B_SPLINE_SURFACE_WITH_KNOTS` (degree 2×1, 3×2 control net) encodes an EXACT quarter-circle profile (radius 2.0, classic 3-pole rational-quadratic weights `(1.0, sqrt(2)/2, 1.0)`) extruded straight along Z (the second, degree-1 direction, uniform weight, genuinely polynomial). The complex `RATIONAL_B_SPLINE_SURFACE` instance is genuinely rational — live-verified (`Geom_BSplineSurface::IsVRational()==True`, non-uniform weight array; OCCT's own internal `urational`/`vrational` naming is a documented historical swap — see `Geom_BSplineSurface.cxx:22` `// jct : 19-01-99 ; permutation de urational et vrational dans Rational.` — so the "rational" flag lands on the profile direction empirically) — not a uniform-weight polynomial surface written in rational form. A target consumer whose importer only accepts non-rational (polynomial) B-spline surfaces cannot represent this profile exactly; it must re-approximate. This is orthogonal to Gn011 (excess DEGREE) and Gn026 (continuity restriction): here degree (2) and segment count (1×1) are both trivially within any reasonable cap, and continuity is not at issue — only the rational/weighted representation itself is the trigger.
Reproducer recipe
`(B_SPLINE_SURFACE(2,1,((p1,p2),(p3,p4),(p5,p6)),.UNSPECIFIED.,.F.,.F.,.F.) B_SPLINE_SURFACE_WITH_KNOTS((3,3),(2,2),(0.0,1.0),(0.0,1.0),.UNSPECIFIED.) BOUNDED_SURFACE() GEOMETRIC_REPRESENTATION_ITEM() RATIONAL_B_SPLINE_SURFACE(((1.0,1.0),(0.7071067811865476,0.7071067811865476),(1.0,1.0))) REPRESENTATION_ITEM('name') SURFACE())` as `ADVANCED_FACE.face_geometry`, boundary a 4-edge loop (two exact `TRIMMED_CURVE`-over-`CIRCLE` isoparametric edges at the two Z-extremes, two straight `LINE` isoparametric edges at the two profile extremes).
Expected kernel behavior
A receiver enforcing a polynomial-only B-spline surface constraint must detect `IsURational()||IsVRational()` and re-approximate via `GeomConvert_ApproxSurface` (or equivalent) within a stated tolerance, producing a surface with both rationality flags false, rather than silently passing the rational surface through or rejecting the file outright.
Notes
Live-verified directly against the fixture's own bytes (the reader loads the face, then the rational-to-polynomial restriction healer is invoked directly on it with tol3d=1e-4, tol2d=1e-4, maxDegree=6, maxNbSegment=100, C0/C0 continuity, Degree=False, Rational=True — matching Gs194-198's established convention of driving the healer directly since it is not part of the default read): raw read is 1 face, a B-spline surface, U-non-rational/V-rational (genuinely rational — OCCT's internal flag naming, see Description), U-degree 2, 3 U-poles, face area `15.707963267802857` (exactly `(π/2)·R·H = (π/2)·2·5 = 5π`, confirming the exact quarter-circle-times-extrusion geometry); after `BSplineRestriction`, the result is 1 face, `IsURational=False`/`IsVRational=False` (fully polynomial), degree elevated to 6 with 13 U-poles, area `15.707961664740747` (deviation ≈1.6e-6, within the stated 1e-4 tolerance) — confirming genuine rational-to-polynomial re-approximation, not a no-op. Fills `seq-bspline-restriction`'s previously-missing subvariant #4 ("rational geometry where polynomial is required"); Gn011 (degree cap) and Gn009/Gn026 (segment/continuity caps) cover the class's other three subvariants. Synonyms: "rational NURBS surface needs polynomial re-approximation", "GeomConvert_ApproxSurface rational-to-polynomial conversion", "exact quarter-circle rational profile extrusion", "ShapeCustom_BSplineRestriction Rational flag branch", "weighted B-spline surface target requires non-rational form".
Expected validation
occt=shape(1)/shape(1) gmsh=shape(9) ifc=schema_n/a
Byte assertions
contains(b'RATIONAL_B_SPLINE_SURFACE')contains(b'B_SPLINE_SURFACE_WITH_KNOTS')contains(b'0.7071067811865476')count_entity_def(b'ADVANCED_FACE') == 1
Tier-3 assertions
load == "ok"shape_null == Falsen_faces_total == 1
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Gn177: genuinely RATIONAL B_SPLINE_SURFACE_WITH_KNOTS (degree 2x1, 3x2 net) encoding an 3 EXACT quarter-circle profile (radius 2.0, weights (1.0, sqrt(2)/2, 1.0)) extruded straight 4 along Z; a target consumer accepting only polynomial (non-rational) B-splines cannot use this 5 surface as-is and must re-approximate it into non-rational form; distinct from Gn011's 6 excess-DEGREE defect and Gn026's continuity-restriction defect (this is the RATIONAL subvariant 7 of seq-bspline-restriction, exercising ShapeCustom_BSplineRestriction's Rational-flag branch) */ 8HEADER; 9FILE_DESCRIPTION(('Gn177'),'2;1'); 10FILE_NAME('Gn177.stp','2026-07-13T00:00:00',(''),(''),'cad-research-suite','',''); 11FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 12ENDSEC; 13DATA; 14#9000=APPLICATION_CONTEXT('mechanical design'); 15#1=CARTESIAN_POINT('',(2.0,0.0,0.0)); 16#2=CARTESIAN_POINT('',(2.0,0.0,5.0)); 17#3=CARTESIAN_POINT('',(2.0,2.0,0.0)); 18#4=CARTESIAN_POINT('',(2.0,2.0,5.0)); 19#5=CARTESIAN_POINT('',(0.0,2.0,0.0)); 20#6=CARTESIAN_POINT('',(0.0,2.0,5.0)); 21#7=(B_SPLINE_SURFACE(2,1,((#1,#2),(#3,#4),(#5,#6)),.UNSPECIFIED.,.F.,.F.,.F.)B_SPLINE_SURFACE_WITH_KNOTS((3,3),(2,2),(0.0,1.0),(0.0,1.0),.UNSPECIFIED.)BOUNDED_SURFACE()GEOMETRIC_REPRESENTATION_ITEM()RATIONAL_B_SPLINE_SURFACE(((1.0,1.0),(0.7071067811865476,0.7071067811865476),(1.0,1.0)))REPRESENTATION_ITEM('rational_quarter_circle_extrusion')SURFACE()); 22#8=(GEOMETRIC_REPRESENTATION_CONTEXT(2)PARAMETRIC_REPRESENTATION_CONTEXT()REPRESENTATION_CONTEXT('UV','2D')); 23#9=CARTESIAN_POINT('',(0.0,0.0,0.0)); 24#10=DIRECTION('',(0.0,0.0,1.0)); 25#11=DIRECTION('',(1.0,0.0,0.0)); 26#12=AXIS2_PLACEMENT_3D('',#9,#10,#11); 27#13=CIRCLE('gn177_bottom_circle',#12,2.0); 28#14=CARTESIAN_POINT('',(2.0,0.0,0.0)); 29#15=VERTEX_POINT('',#14); 30#16=CARTESIAN_POINT('',(0.0,2.0,0.0)); 31#17=VERTEX_POINT('',#16); 32#18=TRIMMED_CURVE('gn177_bottom_arc',#13,(PARAMETER_VALUE(0.0)),(PARAMETER_VALUE(1.5707963267949)),.T.,.PARAMETER.); 33#19=CARTESIAN_POINT('',(0.0,0.0)); 34#20=CARTESIAN_POINT('',(1.0,0.0)); 35#21=DIRECTION('',(1.0,0.0)); 36#22=VECTOR('',#21,1.0); 37#23=LINE('',#19,#22); 38#24=DEFINITIONAL_REPRESENTATION('pcdef',(#23),#8); 39#25=PCURVE('pc',#7,#24); 40#26=SURFACE_CURVE('sc',#18,(#25),.PCURVE_S1.); 41#27=EDGE_CURVE('gn177_edge_bottom_arc',#15,#17,#26,.T.); 42#28=CARTESIAN_POINT('',(0.0,2.0,0.0)); 43#29=DIRECTION('',(0.0,0.0,1.0)); 44#30=VECTOR('',#29,5.0); 45#31=LINE('',#28,#30); 46#32=CARTESIAN_POINT('',(1.0,0.0)); 47#33=CARTESIAN_POINT('',(1.0,1.0)); 48#34=DIRECTION('',(0.0,1.0)); 49#35=VECTOR('',#34,1.0); 50#36=LINE('',#32,#35); 51#37=DEFINITIONAL_REPRESENTATION('pcdef',(#36),#8); 52#38=PCURVE('pc',#7,#37); 53#39=SURFACE_CURVE('sc',#31,(#38),.PCURVE_S1.); 54#40=CARTESIAN_POINT('',(0.0,2.0,5.0)); 55#41=VERTEX_POINT('',#40); 56#42=EDGE_CURVE('gn177_edge_side_u1',#17,#41,#39,.T.); 57#43=CARTESIAN_POINT('',(0.0,0.0,5.0)); 58#44=DIRECTION('',(0.0,0.0,1.0)); 59#45=DIRECTION('',(1.0,0.0,0.0)); 60#46=AXIS2_PLACEMENT_3D('',#43,#44,#45); 61#47=CIRCLE('gn177_top_circle',#46,2.0); 62#48=TRIMMED_CURVE('gn177_top_arc',#47,(PARAMETER_VALUE(0.0)),(PARAMETER_VALUE(1.5707963267949)),.T.,.PARAMETER.); 63#49=CARTESIAN_POINT('',(2.0,0.0,5.0)); 64#50=VERTEX_POINT('',#49); 65#51=CARTESIAN_POINT('',(1.0,1.0)); 66#52=CARTESIAN_POINT('',(0.0,1.0)); 67#53=DIRECTION('',(-1.0,0.0)); 68#54=VECTOR('',#53,1.0); 69#55=LINE('',#51,#54); 70#56=DEFINITIONAL_REPRESENTATION('pcdef',(#55),#8); 71#57=PCURVE('pc',#7,#56); 72#58=SURFACE_CURVE('sc',#48,(#57),.PCURVE_S1.); 73#59=EDGE_CURVE('gn177_edge_top_arc',#41,#50,#58,.F.); 74#60=CARTESIAN_POINT('',(2.0,0.0,5.0)); 75#61=DIRECTION('',(0.0,0.0,-1.0)); 76#62=VECTOR('',#61,5.0); 77#63=LINE('',#60,#62); 78#64=CARTESIAN_POINT('',(0.0,1.0)); 79#65=CARTESIAN_POINT('',(0.0,0.0)); 80#66=DIRECTION('',(0.0,-1.0)); 81#67=VECTOR('',#66,1.0); 82#68=LINE('',#64,#67); 83#69=DEFINITIONAL_REPRESENTATION('pcdef',(#68),#8); 84#70=PCURVE('pc',#7,#69); 85#71=SURFACE_CURVE('sc',#63,(#70),.PCURVE_S1.); 86#72=EDGE_CURVE('gn177_edge_side_u0',#50,#15,#71,.T.); 87#73=ORIENTED_EDGE('',$,$,#27,.T.); 88#74=ORIENTED_EDGE('',$,$,#42,.T.); 89#75=ORIENTED_EDGE('',$,$,#59,.T.); 90#76=ORIENTED_EDGE('',$,$,#72,.T.); 91#77=EDGE_LOOP('',(#73,#74,#75,#76)); 92#78=FACE_OUTER_BOUND('',#77,.T.); 93#79=ADVANCED_FACE('',(#78),#7,.T.); 94#80=OPEN_SHELL('',(#79)); 95#81=SHELL_BASED_SURFACE_MODEL('',(#80)); 96#9050=PRODUCT_CONTEXT('',#9000,'mechanical'); 97#9051=PRODUCT('Gn177','Gn177','',(#9050)); 98#9052=PRODUCT_DEFINITION_FORMATION('','',#9051); 99#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design'); 100#9054=PRODUCT_DEFINITION('','','',#9052,#9053); 101#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054); 102#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.)); 103#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.)); 104#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT()); 105#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value',''); 106#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D')); 107#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#81),#9060); 108#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061); 109ENDSEC; 110END-ISO-10303-21;