CONFIG=slic3r-config.ini
+AUTO_TOPLEVELS := $(foreach m, filamentspool, $(shell ./toplevel-find $m))
+
+scads: $(addsuffix .scad, $(AUTO_TOPLEVELS))
+stls: $(addsuffix .stl, $(AUTO_TOPLEVELS))
+
default:
%.stl: %.scad
./$^ >$@.new && mv -f $@.new $@
dovecliptest.stl: doveclip.scad
+
+%.scad: toplevel-make Makefile toplevel-find
+ @echo ' write $@'
+ ./$< $@ >$@.new
+ @mv -f $@.new $@
totalheight = channeldepth + armendbasethick;
stalkwidth = prongwidth + prongstalkxwidth;
-module ArmEnd(length=120){
+module ArmEnd(length=120){ ////toplevel
translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
rotate([0,0,-90])
DoveClipPairBase(h=doveclipheight);
}
}
-module FilamentCup() {
+module FilamentCup() { ////toplevel
FilamentCupHandle();
dx = cupbigrad + prongwidth;
}
}
-module CupSecuringClip(){
+module CupSecuringClip(){ ////toplevel
wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
difference(){
union(){
}
}
-module ArmDoveClipPin(){
+module ArmDoveClipPin(){ ////toplevel
DoveClipPin(h=doveclipheight);
}
-module Hub(){
+module Hub(){ ////toplevel
difference(){
cylinder($fn=60, h=hublthick, r=hubbigrad);
translate([0,0,-1])
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+@ARGV==1 or die;
+my $base = $ARGV[0];
+$base =~ m/^\-/ and die;
+open F, "$base.scad" or die $!;
+while (<F>) {
+ next unless m#^\s*module\s+(\w+)\b.*////toplevel\b#;
+ print "$base,$1\n" or die $!;
+}
+close F or die $!;
+close STDOUT or die $!;
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+die unless @ARGV==1;
+die unless $ARGV[0] =~ m/^(.+),(\w+)(?:\..*)?/;
+my ($base,$obj) = ($1,$2);
+print <<END or die $!;
+include <$base.scad>
+$obj();
+END
+close STDOUT or die $!;