discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Who uses echo() output in subsequent processes?

MM
Michael Marx (spintel)
Sat, Dec 6, 2025 6:06 AM

I'm historically aware of the use of echo() output to do things like producing a Bill of Material.
And the Command-line output option '-o echo' to log echo statements to a file.

There is a suggestion to change the format (significant digits) of numbers output by echo(), and
probably str().

Will this cause significant issues to such use of the log output?

I'm historically aware of the use of echo() output to do things like producing a Bill of Material. And the Command-line output option '-o echo' to log echo statements to a file. There is a suggestion to change the format (significant digits) of numbers output by echo(), and probably str(). Will this cause significant issues to such use of the log output?
JB
Jordan Brown
Sat, Dec 6, 2025 6:45 AM

The two echo postprocessing scripts I have do not process numbers; they
process only strings.

One of them makes a simple BOM by collecting up lines, stripping them a
bit, and counting duplicates using sort and uniq -c.

One of them asks the OpenSCAD program what parts it makes, and whether
to generate STLs or PNGs, and for PNGs what camera angle to use, and
then iterates generating the files.

The two echo postprocessing scripts I have do not process numbers; they process only strings. One of them makes a simple BOM by collecting up lines, stripping them a bit, and counting duplicates using sort and uniq -c. One of them asks the OpenSCAD program what parts it makes, and whether to generate STLs or PNGs, and for PNGs what camera angle to use, and then iterates generating the files.
JG
Jonathan Gilbert
Sat, Dec 6, 2025 6:57 AM

I use them to create discrete part number listings, which in turn I use to
isolate individual parts for selective display and rendering.

But, I'm reasonably sure I only treat them as strings, and generally only
work with whole numbers, so probably not impacted by a format change of
what you're describing.

On Fri, Dec 5, 2025 at 10:06 PM Michael Marx (spintel) via Discuss <
discuss@lists.openscad.org> wrote:

I'm historically aware of the use of echo() output to do things like
producing a Bill of Material.
And the Command-line output option '-o echo' to log echo statements to a
file.

There is a suggestion to change the format (significant digits) of numbers
output by echo(), and probably str().

Will this cause significant issues to such use of the log output?


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

I use them to create discrete part number listings, which in turn I use to isolate individual parts for selective display and rendering. But, I'm reasonably sure I only treat them as strings, and generally only work with whole numbers, so probably not impacted by a format change of what you're describing. On Fri, Dec 5, 2025 at 10:06 PM Michael Marx (spintel) via Discuss < discuss@lists.openscad.org> wrote: > I'm historically aware of the use of echo() output to do things like > producing a Bill of Material. > And the Command-line output option '-o echo' to log echo statements to a > file. > > > > There is a suggestion to change the format (significant digits) of numbers > output by echo(), and probably str(). > > Will this cause significant issues to such use of the log output? > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > -- - Jon Gilbert jong@jong.org / jgilbertsjc@gmail.com
JB
Jordan Brown
Sat, Dec 6, 2025 8:07 AM

As a bit more background, the discussion is about whether it's a
significant compatibility break to emit more digits from echo(), so that
(for instance) echoing 0.1234567 would emit 0.1234567 rather than
today's 0.123457, or echoing 1234567 would emit 1234567 or maybe
1.234567e+6 rather than today's 1.23457e+6.  (Note that today in both
cases the "67" at the end of the number gets rounded up to "7".)

As a bit more background, the discussion is about whether it's a significant compatibility break to emit more digits from echo(), so that (for instance) echoing 0.1234567 would emit 0.1234567 rather than today's 0.123457, or echoing 1234567 would emit 1234567 or maybe 1.234567e+6 rather than today's 1.23457e+6.  (Note that today in both cases the "67" at the end of the number gets rounded up to "7".)
F
frechefuchs
Sat, Dec 6, 2025 10:12 PM

Am 06.12.25 um 07:06 schrieb Michael Marx (spintel) via Discuss:

I'm historically aware of the use of echo() output to do things like producing a Bill of Material.
And the Command-line output option '-o echo' to log echo statements to a file.

There is a suggestion to change the format (significant digits) of numbers output by echo(), and
probably str().

Just to outline my use-case:  I'm using OpenSCAD in a project together
with LaTeX and MetaPost to generate 2D drawings and documentation.
OpenSCAD output is actually the least important, but - as we all know -
the visually most convincing one.

All three of them, LaTeX, MetaPost and OpenSCAD, being three different
languages, need to refer to the same data, im my use-case numbers only
for OpenSCAD & MetaPost and strings only for OpenSCAD & LaTeX.  Since
OpenSCAD happens to be my testbed for new ideas, source parameter files
are actually .scad files.  These files are simple and linear, but may
contain calculations of dependent parameters and are converted (to
MetaPost) code in a three-step process via pipe:

  1. For every assignment to a variable, insert an 'echo(var=var);'
    statement (using sed).
  2. Run the file through openscad with '--export-format echo'.
  3. Tidy-up the output, e.g., elide 'ECHO:' prefix and append a semicolon
    to all lines.

The resulting MetaPost file contains only simple assignments, no
arithmetics or function calls.

(Translation of OpenSCAD strings to LaTeX code is similar, but the
OpenSCAD source file contains a lot more string-fu as most or the LaTeX
macro generation is done on the OpenSCAD side.)

Will this cause significant issues to such use of the log output?

As long as the suggestion is not about reducing significant digits, I
hope not.  But thank's for the heads-up!  Something I'll watch out for.

Hm, while MetaPost can handle arbitrary precision values, people might
use other post-processing tools that get hick-up on unexpected precision
or range.  So maybe make OpenSCAD's echo(var=var) output format subject
to user-preference?  Opening the door to getting rid of that
|v<$!#§^Wexpendable ECHO: prefix ...

Regards,
frechefuchs

Am 06.12.25 um 07:06 schrieb Michael Marx (spintel) via Discuss: > I'm historically aware of the use of echo() output to do things like producing a Bill of Material. > And the Command-line output option '-o echo' to log echo statements to a file. > > There is a suggestion to change the format (significant digits) of numbers output by echo(), and > probably str(). Just to outline my use-case: I'm using OpenSCAD in a project together with LaTeX and MetaPost to generate 2D drawings and documentation. OpenSCAD output is actually the least important, but - as we all know - the visually most convincing one. All three of them, LaTeX, MetaPost and OpenSCAD, being three different languages, need to refer to the same data, im my use-case numbers only for OpenSCAD & MetaPost and strings only for OpenSCAD & LaTeX. Since OpenSCAD happens to be my testbed for new ideas, source parameter files are actually .scad files. These files are simple and linear, but may contain calculations of dependent parameters and are converted (to MetaPost) code in a three-step process via pipe: 1. For every assignment to a variable, insert an 'echo(var=var);' statement (using sed). 2. Run the file through openscad with '--export-format echo'. 3. Tidy-up the output, e.g., elide 'ECHO:' prefix and append a semicolon to all lines. The resulting MetaPost file contains only simple assignments, no arithmetics or function calls. (Translation of OpenSCAD strings to LaTeX code is similar, but the OpenSCAD source file contains a lot more string-fu as most or the LaTeX macro generation is done on the OpenSCAD side.) > Will this cause significant issues to such use of the log output? As long as the suggestion is not about _reducing_ significant digits, I hope not. But thank's for the heads-up! Something I'll watch out for. Hm, while MetaPost can handle arbitrary precision values, people might use other post-processing tools that get hick-up on unexpected precision or range. So maybe make OpenSCAD's echo(var=var) output format subject to user-preference? Opening the door to getting rid of that |v<$!#§^Wexpendable ECHO: prefix ... Regards, frechefuchs
JB
Jordan Brown
Sun, Dec 7, 2025 8:58 PM

On 12/6/2025 2:12 PM, frechefuchs via Discuss wrote:

So maybe make OpenSCAD's echo(var=var) output format subject
to user-preference?  Opening the door to getting rid of that
|v<$!#§^Wexpendable ECHO: prefix ...

There's some thoughts on the table for both of those things.

See issue #6385: New output/formatting suite: print(), quote(), format()
https://github.com/openscad/openscad/issues/6385

On 12/6/2025 2:12 PM, frechefuchs via Discuss wrote: > So maybe make OpenSCAD's echo(var=var) output format subject > to user-preference? Opening the door to getting rid of that > |v<$!#§^Wexpendable ECHO: prefix ... There's some thoughts on the table for both of those things. See issue #6385: New output/formatting suite: print(), quote(), format() <https://github.com/openscad/openscad/issues/6385>