chiark / gitweb /
Merge branch 'master' of chiark:/u/ianmdlvl/reprap/play
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Sep 2012 13:16:07 +0000 (14:16 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Sep 2012 13:16:07 +0000 (14:16 +0100)
.gitignore
Makefile
filamentspool-armdoveclippin.scad [deleted file]
filamentspool-armend.scad [deleted file]
filamentspool-cup.scad [deleted file]
filamentspool-cupclip.scad [deleted file]
filamentspool.scad
toplevel-find [new file with mode: 0755]
toplevel-make [new file with mode: 0755]

index 5f3a3f4..77d64ee 100644 (file)
@@ -3,3 +3,4 @@
 light-bracket.stl
 *.aside
 *.stl
+*,*.scad
index d31e0a9..af3f76d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,11 @@ SKEINFORGE=python $(HRR)/reprappro-software.git/skeinforge/skeinforge_applicatio
 
 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
@@ -20,3 +25,8 @@ default:
                ./$^ >$@.new && mv -f $@.new $@
 
 dovecliptest.stl: doveclip.scad
+
+%.scad: toplevel-make Makefile toplevel-find
+               @echo ' write $@'
+               ./$< $@ >$@.new
+               @mv -f $@.new $@
diff --git a/filamentspool-armdoveclippin.scad b/filamentspool-armdoveclippin.scad
deleted file mode 100644 (file)
index 036b958..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include <filamentspool.scad>
-ArmDoveClipPin();
diff --git a/filamentspool-armend.scad b/filamentspool-armend.scad
deleted file mode 100644 (file)
index fa64261..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include <filamentspool.scad>
-ArmEnd();
diff --git a/filamentspool-cup.scad b/filamentspool-cup.scad
deleted file mode 100644 (file)
index 2459828..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include <filamentspool.scad>
-FilamentCup();
diff --git a/filamentspool-cupclip.scad b/filamentspool-cupclip.scad
deleted file mode 100644 (file)
index f377b31..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include <filamentspool.scad>
-CupSecuringClip();
index 4c930fd..04e5c09 100644 (file)
@@ -62,7 +62,7 @@ totalwidth = armendwallthick*2 + channelwidth;
 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);
@@ -122,7 +122,7 @@ module FilamentCupCup(){
   }
 }
 
-module FilamentCup() {
+module FilamentCup() { ////toplevel
   FilamentCupHandle();
 
   dx = cupbigrad + prongwidth;
@@ -168,7 +168,7 @@ module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
   }
 }
 
-module CupSecuringClip(){
+module CupSecuringClip(){ ////toplevel
   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
   difference(){
     union(){
@@ -181,11 +181,11 @@ module CupSecuringClip(){
   }
 }
 
-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])
diff --git a/toplevel-find b/toplevel-find
new file mode 100755 (executable)
index 0000000..227bb73
--- /dev/null
@@ -0,0 +1,12 @@
+#!/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 $!;
diff --git a/toplevel-make b/toplevel-make
new file mode 100755 (executable)
index 0000000..2df668b
--- /dev/null
@@ -0,0 +1,10 @@
+#!/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 $!;