From a2bbe78c1252e5c0357f84b1b136157f1e9d6fc5 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Wed, 6 Nov 2024 14:21:41 -0500 Subject: [PATCH] Work on BOM. Add more to script. Experiment with table in markdown --- README.md | 10 +++++++--- hardware/contact_printer_BOM.csv | 17 +++++++++++++++++ hardware/contact_printer_BOM_total.csv | 11 +++++++++++ hardware/prices.csv | 11 +++++++++++ scad/contact_printer.scad | 10 +++++++++- scripts/bom.sh | 10 ++++++++-- 6 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 hardware/contact_printer_BOM.csv create mode 100644 hardware/contact_printer_BOM_total.csv create mode 100644 hardware/prices.csv diff --git a/README.md b/README.md index 18dda96..1c56b94 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,17 @@ Magnetic clutch design inspired by Clyde Shaffer's [Shaffer Linear Processor](ht | Part | Qty | Cost (USD) | |-------------------------------------|-----|------------| -| M3 sliding t slot nut | 6 | 0.36 | -| M3 hex cap bolt 8mm | 6 | 0.54 | +| M3 sliding t slot nut | 25 | 1.5 | +| M3 hex cap bolt 8mm | 25 | 2.25 | | M3 hex cap bolt 6mm | 4 | 0.28 | -| ESP32 Dev board | 2 | 13.32 | +| L298N Motor driver module | 1 | 2.89 | +| ESP32 Dev board | 1 | 6.66 | +| 250RPM DC geared motor | 2 | 29.98 | | 2020 Aluminum extrusion 420mm | 2 | 5.22 | | 2020 Aluminum extrusion 260mm | 4 | 6.44 | | 100RPM DC geared motor with encoder | 1 | 17.02 | +|---------|---------------|------------| +| TOTAL | 65 | 7224 | diff --git a/hardware/contact_printer_BOM.csv b/hardware/contact_printer_BOM.csv new file mode 100644 index 0000000..13dce42 --- /dev/null +++ b/hardware/contact_printer_BOM.csv @@ -0,0 +1,17 @@ +module,quantity,part,part_id,description +contact_printer,4,2020 Aluminum extrusion 260mm,N/A,Sides and central frame +contact_printer,2,2020 Aluminum extrusion 420mm,N/A,Top and bottom frame +electronics_panel,6,M3 sliding t slot nut,N/A,Attach the frame to the electronics_panel +electronics_panel,6,M3 hex cap bolt 8mm,N/A,Attach the electronics_panel to the frame +electronics_panel,1,L298N Motor driver module,N/A,Control the 3 motors using 2 channels +electronics_panel,1,ESP32 Dev board,N/A,Control the contact_printer +takeup_panel_stock,6,M3 sliding t slot nut,N/A,Attach the frame to the takeup_panel_stock +takeup_panel_stock,6,M3 hex cap bolt 8mm,N/A,Attach the takeup_panel_stock to the frame +takeup_panel_stock,1,250RPM DC geared motor,JSX40-370,Drive the takeup of the stock pathway +takeup_panel_picture,7,M3 sliding t slot nut,N/A,Attach the frame to the takeup_panel_picture +takeup_panel_picture,7,M3 hex cap bolt 8mm,N/A,Attach the takeup_panel_picture to the frame +takeup_panel_picture,1,250RPM DC geared motor,JSX40-370,Drive the takeup of the picture pathway +panel,1,100RPM DC geared motor with encoder,N/A,Drive the sprocketed_roller +panel,6,M3 sliding t slot nut,N/A,Attach aluminum extrusions to panel +panel,6,M3 hex cap bolt 8mm,N/A,Attach panel to aluminum extrusions +panel,4,M3 hex cap bolt 6mm,N/A,Attach encoder motor to panel diff --git a/hardware/contact_printer_BOM_total.csv b/hardware/contact_printer_BOM_total.csv new file mode 100644 index 0000000..f658159 --- /dev/null +++ b/hardware/contact_printer_BOM_total.csv @@ -0,0 +1,11 @@ +quantity,part,part_id,price +25,"M3 sliding t slot nut",N/A,150 +25,"M3 hex cap bolt 8mm",N/A,225 +4,"M3 hex cap bolt 6mm",N/A,28 +1,"L298N Motor driver module",N/A,289 +1,"ESP32 Dev board",N/A,666 +2,"250RPM DC geared motor",JSX40-370,2998 +2,"2020 Aluminum extrusion 420mm",N/A,522 +4,"2020 Aluminum extrusion 260mm",N/A,644 +1,"100RPM DC geared motor with encoder",N/A,1702 +65,N/A,TOTAL,7224 diff --git a/hardware/prices.csv b/hardware/prices.csv new file mode 100644 index 0000000..67861ed --- /dev/null +++ b/hardware/prices.csv @@ -0,0 +1,11 @@ +part,part_id,price,url +M3 hex nut,N/A,3,https://amzn.to/4hAnwjc +M3 hex cap bolt 6mm,N/A,7,https://amzn.to/3AwiZxo +M3 hex cap bolt 8mm,N/A,9,https://amzn.to/3YEvWNB +M3 sliding t slot nut,N/A,6,https://amzn.to/48GRrSU +2020 Aluminum extrusion 260mm,N/A,161,https://amzn.to/4ehSolE +2020 Aluminum extrusion 420mm,N/A,261,https://amzn.to/4ehSolE +100RPM DC geared motor with encoder,N/A,1702,https://amzn.to/3UF707G +250RPM DC geared motor,JSX40-370,1499,https://amzn.to/3NWkcRL +ESP32 Dev board,N/A,666,https://amzn.to/3NXCvGj +L298N Motor driver module,N/A,289,https://amzn.to/4ellssy diff --git a/scad/contact_printer.scad b/scad/contact_printer.scad index bc1bdc6..9947250 100644 --- a/scad/contact_printer.scad +++ b/scad/contact_printer.scad @@ -838,6 +838,9 @@ module takeup_panel_motor_mount_pads (pos = [0, 0, 0], rot = [0, 0, 0]) { } } +//BOM: 1, 250RPM DC geared motor, JSX40-370, Drive the takeup of the picture pathway +//BOM: 7, M3 hex cap bolt 8mm,N/A,Attach the takeup_panel_picture to the frame +//BOM: 7, M3 sliding t slot nut,N/A,Attach the frame to the takeup_panel_picture module takeup_panel_picture (pos = [0, 0, 0]) { BoltX = (TakeupPanelX / 2) - 10; BoltY = (TakeupPanelY / 2) - 10; @@ -908,6 +911,9 @@ module takeup_panel_picture_motor_mount (pos = [0, 0, 0] ) { } } +//BOM: 1, 250RPM DC geared motor, JSX40-370, Drive the takeup of the stock pathway +//BOM: 6, M3 hex cap bolt 8mm,N/A,Attach the takeup_panel_stock to the frame +//BOM: 6, M3 sliding t slot nut,N/A,Attach the frame to the takeup_panel_stock module takeup_panel_stock (pos = [0, 0, 0]) { BoltX = (TakeupPanelX / 2) - 10; BoltY = (TakeupPanelY / 2) - 10; @@ -1378,7 +1384,9 @@ module button_void (pos = [0, 0, 0], rot = [0, 0, 0]) { } //BOM: 1, ESP32 Dev board,N/A,Control the contact_printer -//BOM: 1, ESP32 Dev board,N/A,Control the contact_printer +//BOM: 1, L298N Motor driver module,N/A,Control the 3 motors using 2 channels +//BOM: 6, M3 hex cap bolt 8mm,N/A,Attach the electronics_panel to the frame +//BOM: 6, M3 sliding t slot nut,N/A,Attach the frame to the electronics_panel module electronics_panel (pos = [0, 0, 0], rot = [0, 0, 0]) { X = PanelX - 40; Y = 100; diff --git a/scripts/bom.sh b/scripts/bom.sh index 21c07c8..31474be 100644 --- a/scripts/bom.sh +++ b/scripts/bom.sh @@ -35,7 +35,7 @@ MODULE="" echo "module,quantity,part,part_id,description" > "${DESTINATION}" tac "${1}" | while read line; do - module=$(echo "${line}" | grep 'module') + module=$(echo "${line}" | grep 'module ' | grep '(' | grep ')') if [[ "${module}" != "" ]]; then MODULE=$(echo "${module}" | xargs | awk '{print $2}' | awk -F'{' '{print $1}') fi @@ -55,4 +55,10 @@ sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${DESTINATION} bom" -cmd ".impor 'SELECT SUM(quantity),part,part_id, SUM(quantity) * (COALESCE((SELECT prices.price FROM prices WHERE prices.part = bom.part LIMIT 1), 0)) as price FROM bom GROUP BY part ORDER BY part DESC;' >> "${TOTAL}" sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdown' \ - 'SELECT part as Part, quantity as Qty, CAST(price / 100.00 as MONEY) as "Cost (USD)" FROM bom ORDER BY part DESC;' \ No newline at end of file + "SELECT part as Part, quantity as Qty, CAST(price / 100.00 as MONEY) as 'Cost (USD)' FROM bom ORDER BY part DESC;" + +sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdown' \ + "SELECT 'TOTAL', SUM(quantity), SUM(price) FROM bom;" | grep -v 'SUM(' + +sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom"\ + "SELECT SUM(quantity),'N/A','TOTAL', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}" \ No newline at end of file