discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Weight of Raft

M
MichaelAtOz
Wed, Jul 27, 2016 12:43 AM

skiddaw2 wrote

Given my module 2X4(length) gets called several times to create a raft of
2 x 4s how might I accumulate the total volume of wood to calculate the
overall weight?

Sounds like a exam question.

As OpenSCAD doesn't allow a=a+1 variable reassignment, you would need keep
track at the calling level.
That would depend in the structure of your program and how you calculate how
many times and lengths you use. A recursive technique could be used.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Weight-of-Raft-tp17995p18003.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

skiddaw2 wrote > Given my module 2X4(length) gets called several times to create a raft of > 2 x 4s how might I accumulate the total volume of wood to calculate the > overall weight? Sounds like a exam question. As OpenSCAD doesn't allow a=a+1 variable reassignment, you would need keep track at the calling level. That would depend in the structure of your program and how you calculate how many times and lengths you use. A recursive technique could be used. ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Weight-of-Raft-tp17995p18003.html Sent from the OpenSCAD mailing list archive at Nabble.com.