I seem to have a catch22:
Using “include <file>” for my large (BOSL2) library causes slow animations, as all files get re-included for every single frame.
Using “use <file>” instead of “include <file>” is needed to allow module caching to speed up animations.
“use <file>" will NOT provide constants/variables to the using parent file, by design.
Modules/functions inside a used file cannot see constants/variables from the parent using file.
Constants/variables defined (or included) inside a used file will ALL get redeclared/redefined/reassigned on every call into a module/function in that file. This is EXTREMELY inefficient.
So, in summary:
I shouldn't just include all the files, because of poor animation speed.
I cannot include constants/variables from one file, then have the functions/modules in a another used file, as the constants/variables won’t be available inside the used file.
I cannot have the used file include the constants/variables from another file, due to terrible redeclaration inefficiency.
I cannot have the used file declare the constants/variables as they will be unavailable to the using file.
I cannot just prune the size of the library down, as individual files in the library, (like beziers.scad) run afoul of the redeclaration bug.
PLEASE fix the “use <file>” variable redeclaration bug.
Yes this has become a huge problem for me as well. Currently my 3D printer
design takes 1 minute to evaluate the scad (before it starts GSG product
generation), up from about 20 seconds not long ago. As a project grows in
complexity the time to process it seems to go up as the square, or
perhaps higher power due to it evaluating constants over and over again.
The last time I measured it it was hundreds of thousands of times. Perhaps
it is millions now.
On Tue, 24 Nov 2020 at 03:43, Revar Desmera revarbat@gmail.com wrote:
I seem to have a catch22:
- Using “include <file>” for my large (BOSL2) library causes slow
animations, as all files get re-included for every single frame.
- Using “use <file>” instead of “include <file>” is needed to allow
module caching to speed up animations.
- “use <file>" will NOT provide constants/variables to the using
parent file, by design.
- Modules/functions inside a used file cannot see constants/variables
from the parent using file.
- Constants/variables defined (or included) inside a used file will
ALL get redeclared/redefined/reassigned on every call into a
module/function in that file. This is EXTREMELY inefficient.
So, in summary:
- I shouldn't just include all the files, because of poor animation
speed.
- I cannot include constants/variables from one file, then have the
functions/modules in a another used file, as the constants/variables won’t
be available inside the used file.
- I cannot have the used file include the constants/variables from
another file, due to terrible redeclaration inefficiency.
- I cannot have the used file declare the constants/variables as they
will be unavailable to the using file.
- I cannot just prune the size of the library down, as individual
files in the library, (like beziers.scad) run afoul of the redeclaration
bug.
PLEASE fix the “use <file>” variable redeclaration bug.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Indeed, that would be a very useful fix. I just heard about
http://commandermodel.com/393/Volkswagen_Beetle modeled in
OpenSCAD (http://commandermodel.com/beetle.000.jpg). It seems
there are more big (and awesome) projects out there than
widely known which could benefit from that.
ciao,
Torsten.
It is often said that OpenSCAD's variables are actually named constants but
the reality is they are actually only named expressions unless they are in
the top level file. When they refer to other expressions and functions it
becomes a huge tree that gets evaluated whenever a module or function is
called, regardless of whether it is actually used or not.
On Tue, 24 Nov 2020 at 17:32, Torsten Paul Torsten.Paul@gmx.de wrote:
Indeed, that would be a very useful fix. I just heard about
http://commandermodel.com/393/Volkswagen_Beetle modeled in
OpenSCAD (http://commandermodel.com/beetle.000.jpg). It seems
there are more big (and awesome) projects out there than
widely known which could benefit from that.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org