diff --git a/Readme.md b/Readme.md index 3370ca4..d1b1378 100644 --- a/Readme.md +++ b/Readme.md @@ -93,7 +93,7 @@ All cutting parameters are at the top of `paste_stencil.tcl`: | `CUT_Z` | `-0.2` | Cutting depth in mm (negative). Set slightly past material thickness | | `TRAVEL_Z` | `2.0` | Safe travel height in mm | | `FEEDRATE` | `120` | XY feed rate in mm/min | -| `SPINDLE` | `15000` | Spindle speed in RPM | +| `SPINDLE` | `24000` | Spindle speed in RPM | | `OVERLAP` | `60` | Tool overlap in % — higher = cleaner clearing, more paths | | `MARGIN` | `0.0` | Inset from aperture edge in mm. 0 = cut to exact pad size | diff --git a/paste_stencil.tcl b/paste_stencil.tcl index e4ce551..6969b67 100644 --- a/paste_stencil.tcl +++ b/paste_stencil.tcl @@ -11,11 +11,11 @@ set GERBER "gerbers/myboard-B_Paste.gbp" ;# path to your B.Paste Gerber set OUTPUT "gcode/stencil.nc" ;# output G-code file # Tool -set TOOL_DIA 0.5 ;# mm — 0.5mm corn bit +set TOOL_DIA 0.39 ;# mm — 0.5mm corn bit # Stencil material depth # Brass shim 0.15mm → use -0.18, polyimide 0.1mm → use -0.13 -set CUT_Z -0.2 ;# mm — cutting depth (negative) +set CUT_Z -0.3 ;# mm — cutting depth (negative) set TRAVEL_Z 2.0 ;# mm — safe travel height # Feeds & speeds diff --git a/run_stencil.sh b/run_stencil.sh index f895fd3..d99892e 100755 --- a/run_stencil.sh +++ b/run_stencil.sh @@ -31,32 +31,47 @@ sed \ "$TCL_SCRIPT" > "$TMP_TCL" echo "→ Running FlatCAM headless..." -echo " Gerber : $GERBER_ABS" -echo " Output : $OUTPUT_ABS" +echo " Gerber : $GERBER" +echo " Output : $OUTPUT" echo "" source "$FLATCAM_ENV/bin/activate" -# Run FlatCAM, watch for the WriteGCode confirmation line, then kill it -# FlatCAM hangs on quit due to Qt GUI cleanup — we kill it cleanly once done +# Run FlatCAM, watch for the Quit confirmation line, then kill it +# FlatCAM hangs on quit due to Qt GUI cleanup — we kill it cleanly once done. +# Disable pipefail here: we intentionally kill the process, so its nonzero +# exit status should not abort the rest of this script. +set +e +set +o pipefail python "$FLATCAM_PY" --shellfile="$TMP_TCL" --headless=1 2>&1 | \ while IFS= read -r line; do - echo "$line" + # Show WARNING, ERROR, and script puts output; suppress DEBUG and INFO noise + if [[ "$line" == *"[WARNING]"* || "$line" == *"[ERROR]"* || "$line" != *"["* ]]; then + [[ "$line" == *"RUNNING HEADLESS"* ]] && continue + [[ "$line" == *"QWidget::setMaximumSize"* ]] && continue + [[ "$line" == *"Image Import plugin"* ]] && continue + [[ "$line" == *"Joining"*"polygons"* ]] && continue + [[ "$line" == *"Union(buffer)"* ]] && continue + [[ "$line" == *"Total number of polygons"* ]] && continue + [[ "$line" == *"Number of paths for which"* ]] && continue + echo "$line" + fi if [[ "$line" == *"TclCommandQuit"* ]]; then - # Give it a moment to finish flushing the file sleep 3 - # Kill the FlatCAM process - pkill -f "flatcam.py.*headless" 2>/dev/null || true + pkill -f "flatcam.py.*headless" 2>/dev/null & + disown fi done +set -e +set -o pipefail rm -f "$TMP_TCL" # Verify output was created if [ -f "$OUTPUT_ABS" ]; then - SIZE=$(wc -l < "$OUTPUT_ABS") + SIZE=$(wc -l < "$OUTPUT") echo "" - echo "✓ Done: $OUTPUT_ABS ($SIZE lines)" + echo "✓ Done: $OUTPUT ($SIZE lines)" else echo "" echo "✗ ERROR: output file not created — check log above"