Command line

classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Command line

nophead
I can't get openscad to do anything on the command line apart from open a file in the GUI (latest windows snapshot and the previous one).

I.e. openscad file.scad opens the GUI.

openscad -o t.stl file.scad returns immediately and does nothing. I expected it to make an STL file.

Other valid options I try return immediately, including --help. Illegal options give a runtime error. I never get a usage line.

Am I missing something or is it completely broken?

Reply | Threaded
Open this post in threaded view
|

Re: Command line

kintel
Administrator
On Feb 12, 2012, at 22:04 PM, nop head wrote:

> I can't get openscad to do anything on the command line apart from open a file in the GUI (latest windows snapshot and the previous one).

Can you remember (or test) when it last worked?

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.

On 12 February 2012 21:10, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:04 PM, nop head wrote:

> I can't get openscad to do anything on the command line apart from open a file in the GUI (latest windows snapshot and the previous one).

Can you remember (or test) when it last worked?

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Command line

kintel
Administrator
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Command line

Brad Pitcher
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
I does the same under Win7 64bit  and WinXP 32bit.

On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
Actually it does do something. When I output an STL with -o or -s it outputs a small one instantaneously with not much in it. It looks like it can't find the included files and makes an object with all the variables undefined. If I omit the -o it opens in the GUI and draws it correctly. If I run it on a simple file with no includes it seems to work.

So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.


On 12 February 2012 21:30, nop head <[hidden email]> wrote:
I does the same under Win7 64bit  and WinXP 32bit.


On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



Reply | Threaded
Open this post in threaded view
|

Re: Command line

Whosawhatsis
I would guess that it is an issue of using the shell's path instead of the file's. Have you tried changing your working directory to the location of your scad file before running the command?

On Monday, February 13, 2012 at 12:54 PM, nop head wrote:

Actually it does do something. When I output an STL with -o or -s it outputs a small one instantaneously with not much in it. It looks like it can't find the included files and makes an object with all the variables undefined. If I omit the -o it opens in the GUI and draws it correctly. If I run it on a simple file with no includes it seems to work.

So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.


On 12 February 2012 21:30, nop head <[hidden email]> wrote:
I does the same under Win7 64bit  and WinXP 32bit.


On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list

Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
Yes I am in the same directory as the file but the include is in a subdirectory.

If I copy the openscad executable to the working directory I get a different result. I think it sees the first include file as $fn seems to be set but then fails to find files included from that. Just a guess as there is no console output.

On 13 February 2012 21:05, Whosawhatsis <[hidden email]> wrote:
I would guess that it is an issue of using the shell's path instead of the file's. Have you tried changing your working directory to the location of your scad file before running the command?

On Monday, February 13, 2012 at 12:54 PM, nop head wrote:

Actually it does do something. When I output an STL with -o or -s it outputs a small one instantaneously with not much in it. It looks like it can't find the included files and makes an object with all the variables undefined. If I omit the -o it opens in the GUI and draws it correctly. If I run it on a simple file with no includes it seems to work.

So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.


On 12 February 2012 21:30, nop head <[hidden email]> wrote:
I does the same under Win7 64bit  and WinXP 32bit.


On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Command line

Stuart Young

Tried passing the filename to  openscad on the cli as ./filename.scad (or .\filename.scad on windows) to see if that works?

Annoying workaround if it works, but will definitely help pinpoint the issue if it is path related.

--
Cef

On Feb 14, 2012 8:25 AM, "nop head" <[hidden email]> wrote:
Yes I am in the same directory as the file but the include is in a subdirectory.

If I copy the openscad executable to the working directory I get a different result. I think it sees the first include file as $fn seems to be set but then fails to find files included from that. Just a guess as there is no console output.

On 13 February 2012 21:05, Whosawhatsis <[hidden email]> wrote:
I would guess that it is an issue of using the shell's path instead of the file's. Have you tried changing your working directory to the location of your scad file before running the command?

On Monday, February 13, 2012 at 12:54 PM, nop head wrote:

Actually it does do something. When I output an STL with -o or -s it outputs a small one instantaneously with not much in it. It looks like it can't find the included files and makes an object with all the variables undefined. If I omit the -o it opens in the GUI and draws it correctly. If I run it on a simple file with no includes it seems to work.

So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.


On 12 February 2012 21:30, nop head <[hidden email]> wrote:
I does the same under Win7 64bit  and WinXP 32bit.


On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
Just tried it and it makes no difference.

On 13 February 2012 22:05, Stuart Young <[hidden email]> wrote:

Tried passing the filename to  openscad on the cli as ./filename.scad (or .\filename.scad on windows) to see if that works?

Annoying workaround if it works, but will definitely help pinpoint the issue if it is path related.

--
Cef

On Feb 14, 2012 8:25 AM, "nop head" <[hidden email]> wrote:
Yes I am in the same directory as the file but the include is in a subdirectory.

If I copy the openscad executable to the working directory I get a different result. I think it sees the first include file as $fn seems to be set but then fails to find files included from that. Just a guess as there is no console output.

On 13 February 2012 21:05, Whosawhatsis <[hidden email]> wrote:
I would guess that it is an issue of using the shell's path instead of the file's. Have you tried changing your working directory to the location of your scad file before running the command?

On Monday, February 13, 2012 at 12:54 PM, nop head wrote:

Actually it does do something. When I output an STL with -o or -s it outputs a small one instantaneously with not much in it. It looks like it can't find the included files and makes an object with all the variables undefined. If I omit the -o it opens in the GUI and draws it correctly. If I run it on a simple file with no includes it seems to work.

So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.


On 12 February 2012 21:30, nop head <[hidden email]> wrote:
I does the same under Win7 64bit  and WinXP 32bit.


On 12 February 2012 21:27, Brad Pitcher <[hidden email]> wrote:
It works with Wine, but I suppose that's not the best test.

On Sun, Feb 12, 2012 at 1:25 PM, Marius Kintel <[hidden email]> wrote:
On Feb 12, 2012, at 22:16 PM, nop head wrote:

> I have never attempted to use it before. One from may last year does the same except I don't get the runtime error, just nothing or the GUI.
>
ok, it might be that it never worked under Windows. Windows doesn't like sending standard I/O to the console when running a GUI app. Perhaps someone more experienced with that platform could chip in on that topic.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Command line

donbright
There are probably a lot of broken things on the Windows side,
especially after the latest patches to move file handling from QT to
Boost. I dont know if there is anyone who has a Windows dev
environment set up.. the Win* machines i had access to both died from
viruses/hackers so i havent been able to work on it like I did in
2011. Sorry

-DB


> nop head <[hidden email]> wrote:
> Am I missing something or is it completely broken?

Reply | Threaded
Open this post in threaded view
|

Re: Command line

kintel
Administrator
In reply to this post by nophead
On Feb 13, 2012, at 21:54 PM, nop head wrote:

> So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.
>
It sounds like three issues on top of each other:
o crash on wrong cmd-line options
o failure to initialize the library path
o failure to connect stdout to the calling shell

I will try looking into the first two from a code review perspective (no Windows environment in sight). The third requires more Windows knowledge.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
Doing a bit of Googling it seems console apps and GUI apps are two different things on Windows. I think the reason it appears to run instantaneously is that the shell does not wait for it because it is a GUI app. Therefore it won't be able to write to the console and won't be usable from a script as it wont wait.

A console app can put up a GUI though, but the shell will wait for it to finish so if you launch the GUI from the command line it will tie up the shell.

I think you need a console app that launches a separate GUI app if there is no command line and then terminates.

Any Windows experts no different?

On 13 February 2012 23:51, Marius Kintel <[hidden email]> wrote:
On Feb 13, 2012, at 21:54 PM, nop head wrote:

> So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.
>
It sounds like three issues on top of each other:
o crash on wrong cmd-line options
o failure to initialize the library path
o failure to connect stdout to the calling shell

I will try looking into the first two from a code review perspective (no Windows environment in sight). The third requires more Windows knowledge.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
I meant to write:
    Any Windows experts know different? 

On 14 February 2012 00:17, nop head <[hidden email]> wrote:
Doing a bit of Googling it seems console apps and GUI apps are two different things on Windows. I think the reason it appears to run instantaneously is that the shell does not wait for it because it is a GUI app. Therefore it won't be able to write to the console and won't be usable from a script as it wont wait.

A console app can put up a GUI though, but the shell will wait for it to finish so if you launch the GUI from the command line it will tie up the shell.

I think you need a console app that launches a separate GUI app if there is no command line and then terminates.

Any Windows experts no different?


On 13 February 2012 23:51, Marius Kintel <[hidden email]> wrote:
On Feb 13, 2012, at 21:54 PM, nop head wrote:

> So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.
>
It sounds like three issues on top of each other:
o crash on wrong cmd-line options
o failure to initialize the library path
o failure to connect stdout to the calling shell

I will try looking into the first two from a code review perspective (no Windows environment in sight). The third requires more Windows knowledge.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
OK the solution is quite simple. All we need to do is copy the .exe to a different name and then use:

editbin /SUBSYSTEM:CONSOLE openscad_console.exe

That makes the stdout work properly and the shell waits for it to complete. If you run it without command line arguments then it launches a GUI but also has a console window. I.e. we need two copies of the exe with the subsystem flag set each way.

A trick is to name the console version openscad.com. Windows picks that in preference to .exe when launched from the command line via the search path. The menu / desktop short-cuts can point to the .exe.

I am testing this at work so I don't know if it fixes the search path problem. At least I should get to see an error message.

A bad command line still gives a runtime error but it displays the following: -

C:\Program Files (x86)\OpenSCAD>openscad --fred
terminate called after throwing an instance of 'boost::exception_detail::clone_i
mpl<boost::exception_detail::error_info_injector<boost::program_options::unknown
_option> >'
  what():  unknown option fred




On 14 February 2012 00:38, nop head <[hidden email]> wrote:
I meant to write:
    Any Windows experts know different? 


On 14 February 2012 00:17, nop head <[hidden email]> wrote:
Doing a bit of Googling it seems console apps and GUI apps are two different things on Windows. I think the reason it appears to run instantaneously is that the shell does not wait for it because it is a GUI app. Therefore it won't be able to write to the console and won't be usable from a script as it wont wait.

A console app can put up a GUI though, but the shell will wait for it to finish so if you launch the GUI from the command line it will tie up the shell.

I think you need a console app that launches a separate GUI app if there is no command line and then terminates.

Any Windows experts no different?


On 13 February 2012 23:51, Marius Kintel <[hidden email]> wrote:
On Feb 13, 2012, at 21:54 PM, nop head wrote:

> So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.
>
It sounds like three issues on top of each other:
o crash on wrong cmd-line options
o failure to initialize the library path
o failure to connect stdout to the calling shell

I will try looking into the first two from a code review perspective (no Windows environment in sight). The third requires more Windows knowledge.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad



Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
I now get error messages for the include file it can't find.

My top level file in the working directory has  include <conf/config.scad>
conf/config.scad has include <utils.scad> which is in the conf directory.

This works with the GUI, but on the command line I get
WARNING: can't open input file 'utils.scad'.

So it seems the search rules include the directory of the file with the include when run from the GUI, but not when run from the command line.

If I change conf/config.scad to include <conf/utils.scad> it finds it from the command line, but not from the GUI.



On 14 February 2012 09:48, nop head <[hidden email]> wrote:
OK the solution is quite simple. All we need to do is copy the .exe to a different name and then use:

editbin /SUBSYSTEM:CONSOLE openscad_console.exe

That makes the stdout work properly and the shell waits for it to complete. If you run it without command line arguments then it launches a GUI but also has a console window. I.e. we need two copies of the exe with the subsystem flag set each way.

A trick is to name the console version openscad.com. Windows picks that in preference to .exe when launched from the command line via the search path. The menu / desktop short-cuts can point to the .exe.

I am testing this at work so I don't know if it fixes the search path problem. At least I should get to see an error message.

A bad command line still gives a runtime error but it displays the following: -

C:\Program Files (x86)\OpenSCAD>openscad --fred
terminate called after throwing an instance of 'boost::exception_detail::clone_i
mpl<boost::exception_detail::error_info_injector<boost::program_options::unknown
_option> >'
  what():  unknown option fred




On 14 February 2012 00:38, nop head <[hidden email]> wrote:
I meant to write:
    Any Windows experts know different? 


On 14 February 2012 00:17, nop head <[hidden email]> wrote:
Doing a bit of Googling it seems console apps and GUI apps are two different things on Windows. I think the reason it appears to run instantaneously is that the shell does not wait for it because it is a GUI app. Therefore it won't be able to write to the console and won't be usable from a script as it wont wait.

A console app can put up a GUI though, but the shell will wait for it to finish so if you launch the GUI from the command line it will tie up the shell.

I think you need a console app that launches a separate GUI app if there is no command line and then terminates.

Any Windows experts no different?


On 13 February 2012 23:51, Marius Kintel <[hidden email]> wrote:
On Feb 13, 2012, at 21:54 PM, nop head wrote:

> So it seems to boil down to not being able to find includes, not outputting anything to the console (including the usage message) and crashing when the usage is wrong.
>
It sounds like three issues on top of each other:
o crash on wrong cmd-line options
o failure to initialize the library path
o failure to connect stdout to the calling shell

I will try looking into the first two from a code review perspective (no Windows environment in sight). The third requires more Windows knowledge.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad




Reply | Threaded
Open this post in threaded view
|

Re: Command line

kintel
Administrator
On Feb 14, 2012, at 20:01 PM, nop head wrote:

> This works with the GUI, but on the command line I get
> WARNING: can't open input file 'utils.scad'.
>
This was fixed in another branch which isn't ready yet - I've now applied that specific fix to master.
FYI: That other branch is going to fix https://github.com/openscad/openscad/issues/75

There is some duplication of code going on which makes these not be caught by the test suite. The goal is to gradually refactor these into shared components.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: Command line

nophead
Why does it behave differently on the command line to the GUI. Don't they use the same code at the point?

On 14 February 2012 20:06, Marius Kintel <[hidden email]> wrote:
On Feb 14, 2012, at 20:01 PM, nop head wrote:

> This works with the GUI, but on the command line I get
> WARNING: can't open input file 'utils.scad'.
>
This was fixed in another branch which isn't ready yet - I've now applied that specific fix to master.
FYI: That other branch is going to fix https://github.com/openscad/openscad/issues/75

There is some duplication of code going on which makes these not be caught by the test suite. The goal is to gradually refactor these into shared components.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad

Reply | Threaded
Open this post in threaded view
|

Re: Command line

kintel
Administrator
On Feb 14, 2012, at 21:21 PM, nop head wrote:

> Why does it behave differently on the command line to the GUI. Don't they use the same code at the point?
>
They use different code for initializing the paths based on the input file (cmd-line vs. file dialog).

 -Marius


12