discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

SCADMake

GB
Glenn Butcher
Sat, Sep 16, 2023 11:37 PM

I've been working on my steam locomotive project, and recently
re-organized the .scad files to put them in a Github repo:

https://github.com/butcherg/DRG_168

Recent work has been with tuning the various parts to fit together and
detailing.  In doing so, I will open a particular part and an
integration .scad  that imports all the .stl files and places them in
the respective positions to show how it all goes together.  Make a
change in the part .scad, re-run OpenSCAD to re-generate the .stl, and
refresh the integration preview render to see how the change fits.  This
can be a bit tedious as I make incremental changes and need to see their
effect.

I've messed with Makefiles to reduce the tedium, using the -d and -m
switches in OpenSCAD to generate dependencies.  Still not all that sure
how all that should work, ended up with a "hard-coded" Makefile that I
need to change every time a add (or delete) a .scad file.

Okay, getting to the point, I ended up writing a C++ program that acts
like unix make, except tailored to dealing with .scad scripts,
SCADMake.  It uses a short SCADMakefile that points to the script and
.stl directories of a project and a command line to run, run scadmake
and it parses the .scad files to find the use and include statements,
builds a dependency tree, then uses that tree to figure out which .stl
files to rebuild.  No need to figure out targets in the SCADMakefile. 
It'll also run continuously in a monitor mode; if a script changes,
it'll generate the dependent .stl files and go back to monitoring,
Ctrl-C to exit.  And, if you really like unix Makefiles, it has a switch
to generate from the dependency tree.  Right now it's just source code,
at Github:

https://github.com/butcherg/SCADMake

Just a hack, really, only does unix-style paths (use bash in MSYS2 for
Windows), .stl files are hardcoded.  I'll eventually get around to
changing those and other things that make it a one-off.

Anyway, for what it's worth...

I've been working on my steam locomotive project, and recently re-organized the .scad files to put them in a Github repo: https://github.com/butcherg/DRG_168 Recent work has been with tuning the various parts to fit together and detailing.  In doing so, I will open a particular part and an integration .scad  that imports all the .stl files and places them in the respective positions to show how it all goes together.  Make a change in the part .scad, re-run OpenSCAD to re-generate the .stl, and refresh the integration preview render to see how the change fits.  This can be a bit tedious as I make incremental changes and need to see their effect. I've messed with Makefiles to reduce the tedium, using the -d and -m switches in OpenSCAD to generate dependencies.  Still not all that sure how all that should work, ended up with a "hard-coded" Makefile that I need to change every time a add (or delete) a .scad file. Okay, getting to the point, I ended up writing a C++ program that acts like unix make, except tailored to dealing with .scad scripts, SCADMake.  It uses a short SCADMakefile that points to the script and .stl directories of a project and a command line to run, run scadmake and it parses the .scad files to find the use and include statements, builds a dependency tree, then uses that tree to figure out which .stl files to rebuild.  No need to figure out targets in the SCADMakefile.  It'll also run continuously in a monitor mode; if a script changes, it'll generate the dependent .stl files and go back to monitoring, Ctrl-C to exit.  And, if you really like unix Makefiles, it has a switch to generate from the dependency tree.  Right now it's just source code, at Github: https://github.com/butcherg/SCADMake Just a hack, really, only does unix-style paths (use bash in MSYS2 for Windows), .stl files are hardcoded.  I'll eventually get around to changing those and other things that make it a one-off. Anyway, for what it's worth...