discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: text output

D
Daniel
Tue, Sep 21, 2021 10:58 PM

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 discuss-leave@lists.openscad.org

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 discuss-leave@lists.openscad.org
MM
Michael Marx
Thu, Sep 23, 2021 3:58 AM

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:daniel@puggsy.net]

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 discuss-leave@lists.openscad.org


OpenSCAD mailing list

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

--
This email has been checked for viruses by AVG.
https://www.avg.com

> 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:daniel@puggsy.net] > 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 discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
M
MichaelAtOz
Thu, Sep 23, 2021 4:04 AM

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:michael@marx.id.au]
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:daniel@puggsy.net]

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 discuss-leave@lists.openscad.org


OpenSCAD mailing list

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

<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

--
This email has been checked for viruses by AVG.
https://www.avg.com

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:michael@marx.id.au] 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:daniel@puggsy.net] > 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 discuss-leave@lists.openscad.org > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org <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 -- This email has been checked for viruses by AVG. https://www.avg.com