| 1 | #!/bin/bash |
| 2 | #this script generates models for all samples |
| 3 | |
| 4 | if [ -e configuration.scad.dist ]; then |
| 5 | if [ -e configuration.scad ]; then |
| 6 | mv --backup=numbered configuration.scad configuration.scad.autobackup |
| 7 | fi |
| 8 | |
| 9 | |
| 10 | for i in `ls sample_stls` |
| 11 | do |
| 12 | DIR=sample_stls/$i |
| 13 | echo $DIR |
| 14 | if [ -e $DIR/configuration.scad ]; then |
| 15 | rm configuration.scad |
| 16 | cp $DIR/configuration.scad configuration.scad |
| 17 | make clean |
| 18 | # build standard models |
| 19 | make |
| 20 | |
| 21 | # I do not want all extras in samples, |
| 22 | # so lets build only some of them |
| 23 | EXTRAS="tube_clamp.stl calibrate.stl" |
| 24 | |
| 25 | # for box model there is additional part in extras (replaces bushing.stl) |
| 26 | # (brackets that hold Y bearings to Y carriage) |
| 27 | # and we dont want y-axis-bracket from standard models |
| 28 | if grep "i_am_box = 0;" configuration.scad ; then |
| 29 | rm output/y-axis-bracket.stl |
| 30 | rm output/bushing.stl |
| 31 | EXTRAS="$EXTRAS bearing-holder-single-plate-y.stl" |
| 32 | fi |
| 33 | # build wade extruder for medium carriage |
| 34 | if grep "carriage_l_base = 50" configuration.scad ; then |
| 35 | EXTRAS="$EXTRAS gregs-wade-v3.stl wade-gears.stl" |
| 36 | fi |
| 37 | # build the extras |
| 38 | for model in $EXTRAS |
| 39 | do |
| 40 | make output/extras/$model |
| 41 | done |
| 42 | |
| 43 | cp -f output/*stl $DIR |
| 44 | cp -f output/extras/*stl $DIR/extras |
| 45 | fi |
| 46 | |
| 47 | done |
| 48 | |
| 49 | if [ -e configuration.scad.autobackup ]; then |
| 50 | mv configuration.scad.autobackup configuration.scad |
| 51 | fi |
| 52 | |
| 53 | else |
| 54 | echo "configuration.scad.dist not found, aborting" |
| 55 | fi |