discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Novice programmer needs help

M
MichaelAtOz
Sun, Jul 24, 2016 8:24 AM

postalpirate wrote

Thank you! I missed the end of the description that says "When generating
only one number, you still call it with variable[0]". So much to catch up
and learn.

My next question is can you add to a variable the same variable plus an
amount, i.e. x=x+1? Reason being is that I want to add the book width
(book_wid) to shelf length (shelf_len_x) until the next book would put the
shelf length over the shelf length maximum (max_shelf_len).

No. See the Variables bit of the  wiki
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Values_and_Data_Types
.
You could generate a vector of rands() then use a for() loop to step through
it, using it to translate() to the next book.
See  Cliff.scad http://forum.openscad.org/file/n17962/Cliff.scad  for
something I did a long time ago.

I did go through the registration process, I'm not sure why it says it
hasn't been accepted yet.

Check your spam folder, but I'll also send an invite.


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/Novice-programmer-needs-help-tp17956p17962.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

postalpirate wrote > Thank you! I missed the end of the description that says "When generating > only one number, you still call it with variable[0]". So much to catch up > and learn. > > My next question is can you add to a variable the same variable plus an > amount, i.e. x=x+1? Reason being is that I want to add the book width > (book_wid) to shelf length (shelf_len_x) until the next book would put the > shelf length over the shelf length maximum (max_shelf_len). No. See the Variables bit of the wiki <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Values_and_Data_Types> . You could generate a vector of rands() then use a for() loop to step through it, using it to translate() to the next book. See Cliff.scad <http://forum.openscad.org/file/n17962/Cliff.scad> for something I did a long time ago. > I did go through the registration process, I'm not sure why it says it > hasn't been accepted yet. Check your spam folder, but I'll also send an invite. ----- 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/Novice-programmer-needs-help-tp17956p17962.html Sent from the OpenSCAD mailing list archive at Nabble.com.