CardBoxGen is a parametric SVG generator for laser-cut card storage and dispensing designs. It produces axis-aligned (Manhattan) outlines with finger joints, suitable for 3mm sheet goods (MDF, plywood, greyboard, acrylic — with different recommended clearances).
The generator is usable in two ways:
- CLI:
cardboxgen_v0_1.py - Web app: static site in
docs/that runs the same generator in-browser via Pyodide
-
tray_open_front- Open top
- Lowered/open front wall (front height < back height)
- Optional scoop cutout (rounded-U)
-
dispenser_slot_front- Front panel is present
- Adds a rectangular dispense slot (width/height/position parameters)
-
window_front- Front panel is present
- Adds a large window cutout and a thumb notch
-
box_with_lid- Adds a slip lid (top + four walls)
- Lid uses
lid_clearanceto allow sliding fit
These are used as SVG <g id="..."> group ids:
- Base box:
BOTTOM,BACK,LEFT,RIGHT, optionalFRONT - Lid:
LID_TOP,LID_BACK,LID_FRONT,LID_LEFT,LID_RIGHT
Finger joints are generated from a shared plan (FingerPlan) per mating edge pair.
This prevents mismatches caused by independently rounding finger counts.
Stable finger count rule:
n = max(min_fingers, floor(length / target_finger_w))- force
nodd
Two joint families are supported:
- OUTER: bottom-to-wall edges
- VERTICAL: wall-to-wall corner edges
Optional fixed counts:
finger_count_outerfinger_count_vertical
Inputs:
kerf_mm: estimated laser kerfclearance_mm: target clearance between slot and tab after assembly
Within each finger-joint edge, segment widths are adjusted:
- tabs are drawn wider:
+ (kerf - clearance/2) - slots are drawn narrower:
+ (clearance/2 - kerf)
Widths are normalized so the total edge length remains exact.
- CUT paths: red stroke, width 0.2
- TEXT/labels: black
- Output is plain SVG XML with newlines (good for Inkscape / LightBurn)
Optional:
--offset-kerfuses pyclipper (if installed) to offset outer contours by+kerf/2and inner holes by-kerf/2.
--holding-tabs leaves a small gap in polygon cuts per edge to create a breakaway bridge.
This is implemented as an open path (no Z) so the laser doesn’t cut that short segment.
Limitations:
- applied to polygon paths (panel outlines and polygon cutouts)
- arc cutouts (thumb notch/scoop) remain fully cut
The web app is designed for GitHub Pages:
docs/index.html+docs/app.js+docs/style.cssdocs/cardboxgen_v0_1.pyis synced from the root generator withtools/sync_docs.py.github/workflows/pages.ymldeploysdocs/automatically