Skip to main content
Topic: 3D Gerber Viewer (Read 103411 times) previous topic - next topic

3D Gerber Viewer

Over the course of the last 5 months I developped an application to visualize Gerber data. The goal was primarily to review Gerber files before sending them to a PCB fabrication house. It is very similar to the Mayhew Labs online Gerber viewer, except it's offline (and has a few different features).

My tool is program for Windows (32bits or 64bits) that use OpenGL for visualization (you will need a decent/recent video card). You can simply drag and drop Gerber files on it, or use the command line to configure it more deeply. I set up a page explaining most of that and giving download links :

http://http://piratery.net/grbv/

I wrote the tool primarily for my own usage. In particular I wanted to visualize milling data to validate my PCB panelization scripts (which are still work in progress). However it may be useful to other people so I took some time to package it. Everything is open source, steal whatever you want for your own projects.

Please feel free to report bugs and request new features, I'm eager to improve that tool if that can help the community. Note that there is a high chance that the tool cannot display anything on your hardware, but it should report an error and I'd be very grateful if you would report it to me.

As a teaser here is an example screenshot of one of my boards. More are available on the webpage linked above.



I hope you like it :-D

Re: 3D Gerber Viewer

Reply #1
I'm sure it's very nice - if I could get it running :-)

Running grbv-20130804T1626-64bits on a Win7/64 results in the following:

[attachment=0]

Re: 3D Gerber Viewer

Reply #2
Hi matseng, thanks for trying.

Unfortunately the problem seems to be related to the lack of OpenGL 4.x support on your computer. I didn't find an easy way to disable OpenGL 4.x on mine, so I have to fix the problem blindly, which is never easy.

Would you have some time for a short debug session through IRC or some instant messaging system? I would send you alternative code to try out.

Re: 3D Gerber Viewer

Reply #3
I don't know how much you care but I had a go at running the 32-bit grbv.exe in a vanilla install of  wine 1.4.1 on 32-bit Debian Linux and this was the output:

Code: [Select]
wine: Call from 0x7bc4cdf0 to unimplemented function KERNEL32.dll.LCMapStringEx, aborting
err:module:attach_process_dlls "MSVCR110.dll" failed to initialize, aborting
err:module:LdrInitializeThunk Main exe initialization for L"Z:\tmp\Downloads\Gerber Viewer\grbv.exe" failed, status 80000100

I had a brief look and it might have something to do  with .NET but that's as far as I got.

How Windows specific is this program, how hard would it be to port?

Re: 3D Gerber Viewer

Reply #4
Well, most of it is written in Lua or relatively portable C code. However I use the win32 API (or thin wrappers for Lua) for all the window creation and user input. I tried to modularize cleanly, so most of it is in gui.lua and render.lua. So the biggest task to run the application on Linux would be to rewrite these two modules, port the OpenGL binding module I wrote so that it compiles on Linux, and recompile every other modules and their dependencies. The main event loop is using a Lua module that I already ported to Linux.

All in all this is doable, but I haven't used a Linux desktop computer for years, and don't plan to in the near future, so I won't be the one doing it just because I cannot run a Linux OpenGL program. That being said I'd be glad to help anyone wanting to give it a try. I use Linux daily through the command line on headless machines so I can help with compilation at the very least.

As for running the app on Wine, maybe I can give some explanation on your problem. I recently switched to Visual Studio 2012 Express (ie. VC++ 11.0) for my compilation, and the new VC runtime (the MSVCR110.dll in your logs) depends on kernel features introduced in Windows Vista. The LCMapStringEx function (still in your logs) seems to be one of these features. That's why my Windows version requires at least Vista. I don't know Wine well enough, but maybe it's starting in some "XP mode" and you can configure it in "Vista mode" or "7 mode" instead.

If you want to have a deeper look, the sources are on BitBucket: https://bitbucket.org/doub/mechanicus

Re: 3D Gerber Viewer

Reply #5
Can't get it running on Vista 32 SP1 on Core 2 Duo, 4GB and Nvidia G-Force 9650M GT 1GB

Re: 3D Gerber Viewer

Reply #6
@matseng: I uploaded an updated version which should fix your problem (but may uncover others). Here are links to the update:
@Sleepwalker3: Thanks for the report. I think it's a Vista-specific bug. I have an idea on how to fix it, I'll give it a try and post an update. Unfortunately I don't have a Windows Vista machine to test it.

Re: 3D Gerber Viewer

Reply #7
Tried the new 64-bit version.  Got this:
Code: [Select]
C:UsersMatsDesktopGerber Viewer>grbv.com
OpenGL version: 3.1
GLSL compilation error:
        ERROR: 3:54: 'inverse' : no matching overloaded function found (using implicit conversion)

GLSL compilation error:
        ERROR: 3:35: 'inverse' : no matching overloaded function found (using implicit conversion)

grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:91: ...rs
MatsDesktopGerber Viewerlua5.2enginedisplay.lua:1139: attempt to index field 'uniforms' (a nil value)
stack traceback:
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:1139: in function 'draw_scene'
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:1236: in function 'render_scene'
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:1665: in function <...rsMatsDesktopGerber Viewerlua5.2engi
nedisplay.lua:1529>
        [C]: in function 'xpcall'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:86: in function 'display'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...ersMatsDesktopGerber Viewerlua5.2engi
nerender.lua:100>
        (...tail calls...)
stack traceback:
        [C]: in function 'error'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:91: in function 'display'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...ersMatsDesktopGerber Viewerlua5.2engi
nerender.lua:100>
stack traceback:
        [C]: in function 'GetExitCodeThread'
        C:UsersMatsDesktopGerber Viewerlua5.2enginegui.lua:403: in function <C:UsersMatsDesktopGerber Viewerlua5.2eng
inegui.lua:401>
stack traceback:
        [C]: in function 'error'
        C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: in function 'resume'
        C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:244: in function 'run'
        C:UsersMatsDesktopGerber Viewergrbv.lua:662: in main chunk
        [C]: in ?

C:UsersMatsDesktopGerber Viewer>

Re: 3D Gerber Viewer

Reply #8
@matseng: Here is another update that should fix that last issue:
  - grbv-20130805T1857-64bits.zip

Re: 3D Gerber Viewer

Reply #9
[quote author="doub"]
@Sleepwalker3: Thanks for the report. I think it's a Vista-specific bug. I have an idea on how to fix it, I'll give it a try and post an update. Unfortunately I don't have a Windows Vista machine to test it.[/quote]

Happy to try out new versions nd report back when I have time.

Re: 3D Gerber Viewer

Reply #10
Update with T1714, seems I'm missing a DLL?

Re: 3D Gerber Viewer

Reply #11
It's the same problem as before, only appearing differently because of the code changes. It's because one of the libraries depends on stuff that come with Windows 7, here DirectX11, in your previous report some other Windows 7 feature. This is something I can work around, but it may take some time.

Re: 3D Gerber Viewer

Reply #12
@Sleepwalker3: I just uploaded a version where I tried to slash as many unneeded dependencies as I could regarding win32 APIs. It should work better on Vista. Here are the links:
  - [s:]grbv-20130806T0015-32bits.zip[/s:]
  - [s:]grbv-20130806T0015-64bits.zip[/s:]

Edit: I've removed one more unnecessary dependency (thanks to Jason Pollard for the report) and rebuilt a package:
  - grbv-20130806T0302-32bits.zip
  - grbv-20130806T0302-64bits.zip

Re: 3D Gerber Viewer

Reply #13
Still not working on a Windows 7 64 bits machine.

Re: 3D Gerber Viewer

Reply #14
Hey, on Windows 7 x64 I get
Code: [Select]
OpenGL:
        renderer: Intel(R) HD Graphics 2000
        version: 3.1 (3.1.0 - Build 9.17.10.3062)
        GLSL: 1.4 (1.40 - Intel Build 9.17.10.3062)
grbv: ...rsStevenRichardsonDesktopGerber Viewerlua5.2nb.lua:149:
  ...chardsonDesktopGerber Viewerlua5.2enginerender.lua:72:
  ...sonDesktopGerber Viewerlua5.2enginedisplayfbo.lua:74: incomplete framebuffer (FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT)
stack traceback:
        [C]: in function 'error'
        ...sonDesktopGerber Viewerlua5.2enginedisplayfbo.lua:74: in function 'new'
        ...hardsonDesktopGerber Viewerlua5.2enginedisplay.lua:324: in main chunk
        [C]: in function 'xpcall'
        ...chardsonDesktopGerber Viewerlua5.2enginerender.lua:67: in function 'display'
        ...chardsonDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...chardsonDesktopGerber Viewerlua5.2enginerender.lua:100>
        (...tail calls...)
stack traceback:
        [C]: in function 'error'
        ...chardsonDesktopGerber Viewerlua5.2enginerender.lua:72: in function 'display'
        ...chardsonDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...chardsonDesktopGerber Viewerlua5.2enginerender.lua:100>
stack traceback:
        [C]: in function 'GetExitCodeThread'
        ...nRichardsonDesktopGerber Viewerlua5.2enginegui.lua:406: in function <...nRichardsonDesktopGerber Viewerlua5.2enginegui.lua:404>
stack traceback:
        [C]: in function 'error'
        ...rsStevenRichardsonDesktopGerber Viewerlua5.2nb.lua:149: in function 'resume'
        ...rsStevenRichardsonDesktopGerber Viewerlua5.2nb.lua:244: in function 'run'
        C:UsersStevenRichardsonDesktopGerber Viewergrbv.lua:662: in main chunk
        [C]: in ?