Read a data file in an OpenSCAD drawing file?

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

Read a data file in an OpenSCAD drawing file?

Doug Mcnutt
I really need to do that because other software, think Gerber, would
like to read the same file so that they will operate with the same data.

I can probably get what I want by writing a perl5 script that generates
the entire program file for use by OpenSCAD and it might also help with
those variables that can't be changed. But it would take a bunch of
programming time and it would require a complete restart of OpenSCAD
with no neat sensing of a save executed from an editor.

My perl5 code is creating Gerber files for the circuit boards and they
read a text file of parameters as they start up. The files are easily
changed with any old word processor like gedit. All they contain are
lines of text containing a name, a value, and comments. I can put them
into a mail message.

Perhaps an execution from a shell command line that would allow for a
read from a file name or standard-in when commanded by a read request at
the start of it's almost-C text.

Yeah, I admit I started in the 60's with a card punch and I'd rather use
a shell than try to understand button poking to find a file. Sorry.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Read a data file in an OpenSCAD drawing file?

adrian
So, what are you asking for?  A parser in OpenSCAD to read that file?  I think someone was saying that they have a rudimentary parser somewhere on this forum.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Read a data file in an OpenSCAD drawing file?

MichaelAtOz
Administrator
In reply to this post by Doug Mcnutt
Depending what you want to do with the 'data', you can

include<some_file>

That file could have either a list of assignments;

len=10;
wide=20;

or if it is a list you could top/tail with, eg;

list=[
10,
20,  // you can have comments
30,
];
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Loading...