I just answered a question about the -D switch to the openscad command line
tool.
Then I noticed something that I had never noticed before.
Lets take a very simple script:
x = 1; // 100
y = 1; // 50
z = 1; // 10
echo("x = ", x);
echo("y = ", y);
echo("z = ", z);
If I open this up in openscad, everytime I change the value of a variable
(x say), and then do a preview, it does what I expect it to, change x =
100; then it echos x = 100
BUT:
If I call it on the command line with the -D arg, then no matter what I
change the value to, it does NOT change the result! EVER!
like so: openscad -D x=100 -D y=50 -D z=30 testvar.scad &
very Interesting! why?
Jerry
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous
If writing good code requires very little comments, then writing really
excellent code requires no comments at all!- Ken Thompson
Jerry, maybe you are expecting -D x=100 test.scad to provide a default
value for x, to be overridden by a definition of x within test.scad.
But that's not what -D is supposed to do. Instead, -D is used when you want
to override a definition in the source code using the command line, which
is very useful when you are invoking openscad non-interactively.
You are using -D and at the same time invoking scad interactively, which is
not the use case for which -D is intended.
On 7 August 2015 at 21:21, Jerry Davis jdawgaz@gmail.com wrote:
I just answered a question about the -D switch to the openscad command
line tool.
Then I noticed something that I had never noticed before.
Lets take a very simple script:
x = 1; // 100
y = 1; // 50
z = 1; // 10
echo("x = ", x);
echo("y = ", y);
echo("z = ", z);
If I open this up in openscad, everytime I change the value of a variable
(x say), and then do a preview, it does what I expect it to, change x =
100; then it echos x = 100
BUT:
If I call it on the command line with the -D arg, then no matter what I
change the value to, it does NOT change the result! EVER!
like so: openscad -D x=100 -D y=50 -D z=30 testvar.scad &
very Interesting! why?
Jerry
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous
If writing good code requires very little comments, then writing really
excellent code requires no comments at all!- Ken Thompson
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org