Start counting part print counts

This commit is contained in:
Matt McWilliams 2025-04-06 17:15:56 -04:00
parent 128cd4a1c4
commit 18e16e0e78
4 changed files with 54 additions and 2 deletions

View File

@ -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
1 module quantity stl
2 sprocketed roller invert solid 1 ./stl/contact_printer_sprocketed_roller_invert_solid.stl
3 picture gate 1 ./stl/contact_printer_picture_gate.stl
4 gate carrier 1 ./stl/contact_printer_gate_carrier.stl

View File

@ -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;

43
scripts/prints.sh Normal file
View File

@ -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;"

View File

@ -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?