Capturing Openscad output in Windows

classic Classic list List threaded Threaded
5 messages Options
Ivo
Reply | Threaded
Open this post in threaded view
|

Capturing Openscad output in Windows

Ivo
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Capturing Openscad output in Windows

MichaelAtOz
Administrator
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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!
Ivo
Reply | Threaded
Open this post in threaded view
|

Re: Capturing Openscad output in Windows

Ivo
In reply to this post by Ivo
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Capturing Openscad output in Windows

MichaelAtOz
Administrator
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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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!
Ivo
Reply | Threaded
Open this post in threaded view
|

Re: Capturing Openscad output in Windows

Ivo
MichaelAtOz wrote
> Did you try:
> 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/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org