OpenSCAD dependency management

Working with OpenSCAD for a few weeks, I quickly wished there was an easy dependency manager. None of the options appealed to me, so I made my own. It could actually be used with most any language, really, and is basically just a script that invokes Git to clone dependencies into a folder in your home directory, then creates a link to said folder. Behold


# OpenSCAD dependency management through Git.
# Probably works for other things, too.
# Edit dependencies, run, then in your scads do e.g.:
# use <>
# MIT License; do what you want. -Erhannis
while getopts hl:r: option
case "${option}"
h) echo $'./ [-h] [-l] [-r REMOTE=~/.scad_deps]';;

# Setup
if [ ! -e "$LOCAL" ]; then
mkdir -p "$REMOTE"
ln -s "$REMOTE" "$LOCAL"

#TODO Should recursively fetch dependencies
#TODO Should MAYBE update dependencies

# Dependencies
cd "$REMOTE"
git clone

Just add any other dependencies at the bottom, and in your scad files, do e.g.

use <>

It’s worked quite well for me, so far, (aside from usually having to convert Thingiverse libraries into Github repos), though I expect a larger, longer term, or more complicated project would need features the script doesn’t currently offer. Better than a poke in the eye, at least, and I’m pleased with its simplicity.

Oh, do note that it’s a Linux script. You could make an equivalent Windows batch file. I haven’t.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.