From e1c8a7bc3c226dfce41c57c175685d694eae8b9c Mon Sep 17 00:00:00 2001 From: mattmcw Date: Thu, 28 Nov 2024 11:37:58 -0500 Subject: [PATCH] Update BOM script to account for quantity better --- hardware/contact_printer_BOM.csv | 1 + hardware/contact_printer_BOM_total.csv | 17 ++++++++-------- hardware/prices.csv | 27 +++++++++++++------------- scad/contact_printer.scad | 15 ++++++++------ scripts/bom.sh | 4 ++-- 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/hardware/contact_printer_BOM.csv b/hardware/contact_printer_BOM.csv index 691183f..a77ef90 100644 --- a/hardware/contact_printer_BOM.csv +++ b/hardware/contact_printer_BOM.csv @@ -7,6 +7,7 @@ electronics_panel,6,M3 sliding t slot nut,N/A,Attach the frame to the electronic 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 +sprocketed_roller_invert_solid,1,608-RS Ball Bearing,608-RS,Reduces wobble in the rollers spin sprocketed_roller_invert_solid,1,M3 hex cap bolt 12mm,N/A,Attaches the sprocketed_roller to the geared motor 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 diff --git a/hardware/contact_printer_BOM_total.csv b/hardware/contact_printer_BOM_total.csv index ef7521e..dd1e387 100644 --- a/hardware/contact_printer_BOM_total.csv +++ b/hardware/contact_printer_BOM_total.csv @@ -1,14 +1,15 @@ quantity,part,part_id,price -4,"M4 hex bolt 40mm",N/A,500 -25,"M3 sliding t slot nut",N/A,150 -25,"M3 hex cap bolt 8mm",N/A,225 +4,"M4 hex bolt 40mm",N/A,240 +25,"M3 sliding t slot nut",N/A,125 +25,"M3 hex cap bolt 8mm",N/A,200 8,"M3 hex cap bolt 6mm",N/A,56 1,"M3 hex cap bolt 12mm",N/A,0 -1,"L298N Motor driver module",N/A,289 +1,"L298N Motor driver module",N/A,287 1,"ESP32 GPIO breakout board",N/A,599 1,"ESP32 Dev board",N/A,666 +1,"608-RS Ball Bearing",608-RS,17 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 -75,N/A,TOTAL,8351 +2,"2020 Aluminum extrusion 420mm",N/A,510 +4,"2020 Aluminum extrusion 260mm",N/A,640 +1,"100RPM DC geared motor with encoder",N/A,1619 +76,TOTAL,N/A,7957 diff --git a/hardware/prices.csv b/hardware/prices.csv index d23cd05..6575899 100644 --- a/hardware/prices.csv +++ b/hardware/prices.csv @@ -1,13 +1,14 @@ -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 -ESP32 GPIO breakout board,N/A,599,https://amzn.to/3UFjpbO -M4 hex bolt 40mm,N/A,125,https://www.homedepot.com/p/M4-0-7-x-40-mm-Class-8-8-Zinc-Plated-Hex-Bolt-801298/204273654 \ No newline at end of file +part,part_id,price,quantity,url +M3 hex nut,N/A,999,300,https://amzn.to/4hAnwjc +M3 hex cap bolt 6mm,N/A,726,100,https://amzn.to/3AwiZxo +M3 hex cap bolt 8mm,N/A,899,100,https://amzn.to/3YEvWNB +M3 sliding t slot nut,N/A,599,105,https://amzn.to/48GRrSU +2020 Aluminum extrusion 260mm,N/A,7399,46,https://amzn.to/418OicC +2020 Aluminum extrusion 420mm,N/A,7399,29,https://amzn.to/418OicC +100RPM DC geared motor with encoder,N/A,1619,1,https://amzn.to/3UF707G +250RPM DC geared motor,JSX40-370,1499,1,https://amzn.to/3NWkcRL +ESP32 Dev board,N/A,1999,3,https://amzn.to/3NXCvGj +L298N Motor driver module,N/A,1149,4,https://amzn.to/4ellssy +ESP32 GPIO breakout board,N/A,1199,2,https://amzn.to/3UFjpbO +M4 hex bolt 40mm,N/A,609,10,https://amzn.to/4ikpYL8 +608-RS Ball Bearing,608-RS,1779,100,https://amzn.to/4fKxDA7 \ No newline at end of file diff --git a/scad/contact_printer.scad b/scad/contact_printer.scad index d5d596e..04d683a 100644 --- a/scad/contact_printer.scad +++ b/scad/contact_printer.scad @@ -468,12 +468,13 @@ module gate_blank () { module gate_carrier (pos = [0, 0, 0], rot = [0, 0, 0]) { X = 15.4; + GateCarrierZ = 22; SidesX = 2; SidesY = -1.2; translate(pos) rotate(rot) { difference () { union () { - rotate([90, 0, 0]) rounded_cube([30, 20, 5], d = 4, center = true, $fn = 40); + rotate([90, 0, 0]) translate([0, 1, -1]) rounded_cube([30, GateCarrierZ, 5], d = 4, center = true, $fn = 40); translate([-12.5, 2.5, 10]) difference () { rotate([0, 0, 180]) cylinder(r = R(5), h = 3, center = true, $fn = 3); translate([0, 5 / 2, 0]) cube([5, 5, 5 + 1], center = true); @@ -481,11 +482,11 @@ module gate_carrier (pos = [0, 0, 0], rot = [0, 0, 0]) { } lamp_rails_voids([0, 0, LampRailsOffsetZ], [90, 0, 0], h = 11); translate([0 ,0, 1]) difference () { - cube([X, 10 + 1, 20], center = true); + cube([X, 10 + 1, GateCarrierZ], center = true); translate([(X / 2) + SidesX, SidesY, 0]) rotate([0, 0, 45]) cube([5, 5, 20 + 1], center = true); translate([(-X / 2) - SidesX, SidesY, 0]) rotate([0, 0, 45]) cube([5, 5, 20 + 1], center = true); difference () { - translate([0, 6.7, 0]) cube([X + 1, 10 + 1, 20], center = true); + translate([0, 6.7, 0]) cube([X + 1, 10 + 1, GateCarrierZ], center = true); translate([0, 0, 0]) cube([X - 5, 10 + 1, 16], center = true); } } @@ -494,9 +495,10 @@ module gate_carrier (pos = [0, 0, 0], rot = [0, 0, 0]) { rotate([0, 0, 30]) m4_nut(5); } translate([-LampRailsSpacingX / 2, -3, LampRailsOffsetZ]) rotate([90, 0, 0]) { - cylinder(r = R(5), h = 20, center = true, $fn = 40); + cylinder(r = R(5), h = GateCarrierZ, center = true, $fn = 40); } } + filter_carrier([0, 5, 0], [180, 0, 0]); } } @@ -1251,6 +1253,7 @@ module sprocketed_roller_upright_solid (pos = [0, 0, 0]) { } //BOM: 1, M3 hex cap bolt 12mm, N/A, Attaches the sprocketed_roller to the geared motor +//BOM: 1, 608-RS Ball Bearing, 608-RS, Reduces wobble in the rollers spin //PRINT: 1 module sprocketed_roller_invert_solid (pos = [0, 0, 0]) { D = (FrameC * Sprockets) / PI; @@ -1592,8 +1595,8 @@ module debug_lamp () { lamp_single([0, 10, 2]); translate([0, -30, 3.5]) rotate([0, 0, 10]) sprocketed_roller_invert_solid(); lamp_LEDs([0, 19, 11]); - filter_carrier([0, 9, 11]); - picture_gate([0, -6.2, 11], Type = "standard"); //standard + //filter_carrier([0, 9, 11]); + //picture_gate([0, -6.2, 11], Type = "standard"); //standard gate_carrier([0, -2.5, 11]); } diff --git a/scripts/bom.sh b/scripts/bom.sh index 1bf872b..aa746ba 100644 --- a/scripts/bom.sh +++ b/scripts/bom.sh @@ -52,7 +52,7 @@ done echo "quantity,part,part_id,price" > "${TOTAL}" sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${DESTINATION} bom" -cmd ".import ${PRICES} prices"\ - '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}" + 'SELECT SUM(quantity),part,part_id, SUM(quantity) * (COALESCE((SELECT CEIL(prices.price / prices.quantity) 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;" @@ -61,4 +61,4 @@ sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdo "SELECT 'TOTAL', SUM(quantity), CAST(SUM(price) / 100.00 as MONEY) 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 + "SELECT SUM(quantity), 'TOTAL', 'N/A', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}" \ No newline at end of file