Subject: [OpenSCAD] Re: text output
From: "MichaelAtOz" <[email-masked]>
To: "'OpenSCAD general discussion'" <[email-masked]>
Date: Thu, 23 Sep 2021 14:04:01 +1000

Forgot the output:

Compiling design (CSG Tree generation)...

ECHO: "1-no-line-break2

3

"

ECHO: "_________________"

ECHO: [1, 2, 3]

ECHO: "_________________"

ECHO: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Compiling design (CSG Products generation)...

 

  _____  

From: Michael Marx [mailto:[email-masked]] 
Sent: Thu, 23 Sep 2021 13:58
To: 'OpenSCAD general discussion'
Subject: [OpenSCAD] Re: text output

> but if OpenSCAD could read files

With some little helper bits (top & tail of a file) you can read any file via include<>.

e.g.

// read_file_main.scad

include <read_file_input.txt>

echo(read_file);

echo("_________________");

include <read_file_vec.txt>

echo(read_file_vec);

echo("_________________");

include <read_file_3vecs.txt>

echo(read_file_3vecs);

<read_file_input.txt>

// freeform text needs to be careful with '"' (make them \") and use '\n' for line breaks

// need an assignment first part, followed by data

read_file="

1-no-line-break            

2\n

3\n

"; // then terminate the assignment

<read_file_vec.txt>

read_file_vec= [

1,

2,

3,

];

<read_file_3vecs.txt>

read_file_3vecs=[

[1,2,3],

[4,5,6],

[7,8,9]

];

I haven't bothered yet, but a tiny script could top/tail any file readily.

The freeform text input is a little more work with the '"' & '\n' newlines. 

But in Notepad++ I can replace all '\n\r' with '\\n\n\r' and '"' with '\\"'.

 

> -----Original Message-----

> From: Daniel [mailto:[email-masked]]

> Sent: Wed, 22 Sep 2021 08:58

> To: William F. Adams via Discuss

> Subject: [OpenSCAD] Re: text output

> 

> It would be a fierce useful feature. I have a Python script that reads

> .kicad_pcb files to find where the mount holes are. Works fine but if

> OpenSCAD could read files I could possibly get rid of the python script.

> 

> On 21/09/2021 23:53, William F. Adams via Discuss wrote:

> > _______________________________________________

> > OpenSCAD mailing list

> > To unsubscribe send an email to [email-masked]

> _______________________________________________

> OpenSCAD mailing list

> To unsubscribe send an email to [email-masked]

 
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_con
tent=emailclient> 

Virus-free.
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_con
tent=emailclient> www.avg.com