discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Import data in a .txt file

RU
Richard Urwin
Thu, Nov 3, 2016 3:40 PM

OpenSCAD is not good for I/O.

The way you probably want to handle this is by using a script to convert the
file into an OpenSCAD library that reads something like:

Mydata = [
[1, 1, 1]
10, 1, 25]
1, 2, 3]
5, 2, 3]
...
];

Then use "include" or "use" in your OpenSCAD file to pull in the data.

There are various tools you can use to do the conversion or you can do it
with a reasonably powerful text editor. I favour  sed
https://www.gnu.org/software/sed/manual/sed.html  myself, but it does
have a learning curve.

--
View this message in context: http://forum.openscad.org/Import-data-in-a-txt-file-tp18914p18915.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

OpenSCAD is not good for I/O. The way you probably want to handle this is by using a script to convert the file into an OpenSCAD library that reads something like: Mydata = [ [1, 1, 1] 10, 1, 25] 1, 2, 3] 5, 2, 3] ... ]; Then use "include" or "use" in your OpenSCAD file to pull in the data. There are various tools you can use to do the conversion or you can do it with a reasonably powerful text editor. I favour sed <https://www.gnu.org/software/sed/manual/sed.html> myself, but it does have a learning curve. -- View this message in context: http://forum.openscad.org/Import-data-in-a-txt-file-tp18914p18915.html Sent from the OpenSCAD mailing list archive at Nabble.com.