Discussion:
[OpenSCAD] Avoiding multiple includes
nop head
2012-03-07 12:24:51 UTC
Permalink
I have a config file that I include in all of my other files. They
themselves get use<>d in my main file. I noticed that any modules in my
config file get compiled over and over again. Is there a way to avoid this?
royasutton
2018-11-03 17:46:13 UTC
Permalink
Do you ever come up with a solution for including files just once?



--
Sent from: http://forum.openscad.org/
nop head
2018-11-03 18:29:12 UTC
Permalink
No, so I restructured my code to only have object definitions in the
include file and uses of the files with modules. Those get cached and only
compiled once.

e.g. I might include screws.scad that has a list of screw definitions
(lists) and it uses screw.scad to pull in all the related modules and
functions.

The fact that screws.scad is included lots of times means that the lists
are defined over and over again but that is relatively fast. If it became a
problem I suppose I could wrap all my objects in functions, so I would then
just use screws.scad and it would all be cached.

I had to improve the way OpenSCAD checked the dates of the cached files to
prevent it slowing down with the square of the number of used files.
Post by royasutton
Do you ever come up with a solution for including files just once?
--
Sent from: http://forum.openscad.org/
_______________________________________________
OpenSCAD mailing list
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Loading...