discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Dynamic Include

AM
Adrian Mariano
Fri, Nov 25, 2022 8:08 PM

Presumably larger files take longer to be parsed...but you can run your
program and see how long it takes.  Does including the file give a
significant performance hit?  I'd guess not, since reading a MB doesn't
take very long compared to OpenSCAD render, say.  Including BOSL2/std.scad
appears to take negligible time and it's 1.5 MB in 28 files.

i think you can do a dynamic include only in the context of an "if" block,
which means the included content will be scoped to the conditional block.
So you could do something like

if (part1) {
include<part1.scad>

code here to make part 1

}

But the stuff included would not be available at the top level.  Note, I
haven't tested this.

On Fri, Nov 25, 2022 at 2:59 PM Trevor Orr via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: Trevor Orr fractorr@yahoo.com
To: OpenSCAD General Discussion Mailing-list discuss@lists.openscad.org
Cc:
Bcc:
Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC)
Subject: [OpenSCAD] Dynamic Include
I am pretty sure this is not possible from my attempts to do this but
thought I would ask anyways.

Is there a way to do a dynamic include base on the value of variable ?
The reason is that I have a file that contains data to build parts and the
data file is getting rather large (almost 1 MB) and it would be nice to be
able to split it up into a separate file for each part.

So say the variable design equals "test" then I want to include the file
"test.scad"

Also does a large data file like this decrease performance?  I would
assume the larger the data file is the longer it takes for it to be parsed?

---------- Forwarded message ----------
From: Trevor Orr via Discuss discuss@lists.openscad.org
To: OpenSCAD General Discussion Mailing-list discuss@lists.openscad.org
Cc: Trevor Orr fractorr@yahoo.com
Bcc:
Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC)
Subject: [OpenSCAD] Dynamic Include


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Presumably larger files take longer to be parsed...but you can run your program and see how long it takes. Does including the file give a significant performance hit? I'd guess not, since reading a MB doesn't take very long compared to OpenSCAD render, say. Including BOSL2/std.scad appears to take negligible time and it's 1.5 MB in 28 files. i think you can do a dynamic include only in the context of an "if" block, which means the included content will be scoped to the conditional block. So you could do something like if (part1) { include<part1.scad> code here to make part 1 } But the stuff included would not be available at the top level. Note, I haven't tested this. On Fri, Nov 25, 2022 at 2:59 PM Trevor Orr via Discuss < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: Trevor Orr <fractorr@yahoo.com> > To: OpenSCAD General Discussion Mailing-list <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC) > Subject: [OpenSCAD] Dynamic Include > I am pretty sure this is not possible from my attempts to do this but > thought I would ask anyways. > > Is there a way to do a dynamic include base on the value of variable ? > The reason is that I have a file that contains data to build parts and the > data file is getting rather large (almost 1 MB) and it would be nice to be > able to split it up into a separate file for each part. > > So say the variable design equals "test" then I want to include the file > "test.scad" > > Also does a large data file like this decrease performance? I would > assume the larger the data file is the longer it takes for it to be parsed? > > > > > ---------- Forwarded message ---------- > From: Trevor Orr via Discuss <discuss@lists.openscad.org> > To: OpenSCAD General Discussion Mailing-list <discuss@lists.openscad.org> > Cc: Trevor Orr <fractorr@yahoo.com> > Bcc: > Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC) > Subject: [OpenSCAD] Dynamic Include > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
TO
Trevor Orr
Fri, Nov 25, 2022 8:38 PM

Cool, the if include statement does seem to work.
On Friday, November 25, 2022 at 12:09:01 PM PST, Adrian Mariano avm4@cornell.edu wrote:

Presumably larger files take longer to be parsed...but you can run your program and see how long it takes.  Does including the file give a significant performance hit?  I'd guess not, since reading a MB doesn't take very long compared to OpenSCAD render, say.   Including BOSL2/std.scad appears to take negligible time and it's 1.5 MB in 28 files. 

i think you can do a dynamic include only in the context of an "if" block, which means the included content will be scoped to the conditional block.   So you could do something like
if (part1) {   include<part1.scad>   
    code here to make part 1}
But the stuff included would not be available at the top level.  Note, I haven't tested this. 

On Fri, Nov 25, 2022 at 2:59 PM Trevor Orr via Discuss discuss@lists.openscad.org wrote:

---------- Forwarded message ----------
From: Trevor Orr fractorr@yahoo.com
To: OpenSCAD General Discussion Mailing-list discuss@lists.openscad.org
Cc: 
Bcc: 
Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC)
Subject: [OpenSCAD] Dynamic Include
I am pretty sure this is not possible from my attempts to do this but thought I would ask anyways.
Is there a way to do a dynamic include base on the value of variable ?  The reason is that I have a file that contains data to build parts and the data file is getting rather large (almost 1 MB) and it would be nice to be able to split it up into a separate file for each part.
So say the variable design equals "test" then I want to include the file "test.scad"
Also does a large data file like this decrease performance?  I would assume the larger the data file is the longer it takes for it to be parsed?

---------- Forwarded message ----------
From: Trevor Orr via Discuss discuss@lists.openscad.org
To: OpenSCAD General Discussion Mailing-list discuss@lists.openscad.org
Cc: Trevor Orr fractorr@yahoo.com
Bcc: 
Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC)
Subject: [OpenSCAD] Dynamic Include


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Cool, the if include statement does seem to work. On Friday, November 25, 2022 at 12:09:01 PM PST, Adrian Mariano <avm4@cornell.edu> wrote: Presumably larger files take longer to be parsed...but you can run your program and see how long it takes.  Does including the file give a significant performance hit?  I'd guess not, since reading a MB doesn't take very long compared to OpenSCAD render, say.   Including BOSL2/std.scad appears to take negligible time and it's 1.5 MB in 28 files.  i think you can do a dynamic include only in the context of an "if" block, which means the included content will be scoped to the conditional block.   So you could do something like if (part1) {   include<part1.scad>        code here to make part 1} But the stuff included would not be available at the top level.  Note, I haven't tested this.  On Fri, Nov 25, 2022 at 2:59 PM Trevor Orr via Discuss <discuss@lists.openscad.org> wrote: ---------- Forwarded message ---------- From: Trevor Orr <fractorr@yahoo.com> To: OpenSCAD General Discussion Mailing-list <discuss@lists.openscad.org> Cc:  Bcc:  Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC) Subject: [OpenSCAD] Dynamic Include I am pretty sure this is not possible from my attempts to do this but thought I would ask anyways. Is there a way to do a dynamic include base on the value of variable ?  The reason is that I have a file that contains data to build parts and the data file is getting rather large (almost 1 MB) and it would be nice to be able to split it up into a separate file for each part. So say the variable design equals "test" then I want to include the file "test.scad" Also does a large data file like this decrease performance?  I would assume the larger the data file is the longer it takes for it to be parsed? ---------- Forwarded message ---------- From: Trevor Orr via Discuss <discuss@lists.openscad.org> To: OpenSCAD General Discussion Mailing-list <discuss@lists.openscad.org> Cc: Trevor Orr <fractorr@yahoo.com> Bcc:  Date: Fri, 25 Nov 2022 19:57:55 +0000 (UTC) Subject: [OpenSCAD] Dynamic Include _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org