Headless OpenSCAD

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

Headless OpenSCAD

iamwil
Hi all. I recently discovered that the latest versions of OpenSCAD can export to images via the command line, and I'd like to be able to do this on a headless machine. However, I've been running into some problems getting it to work.

I'm on Ubuntu 0.13 raring 64-bit. The aptitude repository didn't seem to have the 2013.06 version. Thus, I installed it from the following:

wget https://openscad.googlecode.com/files/openscad-2013.06.x86-64.tar.gz
tar xvzf openscad-2013.06.x86-64.tar.gz
sudo /home/ubuntu/tmp/openscad-2013.06/install.sh
Then I installed all the library dependencies I saw when I ran

aptitude show openscad
Hence, I can run `openscad -v` successfully

However, when I try to run openscad to convert to an image:

$ openscad -o simchange.png simchange.scad
Compiling design (CSG Products normalization)...
Normalized CSG tree has 6 elements
Unable to open a connection to the X server
Can't create OpenGL OffscreenView. Code: -1.
So obviously, the machine can't use OpenGL because there is no graphics installed. So I figured xvfb would be useful for this. So after installing xvfb, and running it:

LIBGL_DEBUG=verbose xvfb-run openscad -o simchange.png simchange.scad
Compiling design (CSG Products normalization)...
Normalized CSG tree has 6 elements
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL error: failed to load driver: swrast
glXChooseFBConfig failed
Can't create OpenGL OffscreenView. Code: -1.
It seems like it can't find the correct swrast_dri (software raster driver?). However, I do have the file:
$ ls -l /usr/lib/x86_64-linux-gnu/dri
total 5228
-rw-r--r-- 1 root root  365640 Jun 18 19:59 i915_dri.so
-rw-r--r-- 1 root root  794904 Jun 18 19:59 i965_dri.so
-rw-r--r-- 1 root root 1343744 Jun 18 19:59 nouveau_dri.so
-rw-r--r-- 1 root root  183384 Jun 18 19:59 nouveau_vieux_dri.so
-rw-r--r-- 1 root root  330216 Jun 18 19:59 r200_dri.so
-rw-r--r-- 1 root root  494008 Jun 18 19:59 r300_dri.so
-rw-r--r-- 1 root root  475928 Jun 18 19:59 r600_dri.so
-rw-r--r-- 1 root root  297264 Jun 18 19:59 radeon_dri.so
-rw-r--r-- 1 root root  270872 Jun 18 19:59 radeonsi_dri.so
-rw-r--r-- 1 root root  448872 Jun 18 19:59 swrast_dri.so
-rw-r--r-- 1 root root  321856 Jun 18 19:59 vmwgfx_dri.so
So now, I'm at a loss as to how to go about solving it. Googling didn't much help, as well as searching on this forum, so I figured i'd come and ask you guys. Any hint would be helpful. thanks!
Cubehero: Work with others on 3D printable projects
https://cubehero.com
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

kintel
Administrator
Wil,

Take a look at testing.txt:
https://github.com/openscad/openscad/blob/master/doc/testing.txt

The test framework also have some scripts to automatically set up this under Linux.
Basically, I recommend you get the testing framework to run - once it runs you know that your system is sane, and should then be able to reproduce this yourself.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

donbright
In reply to this post by iamwil
iamwil

sorry this didnt work

xvfb-run apparently doesnt work right on ubuntu 13

please try this

Xvfb :5 -screen 0 800x600x24 &
export DISPLAY=:5
openscad blah blah blah


-DB



On Wed, Jul 17, 2013 at 11:59 PM, iamwil <[hidden email]> wrote:
Hi all. I recently discovered that the latest versions of OpenSCAD can export
to images via the command line, and I'd like to be able to do this on a
headless machine. However, I've been running into some problems getting it
to work.

I'm on Ubuntu 0.13 raring 64-bit. The aptitude repository didn't seem to
have the 2013.06 version. Thus, I installed it from the following:


> wget https://openscad.googlecode.com/files/openscad-2013.06.x86-64.tar.gz
> tar xvzf openscad-2013.06.x86-64.tar.gz
> sudo /home/ubuntu/tmp/openscad-2013.06/install.sh

Then I installed all the library dependencies I saw when I ran


> aptitude show openscad

Hence, I can run `openscad -v` successfully

However, when I try to run openscad to convert to an image:


> $ openscad -o simchange.png simchange.scad
> Compiling design (CSG Products normalization)...
> Normalized CSG tree has 6 elements
> Unable to open a connection to the X server
> Can't create OpenGL OffscreenView. Code: -1.

So obviously, the machine can't use OpenGL because there is no graphics
installed. So I figured xvfb would be useful for this. So after installing
xvfb, and running it:


> LIBGL_DEBUG=verbose xvfb-run openscad -o simchange.png simchange.scad
> Compiling design (CSG Products normalization)...
> Normalized CSG tree has 6 elements
> libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
> libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
> libGL error: failed to load driver: swrast
> glXChooseFBConfig failed
> Can't create OpenGL OffscreenView. Code: -1.

It seems like it can't find the correct swrast_dri (software raster
driver?). However, I do have the file:

> $ ls -l /usr/lib/x86_64-linux-gnu/dri
> total 5228
> -rw-r--r-- 1 root root  365640 Jun 18 19:59 i915_dri.so
> -rw-r--r-- 1 root root  794904 Jun 18 19:59 i965_dri.so
> -rw-r--r-- 1 root root 1343744 Jun 18 19:59 nouveau_dri.so
> -rw-r--r-- 1 root root  183384 Jun 18 19:59 nouveau_vieux_dri.so
> -rw-r--r-- 1 root root  330216 Jun 18 19:59 r200_dri.so
> -rw-r--r-- 1 root root  494008 Jun 18 19:59 r300_dri.so
> -rw-r--r-- 1 root root  475928 Jun 18 19:59 r600_dri.so
> -rw-r--r-- 1 root root  297264 Jun 18 19:59 radeon_dri.so
> -rw-r--r-- 1 root root  270872 Jun 18 19:59 radeonsi_dri.so
*
> -rw-r--r-- 1 root root  448872 Jun 18 19:59 swrast_dri.so
*
> -rw-r--r-- 1 root root  321856 Jun 18 19:59 vmwgfx_dri.so

So now, I'm at a loss as to how to go about solving it. Googling didn't much
help, as well as searching on this forum, so I figured i'd come and ask you
guys. Any hint would be helpful. thanks!



--
View this message in context: http://forum.openscad.org/Headless-OpenSCAD-tp5187.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

iamwil
Thanks Don!

That seemed to have worked! Thanks, and I appreciate the help. I had tried something similar before, but it seemed to have the same issue as when I was running Xvfb, so I wasn't sure what I was doing wrong. The difference seems to be in :5, which I'm not sure if it refers to something specific.

But cool, I'm excited this works now.

Wil
Cubehero: Work with others on 3D printable projects
https://cubehero.com
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

donbright
Thanks for testing it out Wil. :5 is the X Display number. Running Xvfb is a whole topic all on it's own and all sorts of things can go wrong.

I would love to see what you are doing with the off-screen commandline renders.

-DB





On Tue, Jul 23, 2013 at 11:55 AM, iamwil <[hidden email]> wrote:
Thanks Don!

That seemed to have worked! Thanks, and I appreciate the help. I had tried
something similar before, but it seemed to have the same issue as when I was
running Xvfb, so I wasn't sure what I was doing wrong. The difference seems
to be in :5, which I'm not sure if it refers to something specific.

But cool, I'm excited this works now.

Wil



--
View this message in context: http://forum.openscad.org/Headless-OpenSCAD-tp5187p5238.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

kintel
Administrator
On 2013-07-24, at 1:05 AM, Don Bright <[hidden email]> wrote:
>
> I would love to see what you are doing with the off-screen commandline renders.
>
AFAIK, wil is running cubehero.com - I'm also curious :)

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

Bryan Bishop
In reply to this post by donbright
On Fri, Jul 19, 2013 at 11:52 AM, Don Bright <[hidden email]> wrote:
xvfb-run apparently doesnt work right on ubuntu 13

You can use xserver-xorg-video-dummy with X if you want to try something else.

- Bryan
http://heybryan.org/
1 512 203 0507
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

Bryan Bishop
In reply to this post by kintel
On Tue, Jul 23, 2013 at 7:04 PM, Marius Kintel <[hidden email]> wrote:
> > I would love to see what you are doing with the off-screen commandline
> > renders.
> >
> AFAIK, wil is running cubehero.com - I'm also curious :)

My guess is stl2pov, just like everyone else since thingiverse. For
non-stl renders, there are very few options for off-screen rendering.
OpenCASCADE maybe. BRL-CAD definitely. And then povray... but the
downside is you have to convert to STL first, and who wants that?

- Bryan
http://heybryan.org/
1 512 203 0507
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Headless OpenSCAD

iamwil
Marius Kintel wrote
> > I would love to see what you are doing with the off-screen commandline
> > renders.
> >
AFAIK, wil is running cubehero.com - I'm also curious :)
With Cubehero, one of my goals is to make common open visual files easier to see in the browser after they're uploaded, since the format isn't supported natively by the browser. It makes the problem of documentation of your projects easier.

Being able to see SCAD files on Cubehero is a plus. I had tried to do it a couple months ago by exporting to STL, then converting the STL to PNG. But that process (with CGAL, I'm guessing) takes too long, and time out my background workers. Didn't make much sense, since OpenSCAD is an image-based CSG, but I had no other recourse. Hence, I was excited to learn that the new OpenSCAD can export to image.

Bryan Bishop wrote
My guess is stl2pov, just like everyone else since thingiverse. For
non-stl renders, there are very few options for off-screen rendering.
OpenCASCADE maybe. BRL-CAD definitely. And then povray... but the
downside is you have to convert to STL first, and who wants that?
Actually, I don't use stl2pov. I found out how pov files are formatted, and instead of having a C dependency on my node.js stack, I wrote a coffeescript/javascript lib that converts STLs to PNGs.

Do a lot of people use BRL-CAD? I hadn't seen much evidence of its use.
Cubehero: Work with others on 3D printable projects
https://cubehero.com