discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: Dynamic Include

TP
Torsten Paul
Fri, Nov 25, 2022 8:18 PM

You can't include/use with a variable.

However if you don't mind using an experimental feature from
the dev snapshot, you can put the data into json files and
use something like:

file = "a.json";
data = import(file);
echo(data.a);

a.json
{
"a": 10
}

b.json
{
"a": 12
}

ciao,
Torsten.

You can't include/use with a variable. However if you don't mind using an experimental feature from the dev snapshot, you can put the data into json files and use something like: file = "a.json"; data = import(file); echo(data.a); a.json { "a": 10 } b.json { "a": 12 } ciao, Torsten.
TO
Trevor Orr
Fri, Nov 25, 2022 8:39 PM

sweet, data in a json file? that is awesome, I will definitely be giving that a try.  
On Friday, November 25, 2022 at 12:19:31 PM PST, Torsten Paul torsten.paul@gmx.de wrote:

You can't include/use with a variable.

However if you don't mind using an experimental feature from
the dev snapshot, you can put the data into json files and
use something like:

file = "a.json";
data = import(file);
echo(data.a);

a.json
{
    "a": 10
}

b.json
{
    "a": 12
}

ciao,
  Torsten.


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

sweet, data in a json file? that is awesome, I will definitely be giving that a try.   On Friday, November 25, 2022 at 12:19:31 PM PST, Torsten Paul <torsten.paul@gmx.de> wrote: You can't include/use with a variable. However if you don't mind using an experimental feature from the dev snapshot, you can put the data into json files and use something like: file = "a.json"; data = import(file); echo(data.a); a.json {     "a": 10 } b.json {     "a": 12 } ciao,   Torsten. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
WL
William Lugg
Fri, Nov 25, 2022 9:31 PM

Please help a beginner understand...

How does putting the data in a json file improve the situation?

Thanks
Bill Lugg

On 11/25/22 13:18, Torsten Paul wrote:

You can't include/use with a variable.

However if you don't mind using an experimental feature from
the dev snapshot, you can put the data into json files and
use something like:

file = "a.json";
data = import(file);
echo(data.a);

a.json
{
"a": 10
}

b.json
{
"a": 12
}

ciao,
Torsten.


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

Please help a beginner understand... How does putting the data in a json file improve the situation? Thanks Bill Lugg On 11/25/22 13:18, Torsten Paul wrote: > You can't include/use with a variable. > > However if you don't mind using an experimental feature from > the dev snapshot, you can put the data into json files and > use something like: > > file = "a.json"; > data = import(file); > echo(data.a); > > a.json > { > "a": 10 > } > > b.json > { > "a": 12 > } > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
TO
Trevor Orr
Sat, Nov 26, 2022 9:03 PM

I have only done a few test but so far the ability to use json for data is awesome!!!  I have a lot of data and being able to use structured data makes coding way easier and should also make it much easier to maintain code as well.

On Friday, November 25, 2022 at 12:19:31 PM PST, Torsten Paul <torsten.paul@gmx.de> wrote:  

You can't include/use with a variable.

However if you don't mind using an experimental feature from
the dev snapshot, you can put the data into json files and
use something like:

file = "a.json";
data = import(file);
echo(data.a);

a.json
{
    "a": 10
}

b.json
{
    "a": 12
}

ciao,
  Torsten.


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

I have only done a few test but so far the ability to use json for data is awesome!!!  I have a lot of data and being able to use structured data makes coding way easier and should also make it much easier to maintain code as well. On Friday, November 25, 2022 at 12:19:31 PM PST, Torsten Paul <torsten.paul@gmx.de> wrote: You can't include/use with a variable. However if you don't mind using an experimental feature from the dev snapshot, you can put the data into json files and use something like: file = "a.json"; data = import(file); echo(data.a); a.json {     "a": 10 } b.json {     "a": 12 } ciao,   Torsten. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org