Post progress
This commit is contained in:
242
static/archive/nuxx-net-xnrgb7.txt
Normal file
242
static/archive/nuxx-net-xnrgb7.txt
Normal file
@@ -0,0 +1,242 @@
|
||||
[1]Press "Enter" to skip to content
|
||||
[2]nuxx.net
|
||||
|
||||
Making, baking, and (un-)breaking things in Southeast Michigan.
|
||||
|
||||
open menu mobile menu toggle button
|
||||
|
||||
• [4] facebook
|
||||
• [5] steve@nuxx.net
|
||||
|
||||
Search [7][ ]
|
||||
• [8]About
|
||||
• [9]Wiki (Archive)
|
||||
|
||||
OpenSCAD Is Kinda Neat
|
||||
|
||||
Published [10]December 20, 2025
|
||||
[11][Screenshot-2025-12-20-at-12]Designing a simple battery holder in OpenSCAD.
|
||||
|
||||
Earlier this year I designed a very basic box/organizer for [12]AA and [13]AAA
|
||||
batteries in [14]Autodesk Fusion, making it parameterized so that by changing a
|
||||
few variables one could adjust the battery type/size, rows/columns, etc. This
|
||||
worked well, and after [15]uploading it to Printables earlier today I realized
|
||||
that reimplementing it would probably be a good way to learn the basics of [16]
|
||||
OpenSCAD.
|
||||
|
||||
OpenSCAD is a rather different type of CAD tool, one in which you write code to
|
||||
generate objects. Because my battery holder is very simple (just a box with a
|
||||
pattern of cutouts) and uses input parameters, I figured it’d be a good intro
|
||||
to a new language / tool. And in the future might even be better than firing up
|
||||
Fusion for such simple designs.
|
||||
|
||||
After going through part of [17]the tutorial and an hour or so of poking,
|
||||
here’s the result: [18]battery_holder_generator.scad
|
||||
|
||||
[19][Screenshot-2025-12-20-at-12]Slicer showing the Fusion model on top and
|
||||
OpenSCAD on bottom.
|
||||
|
||||
By changing just a few variables — numRows and numColumns and batteryType — one
|
||||
can render a customized battery holder which can then be plopped into a [20]
|
||||
slicer and printed. No heavy/expensive CAD software needed and the output is
|
||||
effectively the same.
|
||||
|
||||
Without comments or informative output, this is the meat of the code:
|
||||
|
||||
AA = 15;
|
||||
AAA = 11;
|
||||
heightCompartment = 19;
|
||||
thicknessWall = 1;
|
||||
numRows = 4;
|
||||
numColumns = 10;
|
||||
batteryType = AA;
|
||||
|
||||
widthBox = (numRows * batteryType) + ((numRows + 1) * thicknessWall);
|
||||
lengthBox = (numColumns * batteryType) + ((numColumns + 1) * thicknessWall);
|
||||
depthBox = heightCompartment + thicknessWall;
|
||||
|
||||
difference() {
|
||||
cube([lengthBox, widthBox, depthBox]);
|
||||
for (c = [ 1 : numColumns ])
|
||||
for (r = [ 1 : numRows ])
|
||||
let (
|
||||
startColumn = ((c * thicknessWall) + ((c - 1) * batteryType)),
|
||||
startRow = ((r * thicknessWall) + ((r - 1) * batteryType))
|
||||
)
|
||||
{
|
||||
translate([startColumn, startRow, thicknessWall])
|
||||
cube([batteryType, batteryType, heightCompartment + 1]);
|
||||
}
|
||||
};
|
||||
|
||||
Simply, it draws a box and cuts out the holes. (The first cube() draws the main
|
||||
box, then difference() subtracts the battery holes via the second cube() as
|
||||
their quantity and location (via translate()) is iterated.
|
||||
|
||||
That’s it. Pretty neat, eh?
|
||||
|
||||
(One part that confused me is how I needed to use [21]let() to define
|
||||
startColumn and startRow inside the loop. I don’t understand this…)
|
||||
|
||||
While this probably won’t be very helpful for more complicated designs, I can
|
||||
see this being super useful for bearing drifts, spacers, and other similar
|
||||
simple (yet incredibly useful in real life) geometric shapes.
|
||||
|
||||
Published in [22]computers and [23]making things
|
||||
|
||||
Previous Post [24]Solar Radiation (Sun) Shield for Temperature Sensors
|
||||
Next Post [25]Home Assistant as Personal Device Tracker
|
||||
|
||||
Sidebar
|
||||
|
||||
Recent Posts
|
||||
|
||||
• [26]Home Assistant as Personal Device Tracker December 26, 2025
|
||||
• [27]OpenSCAD Is Kinda Neat December 20, 2025
|
||||
• [28]Solar Radiation (Sun) Shield for Temperature Sensors December 19, 2025
|
||||
• [29]Riser Feet for Wahoo KICKR CORE 2 December 6, 2025
|
||||
• [30]Wireshark 4.6.0 Supports macOS pktap Metadata (PID, Process Name, etc.)
|
||||
October 14, 2025
|
||||
• [31]Fat Bike Peanuts (Presta Nuts for Single Wall Fatbike Rims) June 21,
|
||||
2025
|
||||
• [32]Windows 10/11 Drivers for Epson Perfection 3170 Photo Scanner April 2,
|
||||
2025
|
||||
• [33]The History of Fibber Mountain March 21, 2025
|
||||
• [34]Fox 803-01-727 Replaces 803-01-993 March 20, 2025
|
||||
• [35]Automated Private Mobile Phone Photo Backup (Android to Apple Photos)
|
||||
January 23, 2025
|
||||
• [36]ZOOZ ZSE44 Flat Lines at 0° (C or F) January 22, 2025
|
||||
• [37]Bambu Lab P1S on IoT VLAN December 19, 2024
|
||||
• [38]Fix for Leaky Valves on Single Wall Fatbike Rims December 6, 2024
|
||||
• [39]Ride Dirt Trails, Not Mud Trails: Reposted November 22, 2024
|
||||
• [40]HDMI-CEC to Onkyo RI Bridge September 2, 2024
|
||||
• [41]Onkyo RI for ESPHome / Home Assistant August 19, 2024
|
||||
• [42]New XC Bike: Pivot Mach 4 SL v3 May 12, 2024
|
||||
• [43]Fork-Mount Bike Rack for Honda Odyssey (2018+) March 5, 2024
|
||||
• [44]Sunrise-like Alarm Clock via Home Assistant + Android January 19, 2024
|
||||
• [45]_wahoo-fitness-tnp._tcp.local January 10, 2024
|
||||
|
||||
Categories
|
||||
|
||||
• [46]acquired things
|
||||
• [47]around the house
|
||||
• [48]automotive
|
||||
• [49]beer
|
||||
• [50]computers
|
||||
• [51]cycling
|
||||
• [52]electronics
|
||||
• [53]family
|
||||
• [54]finances
|
||||
• [55]food
|
||||
• [56]found things
|
||||
• [57]games
|
||||
• [58]health
|
||||
• [59]livejournal
|
||||
• [60]making things
|
||||
• [61]mapping
|
||||
• [62]moved from livejournal
|
||||
• [63]movies
|
||||
• [64]music
|
||||
• [65]nuxx.net
|
||||
• [66]outdoors
|
||||
• [67]politics
|
||||
• [68]travel
|
||||
• [69]weather
|
||||
• [70]work
|
||||
|
||||
Posts
|
||||
|
||||
• [71]Home Assistant as Personal Device Tracker
|
||||
• [72]OpenSCAD Is Kinda Neat
|
||||
• [73]Solar Radiation (Sun) Shield for Temperature Sensors
|
||||
• [74]Riser Feet for Wahoo KICKR CORE 2
|
||||
• [75]Wireshark 4.6.0 Supports macOS pktap Metadata (PID, Process Name, etc.)
|
||||
• [76]Fat Bike Peanuts (Presta Nuts for Single Wall Fatbike Rims)
|
||||
• [77]Windows 10/11 Drivers for Epson Perfection 3170 Photo Scanner
|
||||
• [78]The History of Fibber Mountain
|
||||
• [79]Fox 803-01-727 Replaces 803-01-993
|
||||
• [80]Automated Private Mobile Phone Photo Backup (Android to Apple Photos)
|
||||
|
||||
[81]Period WordPress Theme by Compete Themes.
|
||||
Scroll to the top
|
||||
|
||||
References:
|
||||
|
||||
[1] https://nuxx.net/blog/2025/12/20/openscad-is-kinda-neat/#main
|
||||
[2] https://nuxx.net/blog
|
||||
[4] https://www.facebook.com/steve.vigneau
|
||||
[5] mailto:steve@nuxx.net
|
||||
[8] https://nuxx.net/blog/about/
|
||||
[9] https://nuxx.net/wiki_archive/A/Main_Page
|
||||
[10] https://nuxx.net/blog/2025/12/
|
||||
[11] https://nuxx.net/blog/wp-content/uploads/2025/12/Screenshot-2025-12-20-at-12.11.35-PM-scaled.png
|
||||
[12] https://en.wikipedia.org/wiki/AA_battery
|
||||
[13] https://en.wikipedia.org/wiki/AAA_battery
|
||||
[14] https://www.autodesk.com/products/fusion-360/
|
||||
[15] https://www.printables.com/model/1522509-simple-battery-holder-aa-and-aaa-w-parameterized-f
|
||||
[16] https://openscad.org/
|
||||
[17] https://en.wikibooks.org/wiki/OpenSCAD_Tutorial
|
||||
[18] https://nuxx.net/files/3d_printing/battery_holder_generator.scad
|
||||
[19] https://nuxx.net/blog/wp-content/uploads/2025/12/Screenshot-2025-12-20-at-12.30.03-PM-scaled.png
|
||||
[20] https://en.wikipedia.org/wiki/Slicer_(3D_printing)
|
||||
[21] https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/List_Comprehensions#let
|
||||
[22] https://nuxx.net/blog/category/computers/
|
||||
[23] https://nuxx.net/blog/category/making-things/
|
||||
[24] https://nuxx.net/blog/2025/12/19/solar-radiation-sun-shield-for-temperature-sensors/
|
||||
[25] https://nuxx.net/blog/2025/12/26/home-assistant-as-personal-device-tracker/
|
||||
[26] https://nuxx.net/blog/2025/12/26/home-assistant-as-personal-device-tracker/
|
||||
[27] https://nuxx.net/blog/2025/12/20/openscad-is-kinda-neat/
|
||||
[28] https://nuxx.net/blog/2025/12/19/solar-radiation-sun-shield-for-temperature-sensors/
|
||||
[29] https://nuxx.net/blog/2025/12/06/riser-feet-for-wahoo-kickr-core-2/
|
||||
[30] https://nuxx.net/blog/2025/10/14/wireshark-4-6-0-supports-macos-pktap-metadata-pid-process-name-etc/
|
||||
[31] https://nuxx.net/blog/2025/06/21/fat-bike-peanuts-presta-nuts-for-single-wall-fatbike-rims/
|
||||
[32] https://nuxx.net/blog/2025/04/02/windows-10-11-drivers-for-epson-perfection-3170-photo-scanner/
|
||||
[33] https://nuxx.net/blog/2025/03/21/the-history-of-fibber-mountain/
|
||||
[34] https://nuxx.net/blog/2025/03/20/fox-803-01-727-replaces-803-01-993/
|
||||
[35] https://nuxx.net/blog/2025/01/23/automated-private-mobile-phone-photo-backup-android-to-apple-photos/
|
||||
[36] https://nuxx.net/blog/2025/01/22/zooz-zse44-flat-lines-at-0-c-or-f/
|
||||
[37] https://nuxx.net/blog/2024/12/19/bambu-lab-p1s-on-iot-vlan/
|
||||
[38] https://nuxx.net/blog/2024/12/06/fix-for-leaky-valves-on-single-wall-fatbike-rims/
|
||||
[39] https://nuxx.net/blog/2024/11/22/ride-dirt-trails-not-mud-trails-reposted/
|
||||
[40] https://nuxx.net/blog/2024/09/02/hdmi-cec-to-onkyo-ri-bridge/
|
||||
[41] https://nuxx.net/blog/2024/08/19/onkyo-ri-for-esphome-home-assistant/
|
||||
[42] https://nuxx.net/blog/2024/05/12/new-xc-bike-pivot-mach-4-sl-v3/
|
||||
[43] https://nuxx.net/blog/2024/03/05/fork-mount-bike-rack-for-honda-odyssey-2018/
|
||||
[44] https://nuxx.net/blog/2024/01/19/sunrise-like-alarm-clock-via-home-assistant-android/
|
||||
[45] https://nuxx.net/blog/2024/01/10/_wahoo-fitness-tnp-_tcp-local/
|
||||
[46] https://nuxx.net/blog/category/acquired-things/
|
||||
[47] https://nuxx.net/blog/category/around-the-house/
|
||||
[48] https://nuxx.net/blog/category/automotive/
|
||||
[49] https://nuxx.net/blog/category/beer/
|
||||
[50] https://nuxx.net/blog/category/computers/
|
||||
[51] https://nuxx.net/blog/category/cycling/
|
||||
[52] https://nuxx.net/blog/category/electronics/
|
||||
[53] https://nuxx.net/blog/category/family/
|
||||
[54] https://nuxx.net/blog/category/finances/
|
||||
[55] https://nuxx.net/blog/category/food/
|
||||
[56] https://nuxx.net/blog/category/found-things/
|
||||
[57] https://nuxx.net/blog/category/games/
|
||||
[58] https://nuxx.net/blog/category/health/
|
||||
[59] https://nuxx.net/blog/category/livejournal/
|
||||
[60] https://nuxx.net/blog/category/making-things/
|
||||
[61] https://nuxx.net/blog/category/mapping/
|
||||
[62] https://nuxx.net/blog/category/moved-from-livejournal/
|
||||
[63] https://nuxx.net/blog/category/movies/
|
||||
[64] https://nuxx.net/blog/category/music/
|
||||
[65] https://nuxx.net/blog/category/nuxxnet/
|
||||
[66] https://nuxx.net/blog/category/outdoors/
|
||||
[67] https://nuxx.net/blog/category/politics/
|
||||
[68] https://nuxx.net/blog/category/travel/
|
||||
[69] https://nuxx.net/blog/category/weather/
|
||||
[70] https://nuxx.net/blog/category/work/
|
||||
[71] https://nuxx.net/blog/2025/12/26/home-assistant-as-personal-device-tracker/
|
||||
[72] https://nuxx.net/blog/2025/12/20/openscad-is-kinda-neat/
|
||||
[73] https://nuxx.net/blog/2025/12/19/solar-radiation-sun-shield-for-temperature-sensors/
|
||||
[74] https://nuxx.net/blog/2025/12/06/riser-feet-for-wahoo-kickr-core-2/
|
||||
[75] https://nuxx.net/blog/2025/10/14/wireshark-4-6-0-supports-macos-pktap-metadata-pid-process-name-etc/
|
||||
[76] https://nuxx.net/blog/2025/06/21/fat-bike-peanuts-presta-nuts-for-single-wall-fatbike-rims/
|
||||
[77] https://nuxx.net/blog/2025/04/02/windows-10-11-drivers-for-epson-perfection-3170-photo-scanner/
|
||||
[78] https://nuxx.net/blog/2025/03/21/the-history-of-fibber-mountain/
|
||||
[79] https://nuxx.net/blog/2025/03/20/fox-803-01-727-replaces-803-01-993/
|
||||
[80] https://nuxx.net/blog/2025/01/23/automated-private-mobile-phone-photo-backup-android-to-apple-photos/
|
||||
[81] https://www.competethemes.com/period/
|
||||
Reference in New Issue
Block a user