Avoiding multiple includes

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

Avoiding multiple includes

nophead
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?
Reply | Threaded
Open this post in threaded view
|

Re: Avoiding multiple includes

royasutton
Do you ever come up with a solution for including files just once?



--
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: Avoiding multiple includes

nophead
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.

On Sat, 3 Nov 2018 at 17:47, royasutton <[hidden email]> wrote:
Do you ever come up with a solution for including files just once?



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org