Skip to content

Instantly share code, notes, and snippets.

@srvanderplas
Created August 29, 2025 13:14
Show Gist options
  • Select an option

  • Save srvanderplas/05c66fb4635984ecd23f14f6bf6327a8 to your computer and use it in GitHub Desktop.

Select an option

Save srvanderplas/05c66fb4635984ecd23f14f6bf6327a8 to your computer and use it in GitHub Desktop.
Script to compile a multi-color OpenSCAD file to a 3mf file using colorscad.sh
#!/bin/bash
# Requires https://github.com/jschobben/colorscad to be somewhere on the path
for m in {1..15}
do
file="multiplication/$(printf '%02dx.scad' ${m})"
cp spinner-multiplication.scad $file
#awk -v a="m=${m};" 'NR==3 { sub(".*insert-m-here", a) }' $file
sed -E -i "3s/.*/m=${m};/" $file
colorscad.sh -i "$file" -o "${file%.scad}.3mf" -f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment