Welcome to the forum. Your post is still flagged as "This post has NOT been
accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list
http://forum.openscad.org/mailing_list/MailingListOptions.jtp?forum=1 ,
and respond to the registration email.
Your problem is that rands() "Generates a constant vector of pseudo random
numbers, much like an array." as you can see in the echo output in the
console;
Compiling design (CSG Tree generation)...
ECHO: [1.40732], [11.5499], [10.913]
Compiling design (CSG Products generation)...
the [...] means it is a vector (aka array), cube() does not take vectors, so
it ignores them (yes bad feature - may be fixed in the future), default
input to cube() is 1, hence the 1x1x1 cube resulting.
You could either get the first element when you call rand(), like so;
// get a single number
single_rand = rands(0,10,1)[0];
echo(single_rand);
or extract it when used in cube(), like so;
echo (book_wid[0],book_ht[0],book_dep[0]);
cube([book_wid[0],book_ht[0],book_dep][0]);
I think the former is better.
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-tp17956p17957.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Welcome to the forum. Your post is still flagged as "This post has NOT been
accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list
<http://forum.openscad.org/mailing_list/MailingListOptions.jtp?forum=1> ,
and respond to the registration email.
Your problem is that rands() "Generates a constant vector of pseudo random
numbers, much like an array." as you can see in the echo output in the
console;
Compiling design (CSG Tree generation)...
ECHO: [1.40732], [11.5499], [10.913]
Compiling design (CSG Products generation)...
the [...] means it is a vector (aka array), cube() does not take vectors, so
it ignores them (yes bad feature - may be fixed in the future), default
input to cube() is 1, hence the 1x1x1 cube resulting.
You could either get the first element when you call rand(), like so;
// get a single number
single_rand = rands(0,10,1)[0];
echo(single_rand);
or extract it when used in cube(), like so;
echo (book_wid[0],book_ht[0],book_dep[0]);
cube([book_wid[0],book_ht[0],book_dep][0]);
I think the former is better.
-----
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-tp17956p17957.html
Sent from the OpenSCAD mailing list archive at Nabble.com.