discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Read a data file in an OpenSCAD drawing file?

D
doug
Fri, Feb 3, 2017 9:08 PM

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.

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.
A
adrian
Fri, Feb 3, 2017 9:54 PM

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.

--
View this message in context: http://forum.openscad.org/Read-a-data-file-in-an-OpenSCAD-drawing-file-tp20308p20309.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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. -- View this message in context: http://forum.openscad.org/Read-a-data-file-in-an-OpenSCAD-drawing-file-tp20308p20309.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sat, Feb 4, 2017 12:42 AM

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!

View this message in context: http://forum.openscad.org/Read-a-data-file-in-an-OpenSCAD-drawing-file-tp20308p20311.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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! -- View this message in context: http://forum.openscad.org/Read-a-data-file-in-an-OpenSCAD-drawing-file-tp20308p20311.html Sent from the OpenSCAD mailing list archive at Nabble.com.