discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Problem with large projects

J
jon
Mon, Jun 15, 2020 12:02 PM

Would there be any advantage to temporarily linearizing (combining) the
files just for the purpose of compilation?  Many people run external
editors and only use OpenSCAD as a compiler. Suppose the editor
automatically created a file called Linearized.SCAD and that was what
OpenSCAD focused on, leaving the structure of your source code intact
for editing.  Quite a hack, but would there be any benefits?

On 6/15/2020 4:17 AM, nop head wrote:

Yes that is the problem. If you have some complex code that generates
a solid it is all run on every update, the parameters it generates are
then compared with the cached solids to see if the geometry needs
updating. In my project that takes no time at all but running all the
code to generate thousands of parts starts to take a long time. I
think this is mainly because every constant that isn't in your top
level file gets evaluated over and over again.

For isolation I have individual files that I can load on their own,
for example the z axis assembly, which is quite complex. At the start
of the file it has a lot of constants to work out positions, etc. It
also includes definitions of all the vitamins it uses, which are
hundreds of lists.  It also needs to export a few functions and
modules to the rest of the machine, which just export constants, like
the total height. However calling any of these means all the hundreds
of constants it uses are all evaluated over and over again. So even on
a PC it starts to take significant time. It really shouldn't take that
long to evaluate a script but the constant evaluation explosion does
as soon as you separate a project into lots of files.

On Mon, 15 Jun 2020 at 01:16, Ronaldo Persiano <rcmpersiano@gmail.com
mailto:rcmpersiano@gmail.com> wrote:

     in that library all transformations are just functiontions
     producing matrices, and a sequence of transformations is
     easily accumulated into a single multmatrix by the library, so
     essentialy all your code below will break down into a single
     multmatrix operation in the CSG tree. all the calculation
     itself is not passed CSG, it is just matrix multiplications,
     so essentially every combination of input variabled becomes
     one matrix value and i think this will be chached right?


 As far as I know, they will not be cached. Only solids, models,
 objects are cached. Variables are not.
 _______________________________________________
 OpenSCAD mailing list
 Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
 http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Would there be any advantage to temporarily linearizing (combining) the files just for the purpose of compilation?  Many people run external editors and only use OpenSCAD as a compiler. Suppose the editor automatically created a file called Linearized.SCAD and that was what OpenSCAD focused on, leaving the structure of your source code intact for editing.  Quite a hack, but would there be any benefits? On 6/15/2020 4:17 AM, nop head wrote: > Yes that is the problem. If you have some complex code that generates > a solid it is all run on every update, the parameters it generates are > then compared with the cached solids to see if the geometry needs > updating. In my project that takes no time at all but running all the > code to generate thousands of parts starts to take a long time. I > think this is mainly because every constant that isn't in your top > level file gets evaluated over and over again. > > For isolation I have individual files that I can load on their own, > for example the z axis assembly, which is quite complex. At the start > of the file it has a lot of constants to work out positions, etc. It > also includes definitions of all the vitamins it uses, which are > hundreds of lists.  It also needs to export a few functions and > modules to the rest of the machine, which just export constants, like > the total height. However calling any of these means all the hundreds > of constants it uses are all evaluated over and over again. So even on > a PC it starts to take significant time. It really shouldn't take that > long to evaluate a script but the constant evaluation explosion does > as soon as you separate a project into lots of files. > > On Mon, 15 Jun 2020 at 01:16, Ronaldo Persiano <rcmpersiano@gmail.com > <mailto:rcmpersiano@gmail.com>> wrote: > > in that library all transformations are just functiontions > producing matrices, and a sequence of transformations is > easily accumulated into a single multmatrix by the library, so > essentialy all your code below will break down into a single > multmatrix operation in the CSG tree. all the calculation > itself is not passed CSG, it is just matrix multiplications, > so essentially every combination of input variabled becomes > one matrix value and i think this will be chached right? > > > As far as I know, they will not be cached. Only solids, models, > objects are cached. Variables are not. > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org