Discussion:
[OpenSCAD] Capturing Openscad output in Windows
Ivo
2018-03-25 21:57:28 UTC
Permalink
I'm calculating large-ish arrays in openscad to pass on to another program
and I cannot capture more than 1024 characters.

"openscad.com -o dummy.stl somescript.scad" works and dumps the entire
contents on the command line.

"openscad.com -o dummy.stl somescript.scad | more" will show a truncated
result.

"openscad.com -o dummy.stl somescript.scad > out.txt" will result in a
"out.txt" file with only 1024 characters.

The output of "more" ends with the same character as "out.txt".

Any idea what may be wrong ? Is there maybe a missing flush ?

Cheers, Ivo



--
Sent from: http://forum.openscad.org/
MichaelAtOz
2018-03-26 03:08:48 UTC
Permalink
I presume this is echo() output?
If so, from the wiki
<https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment>
, "For at least 2015.03-2+, specifying the extension .echo causes openscad
to produce a text file containing error messages and the output of all
echo() calls in filename as they would appear in the console window visible
in the GUI. Multiple output files are not supported, so using this option
you cannot also obtain the model that would have normally been generated."

Also, I seem to recall something about things going to STDERR, so try '2>'
(see this
<https://support.microsoft.com/en-au/help/110930/redirecting-error-messages-from-command-prompt-stderr-stdout>
)



-----
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!
--
Sent from: http://forum.openscad.org/
Ivo
2018-03-26 23:16:54 UTC
Permalink
This script :
a = "0123456789";

module b()
{
echo(a,a,a,a,a);
echo(a,a,a,a,a);
echo(a,a,a,a,a);
echo(a,a,a,a,a);
echo(a,a,a,a,a);
}

module c()
{
b();
b();
b();
b();
b();
}

c();

called with "openscad.com -o dummy.stl echobug.scad | more" produces

ECHO: "0123456789", "0123456789", "0123456789", "0123456789", "0123456789"
ECHO: "0123456789", "0123456789", "0123456789", "0123456789", "0123456789"
.. more of these ..
ECHO: "0123456789", "0123456789", "0123456789", "0123456789", "0123456789"
ECHO: "0123456789", "0123456789", "0

note the truncated end.

Without redirection "openscad.com -o dummy.stl echobug.scad" produces the
correct result on the commandline.

The captured result is truncated at 1024 characters. Adding "2>&1" doesn't
matter, it's not STDERR that i'm missing. Capturing does not work on the cmd
commandline or in powershell.

openscad.com -version
OpenSCAD version 2018.01.06

I'm convinced this is a bug.

Hints, tips or work around-s would be greatly appreciated.

I'd like to use a two stage script, one calculates an array, the second uses
the elements of the array to multmatrix objects to their correct location.
The generated objects are merged outside of openscad to avoid the implicit
union.

Cheers, Ivo






--
Sent from: http://forum.openscad.org/
MichaelAtOz
2018-03-27 01:28:15 UTC
Permalink
Did you try:
openscad.com -o output.echo echobug.scad



-----
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!
--
Sent from: http://forum.openscad.org/
Ivo
2018-04-01 08:16:25 UTC
Permalink
Post by MichaelAtOz
openscad.com -o output.echo echobug.scad
I have by now, I didn't read your reply properly and focused on the "2>&1"
part too much. Thanks for pointing this out.

I have my scripts working with "-o whatever.echo" combined with passing
commands to the script and having it either produce the parameters for the
next stage or render a specific object.

Quotes on Windows command-line are a bit problematic, quoted quotes a bit
more so and calling command-line programs from powershell with quoted
parameters even more so.

There are still some strange things going on, openscad will sometime crash
and sometime not on the same commandline.

Cheers, Ivo






--
Sent from: http://forum.openscad.org/

Loading...