fixed output logs

This commit is contained in:
cpu
2026-06-19 12:57:06 +02:00
parent b05f400a1d
commit 4f14612bcb
3 changed files with 28 additions and 13 deletions

View File

@@ -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 |

View File

@@ -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

View File

@@ -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
# 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"