BCad extends the standard OpenSCAD polygon() with per-corner fillets/chamfers
and spline sub-lists. The original syntax is fully preserved — every valid
OpenSCAD polygon() call works identically in BCad.
Original syntax (OpenSCAD-compatible)
polygon([ [x,y], ... ], paths=[ ... ], convexity=1);
Each point is [x, y]. Optional paths controls vertex traversal order.
Extended point formats
Corner modifiers: [x, y, r]
A third element in a point triple adds a fillet or chamfer at that corner.
Value of r |
Effect |
|---|---|
r > 0 |
Fillet with radius r (circular arc) |
r < 0 |
Chamfer with distance -r (straight cut) |
r = 0 |
No modifier (same as [x, y]) |
// Square with a 2-unit fillet at bottom-left corner
polygon([[0, 0, 2], [10, 0], [10, 10], [0, 10]]);
// Square with a 2-unit chamfer at bottom-left corner
polygon([[0, 0, -2], [10, 0], [10, 10], [0, 10]]);
// All four corners filleted
polygon([[0, 0, 2], [10, 0, 2], [10, 10, 2], [0, 10, 2]]);
// All four corners chamfered
polygon([[0, 0, -2], [10, 0, -2], [10, 10, -2], [0, 10, -2]]);
// Mixed fillets and chamfers
polygon([[0, 0, 2], [0, 10, -2], [10, 10, 2], [10, 0]]);
Fillet/chamfer modifiers work with explicit paths as well — the modifier
follows the point it is attached to, regardless of traversal order.
Spline sub-lists: [[x1,y1], [x2,y2], ...]
A sub-list of 2D points replaces the straight edge with a B-spline that passes through the listed intermediate points. The spline starts at the previous vertex and ends at the next vertex in the path (the sub-list itself defines only the interior control points).
// Straight edges except one curved edge (spline through [5,5])
polygon([[0, 0], [[5, 5], [10, 0]], [10, 10], [0, 10]]);
Spline with corner modifier: [[x1,y1], ..., r]
A trailing number after the spline points applies a fillet or chamfer at the
corner where the spline ends — the same convention as [x, y, r].
// Spline edge with a fillet of radius 2 at the end corner
polygon([[0, 0], [[5, 8], [10, 0], 2], [10, 10], [0, 10]]);
// Spline edge with a chamfer of distance 3 at the end corner
polygon([[0, 0], [[5, 8], [10, 0], -3], [10, 10], [0, 10]]);
Combining modifiers
All formats can be mixed freely in a single polygon:
polygon([
[0, 0, 2], // fillet r=2
[10, 0, -2], // chamfer d=2
[10, 10, 2], // fillet r=2
[10, 0] // no modifier
]);
OpenSCAD compatibility
| Feature | OpenSCAD | BCad |
|---|---|---|
polygon([[x,y], ...]) |
supported | supported (identical) |
paths parameter |
supported | supported (identical) |
convexity parameter |
supported | accepted, ignored |
[x, y, r] corner modifiers |
not supported | BCad extension |
| Spline sub-lists | not supported | BCad extension |
Spline [[...], r] modifier |
not supported | BCad extension |
All OpenSCAD-compatible polygon() calls produce identical geometry in BCad.
The extensions are purely additive — no existing syntax is reinterpreted.
Technical notes
- Fillets use
ChFi2d_FilletAlgo(2D fillet algorithm from OCCT). - Chamfers use
GCPnts_AbscissaPointfor parametric edge trimming — works with any edge type (lines, arcs, B-splines). - Spline edges are B-splines built via
GeomAPI_PointsToBSpline. - When a corner has both a fillet/chamfer modifier and is adjacent to a spline edge, the trim is applied parametrically on the actual curve (not a straight approximation).
- Spline sub-lists cannot be the first or last element in a
pathstraversal — they must be preceded by a vertex with known position.