Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.
Hi all, I am generating a set of tiles and I am using the (windows) commandline to do it. My typical cmd command is: "c:\Program Files\OpenSCAD\openscad.com" -o stl\tile_6_3.stl -D "x=6" -D "y=3" cmdline_tile.scad The cmdline_tile.scad file contains this code: $fn = 30; use <tile_module.scad>; // dQ midHeight = 38; slopeN = [-95 / 12 * y, -57 / 12 * x, 32]; tile (slopeN, h = midHeight); And this produces an error: WARNING: Ignoring
unknown variable 'y', in file cmdline_tile.scad, line 6. And of course the result is empty... echo (x=x, y=y); which produces this output line: ECHO: x = 6, y = 3 again followed by the error claiming that variable 'y' is unknown etc. What is, however, unexplainable for me, is the fact that the command on last line works, if I build the slope vector inline: tile (n = [-95 / 12 * y, -57 / 12 * x, 32], h = midHeight); This does not raise any warning and builds the expected tile.
Why? And why I cannot build the vector and then use it? Jan _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Administrator
|
'-D' adds that text to the end of the file
(in memory). so you get this $fn = 30; use <tile_module.scad>; // dQ midHeight = 38; slopeN = [-95 / 12 * y, -57 / 12 * x, 32]; tile (slopeN, h = midHeight); x=6;y=3; Try that in the GUI The magic source is $fn = 30; use <tile_module.scad>; // dQ midHeight = 38; x=0; y=0; slopeN = [-95 / 12 * y, -57 / 12 * x, 32]; tile (slopeN, h = midHeight); x=6;y=3; If you want to know why, ask, but I'll
answer tomorrow, I have a glass of red calling to me... From:
Discuss [mailto:[hidden email]] On Behalf Of Jan Koupil Hi all, I am
generating a set of tiles and I am using the (windows) commandline to do it. My
typical cmd command is: "c:\Program
Files\OpenSCAD\openscad.com" -o stl\tile_6_3.stl -D "x=6" -D "y=3"
cmdline_tile.scad The
cmdline_tile.scad file contains this code: $fn = 30; use <tile_module.scad>; // dQ midHeight = 38; slopeN = [-95 / 12 * y, -57 / 12 * x, 32]; tile (slopeN, h = midHeight); And this
produces an error: WARNING:
Ignoring unknown variable 'y', in file cmdline_tile.scad, line 6. And of
course the result is empty... echo (x=x, y=y); which
produces this output line: ECHO:
x = 6, y = 3 again
followed by the error claiming that variable 'y' is unknown etc. What is,
however, unexplainable for me, is the fact that the command on last line works,
if I build the slope vector inline: tile (n = [-95 / 12 * y, -57 / 12 * x, 32], h = midHeight); This does
not raise any warning and builds the expected tile. Why? And why I cannot build
the vector and then use it? Jan _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me. 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. |
In reply to this post by janek
On 14.08.20 09:32, Jan Koupil wrote:
> This does not raise any warning and builds the expected tile. > Why? And why I cannot build the vector and then use it? Variables are initialized in order, modules called afterwards, so if you want to use -D variables to calculate others, you need to give them some initial value in the script before use. a = 3; b = a + 2; echo(a, b); openscad -Da=1 ... ciao, Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
|
Free forum by Nabble | Edit this page |