Last active
May 20, 2019 23:35
-
-
Save hroncok/5635791 to your computer and use it in GitHub Desktop.
Get a list of svg files and convert them to prepared scad designs. You'l than have to modify only the size.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Public domain | |
if [ $# -lt 1 ]; then | |
echo "Give me some file(s), dude!" 1>&2 | |
exit 1 | |
fi | |
for svg in $@; do | |
shortname="$(basename "$svg")" | |
extension="${svg##*.}" | |
filename="${svg%.*}" | |
if [ "x${extension,,}" != "xsvg" ]; then | |
echo "$svg has no .svg extension, I won't use it." 1>&2 | |
continue | |
fi | |
inkscape -E "${filename}".{eps,svg} || exit 1 | |
pstoedit -dt -f dxf:-polyaslines "${filename}".{eps,dxf} || exit 1 | |
if [ -f "${filename}.scad" ]; then | |
echo "Not going to overwrite ${filename}.scad, sorry." 1>&2 | |
continue | |
fi | |
echo "scale(1) linear_extrude(height=1) import(\"${shortname%.*}.dxf\");" > "${filename}.scad" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment