chiark / gitweb /
knifeblock: wip, half-done template reorg
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 30 Dec 2014 20:58:18 +0000 (20:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 30 Dec 2014 20:58:18 +0000 (20:58 +0000)
.gitignore
Makefile
knifeblock-knives-filter

index daf2a2d..c5d1498 100644 (file)
@@ -8,4 +8,4 @@ light-bracket.stl
 *.tmp
 *.fig.bak
 funcs.scad
-knifeblock-knives-l?.dxf*
+knifeblock-knives-*.dxf*
index ce63b8d..c5118f8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -56,13 +56,13 @@ stls:               $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
 
 dovecliptest.stl: doveclip.scad $(AUTO_INCS)
 
-KNIFEBLOCK_LAYERS=1 2 3 4 5 6
-KNIFEBLOCK_LAYER_FILES=$(foreach l,$(KNIFEBLOCK_LAYERS), \
-       knifeblock-knives-l$l.dxf)
+KNIFEBLOCK_TEMPLATES=$(foreach k, 0 1 2, h$k a$k)
+KNIFEBLOCK_TEMPLATE_FILES=$(foreach t,$(KNIFEBLOCK_TEMPLATES), \
+       knifeblock-knives-t$t.dxf)
 
-knifeblock-knives-layers: $(KNIFEBLOCK_LAYER_FILES)
+knifeblock-knives-templates: $(KNIFEBLOCK_TEMPLATE_FILES)
 
-knifeblock-knives-l%.dxf: knifeblock-knives-filter knifeblock-knives-trace.fig
+knifeblock-knives-t%.dxf: knifeblock-knives-filter knifeblock-knives-trace.fig
                ./$< $* <$(filter %.fig, $^) >$@.tmp.fig
                fig2dev -L eps <$@.tmp.fig >$@.tmp.eps
                pstoedit -dt -f "dxf: -polyaslines -mm" $@.tmp.eps $@
index 0a353b2..6dfce66 100755 (executable)
@@ -2,11 +2,14 @@
 
 use strict;
 
-our $want;
+our %want;
 
 BEGIN {
-      $want = shift @ARGV;
-      die unless $want =~ m/^\d+$/;
+      my $want = shift @ARGV;
+      my ($part,$knife) = $want =~ m/^([ha])(\d)$/ or die;
+
+      $want{ $knife+1 } = $part =~ m/[h]/;
+      $want{ $knife+4 } = $part =~ m/[ha]/;
 }
 
 our $drop;
@@ -14,7 +17,7 @@ our $drop;
 if (m/^\S/) {
     $drop = 
        m/^2 / ||
-       m/^3 \d+ \d+ \d+ (?!$want )\d+ /;
+       (m/^3 \d+ \d+ \d+ (\d+) / && !$want{$1});
 }
 
 next if $drop;