diff --git a/hardware/contact_printer_prints.csv b/hardware/contact_printer_prints.csv new file mode 100644 index 0000000..541da4f --- /dev/null +++ b/hardware/contact_printer_prints.csv @@ -0,0 +1,4 @@ +module,quantity,stl +sprocketed roller invert solid,1,./stl/contact_printer_sprocketed_roller_invert_solid.stl +picture gate,1,./stl/contact_printer_picture_gate.stl +gate carrier,1,./stl/contact_printer_gate_carrier.stl diff --git a/scad/contact_printer.scad b/scad/contact_printer.scad index e4e4a19..a6ccf55 100644 --- a/scad/contact_printer.scad +++ b/scad/contact_printer.scad @@ -434,7 +434,6 @@ module gate_blank_void (pos = [0, 0, 0], rot = [0, 0, 0], bottom = [1, 1], top = } } - module gate_blank () { X = 15; Z = 20; @@ -480,9 +479,10 @@ module gate_blank () { translate([(X / 2) + SidesX, SidesY, 0]) rotate([0, 0, 45]) cube([5, 5, Z + 1], center = true); translate([(-X / 2) - SidesX, SidesY, 0]) rotate([0, 0, 45]) cube([5, 5, Z + 1], center = true); } - } + +//PRINT: 1 module gate_carrier (pos = [0, 0, 0], rot = [0, 0, 0]) { X = 15.4; SidesX = 2; @@ -583,6 +583,7 @@ module picture_gate_text (pos = [0, 1.5, 9.3], label = "gate" ){ } //standard, super, full, sound +//PRINT: 1 module picture_gate (pos = [0, 0, 0], rot = [0, 0, 0], Type = "full", Width = 2) { X = LampGateX; translate(pos) rotate(rot) { @@ -647,6 +648,7 @@ module lamp_dual (pos = [0, 0, 0]) { } }*/ +//PRINT: 1 module lamp_single (pos = [0, 0, 0]) { Height = 20 + 5; BaseZ = 2; @@ -742,6 +744,7 @@ module lamp_single_assembly (pos = [0, 0, 0]) { } } +//PRINT: 1 module lamp_cover (pos = [0, 0, 0]) { RollerVoidY = -17.5; RollerShelfD = 44.75; @@ -783,6 +786,7 @@ module panel_bearing_void (pos = [0, 0, 0]) { //BOM: 6, M3 sliding t slot nut,N/A,Attach aluminum extrusions to panel //BOM: 1, 100RPM DC geared motor with encoder,N/A,Drive the sprocketed_roller //BOM: 4, M4 hex bolt 40mm, N/A, Attach the lamp to the panel +//PRINT: 1 module panel (pos = [0, 0, 0]) { BoltX = (PanelX - 20) / 2; BoltY2 = (PanelY) / 2; diff --git a/scripts/prints.sh b/scripts/prints.sh new file mode 100644 index 0000000..4cf9849 --- /dev/null +++ b/scripts/prints.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +if [[ "${1}" == "" ]]; then + echo "Please use a .scad file as first argument" + exit 1 +fi + +FILENAME=$(basename "${1}" | tr '[:upper:]' '[:lower:]') +EXTENSION="${FILENAME##*.}" + +if [[ "${EXTENSION}" != "scad" ]]; then + echo "Please use a .scad file as first argument, not .${EXTENSION}" + exit 2 +fi + +if [[ ! -f "${1}" ]]; then + echo "File ${1} does not exist" + exit 3 +fi + +mkdir -p hardware + +NAME="${FILENAME%.*}" +DESTINATION="./hardware/${NAME}_prints.csv" + +echo "module,quantity,stl" > "${DESTINATION}" + +tac "${1}" | while read line; do + module=$(echo "${line}" | grep 'module ' | grep '(' | grep ')') + if [[ "${module}" != "" ]]; then + MODULE=$(echo "${module}" | xargs | awk '{print $2}' | awk -F'{' '{print $1}') + fi + qty=$(echo "${line}" | grep ^'//' | grep 'PRINT' | awk -F'PRINT:' '{print $2}'| xargs) + if [[ "${qty}" != "" ]]; then + QUANTITY="${qty}" + echo "[${MODULE//_/ }] ${QUANTITY}x" + echo "${MODULE//_/ },${QUANTITY},stl/${NAME}_${MODULE}.stl" >> "${DESTINATION}" + fi +done + +sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${DESTINATION} prints" -cmd '.mode markdown' \ + "SELECT module as 'Part', quantity as 'Print Count', printf( '[%s](%s)', 'STL' , prints.stl ) as 'Download' + FROM prints;" \ No newline at end of file diff --git a/scripts/scad.sh b/scripts/scad.sh index d8e1d85..cb431aa 100644 --- a/scripts/scad.sh +++ b/scripts/scad.sh @@ -17,5 +17,6 @@ while read m; do done < models.txt bash scripts/bom.sh "./scad/contact_printer.scad" +bash scripts/prints.sh "./scad/contact_printer.scad" #run client tests?