Does a file of included code get inserted in the program where the "include"
statement is placed? That would affect the scope of variables.
Also, I'm having trouble with variables, defined in included code, showing
up in weird places in the Customizer pane, with weird descriptions. Anyone
understand how this is expected to work? Again, if I could accurately
control where code was included, I might be able to control how it shows up
in the customizer. For example I have an include statement in the
/[Hidden]/ portion of the code but variables in the included code are
still showing up in the Customizer pane.
Thanks,
Ken
You can override variables in the including code.
Example, the code below will show "true":
file: includelibrary.scad
generatepartlist=false;
file: usinglibrary.scad
<include includelibrary.scad>generatepartlist=true;
echo(generatepartlist);
This is actually pretty neat, and I use it a lot (for example, so I don't
clog up the ouput with part lists when I don't want them).
--
Sent from: http://forum.openscad.org/
khackbarth wrote
Does a file of included code get inserted in the program where the
"include"
statement is placed? That would affect the scope of variables.
Yes, include<> just places text effectively inline. So as you say, where it
is include'd needs consideration.
use<> is a bit funny, it sort of wraps the code in a scope level, so
variables are available inside-use'd code, but not the top/outside scope.
$variables can be even stranger.
Also, I'm having trouble with variables, defined in included code, showing
up in weird places in the Customizer pane, with weird descriptions.
Anyone
understand how this is expected to work? Again, if I could accurately
control where code was included, I might be able to control how it shows
up
in the customizer. For example I have an include statement in the
/[Hidden]/ portion of the code but variables in the included code are
still showing up in the Customizer pane.
I'm not up to speed on customiser. You probably want to make sure you have
the latest version, some such were fixed.
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.
Sent from: http://forum.openscad.org/