Re: where does "included" code get included? - and effect on the Customizer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: where does "included" code get included? - and effect on the Customizer

khackbarth

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

 

 


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: where does "included" code get included? - and effect on the Customizer

Troberg
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: where does "included" code get included? - and effect on the Customizer

MichaelAtOz
Administrator
In reply to this post by khackbarth
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.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
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!