Dangerous Prototypes

General Category => Tools of the trade => Topic started by: doub on August 04, 2013, 09:54:36 pm

Title: 3D Gerber Viewer
Post by: doub on August 04, 2013, 09:54:36 pm
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.

(http://http://piratery.net/temp/grbv-teaser.png)

I hope you like it :-D
Title: Re: 3D Gerber Viewer
Post by: matseng on August 05, 2013, 10:41:54 am
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]
Title: Re: 3D Gerber Viewer
Post by: doub on August 05, 2013, 03:34:17 pm
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.
Title: Re: 3D Gerber Viewer
Post by: kasbah on August 05, 2013, 05:27:02 pm
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 (http://http://www.winehq.org/about/) 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?
Title: Re: 3D Gerber Viewer
Post by: doub on August 05, 2013, 05:51:41 pm
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 (http://https://bitbucket.org/doub/glua) so that it compiles on Linux, and recompile every other modules and their dependencies. The main event loop is using a Lua module (http://https://bitbucket.org/doub/nb2) 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 (http://http://msdn.microsoft.com/en-us/library/dd318702.aspx) 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 (https://bitbucket.org/doub/mechanicus)
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 05, 2013, 06:10:43 pm
Can't get it running on Vista 32 SP1 on Core 2 Duo, 4GB and Nvidia G-Force 9650M GT 1GB
Title: Re: 3D Gerber Viewer
Post by: doub on August 05, 2013, 06:28:29 pm
@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.
Title: Re: 3D Gerber Viewer
Post by: matseng on August 05, 2013, 06:35:04 pm
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>
Title: Re: 3D Gerber Viewer
Post by: doub on August 05, 2013, 08:12:20 pm
@matseng: Here is another update that should fix that last issue:
  - grbv-20130805T1857-64bits.zip (http://http://piratery.net/grbv/downloads/grbv-20130805T1857-64bits.zip)
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 05, 2013, 08:28:41 pm
[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.
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 05, 2013, 08:36:34 pm
Update with T1714, seems I'm missing a DLL?
Title: Re: 3D Gerber Viewer
Post by: doub on August 05, 2013, 09:59:18 pm
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.
Title: Re: 3D Gerber Viewer
Post by: doub on August 06, 2013, 01:27:16 am
@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 (http://http://piratery.net/grbv/downloads/grbv-20130806T0015-32bits.zip)[/s:]
  - [s:]grbv-20130806T0015-64bits.zip (http://http://piratery.net/grbv/downloads/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 (http://http://piratery.net/grbv/downloads/grbv-20130806T0302-32bits.zip)
  - grbv-20130806T0302-64bits.zip (http://http://piratery.net/grbv/downloads/grbv-20130806T0302-64bits.zip)
Title: Re: 3D Gerber Viewer
Post by: Stuff4Pi on August 06, 2013, 05:46:59 am
Still not working on a Windows 7 64 bits machine.
Title: Re: 3D Gerber Viewer
Post by: veryevil on August 06, 2013, 10:30:52 am
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 ?
Title: Re: 3D Gerber Viewer
Post by: Squonk on August 06, 2013, 11:51:00 am
On my old faithful 32 bit XP SP3 with the latest zip, I get a "C:Gerber Viewergrbv.exe is not a valid Win32 application." error box and nothing more.
Title: Re: 3D Gerber Viewer
Post by: doub on August 06, 2013, 04:44:50 pm
@Stuff4Pi: I'd be happy to have a look at your problem if you give me more detais.

@veryevil: I'm not sure I know how to fix this. Below is an attempt. In addition to downloading this version, you need to create a file named display.conf at the root, and in it write "use_distance_buffer = false" without the quotes.
  - grbv-20130806T1506-32bits.zip (http://http://piratery.net/grbv/downloads/grbv-20130806T1506-32bits.zip)
  - grbv-20130806T1506-64bits.zip (http://http://piratery.net/grbv/downloads/grbv-20130806T1506-64bits.zip)

@Squonk: Unfortunately my compiler generates binaries that won't run on XP. To resolve that I'd have to change my build setup to use an older compiler, but I cannot do that right now.
Title: Re: 3D Gerber Viewer
Post by: Stuff4Pi on August 06, 2013, 05:16:23 pm
Here the error message with grbv-20130806T0302-64bits:
http://www.dropbox.com/s/bgzyvj7qonmnfvr/Capture.PNG (http://www.dropbox.com/s/bgzyvj7qonmnfvr/Capture.PNG)
Title: Re: 3D Gerber Viewer
Post by: doub on August 06, 2013, 06:28:35 pm
@Stuff4Pi: I think this is a bug in the GLSL compiler of your OpenGL driver. Can you look at the file "Gerber Viewershadersentity_textured.glsl" in a text editor (Notepad for example), locate the following line:
Code: [Select]
	vec4 color = HasColorTexture ? texture(ColorTexture, ex_Color.xy) : vec4(ex_Color, 1);
and replace it with:
Code: [Select]
	vec4 color;
if (HasColorTexture)
color = texture(ColorTexture, ex_Color.xy);
else
vec4(ex_Color, 1);
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 07, 2013, 10:00:06 am
With version grbv-20130807T0012-32bits.zip, still on the Vista 32 machine
Title: Re: 3D Gerber Viewer
Post by: veryevil on August 07, 2013, 10:09:38 am
Hey, thanks for looking! Now I seem to get this with or without the display.conf file

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:325: 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 ?
Title: Re: 3D Gerber Viewer
Post by: doub on August 07, 2013, 04:24:23 pm
@Sleepwalker3: I fixed that particular error (the first screenshot). Assuming the second screenshot pops up just after the first (or behind), the version tagged 20130807T1521 should get you further.

@veryevil: I'm a bit disappointed the display.conf workaround doesn't work, but I have another user in exactly the same situation as you. I have to study further the possible causes of the error, I'm out of ideas right now.
Title: Re: 3D Gerber Viewer
Post by: doub on August 08, 2013, 05:03:54 am
@veryevil: I just uploaded a new version (tagged 20130808T0401) that should fix that very same issue on ATI/AMD hardware, so hopefully it will also fix it on your Intel hardware.
Title: Re: 3D Gerber Viewer
Post by: matseng on August 08, 2013, 05:23:54 am
Still no joy on Win7/64 with the 0401 release.

Code: [Select]
C:UsersMatsDesktopGerber Viewer>grbv.com
OpenGL:
        vendor: Intel
        renderer: Intel(R) HD Graphics Family
        version: 3.1 (3.1.0 - Build 8.15.10.2462)
        GLSL: 1.4 (1.40  - Intel Build 8.15.10.2462)
grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:72: ...De
sktopGerber Viewerlua5.2enginedisplayshader.lua:72: GLSL compilation error:
        while compiling ./shadersentity_textured.glsl:
        ERROR: 3:55: 'inverse' : no matching overloaded function found (using implicit conversion)
stack traceback:
        [C]: in function 'error'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:72: in function 'compile'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:179: in function 'load'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:227: in function 'new'
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:233: in main chunk
        [C]: in function 'xpcall'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:67: 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:72: 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:421: in function <C:UsersMatsDesktopGerber Viewerlua5.2eng
inegui.lua:419>
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:670: in main chunk
        [C]: in ?
Title: Re: 3D Gerber Viewer
Post by: matseng on August 08, 2013, 05:33:01 am
I could upgrade to a OpenGL version newer than the 3.1, but it might be "betterer" if you found a solution to your software instead.  I'm sure there's many like me that doesn't play games and haven't bothered to upgrade to 4.x.
Title: Re: 3D Gerber Viewer
Post by: veryevil on August 08, 2013, 08:51:25 am
Hey, thanks again. Think it got a little further!

Was FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT now FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT

Code: [Select]
OpenGL:
        vendor: Intel
        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:90:
incomplete framebuffer (FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT)
stack traceback:
        [C]: in function 'error'
        ...sonDesktopGerber Viewerlua5.2enginedisplayfbo.lua:90: in function 'new'
        ...hardsonDesktopGerber Viewerlua5.2enginedisplay.lua:325: 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:421: in function
<...nRichardsonDesktopGerber Viewerlua5.2enginegui.lua:419>
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:670: in main chunk
        [C]: in ?
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 08, 2013, 04:16:15 pm
Hi Doub,
Yes that was two screenshots, the second was up after I closed the first one.
Tried again with grbv-20130808T0401-32bits.zip and have the following error. Thanks for your efforts with this, I don't need it myself, I already have a suitable setup, but I figure it may be useful sometime and others can benefit from it, so I'll try to help out :)
Again this is Vista Ultimate 32. If it's possible, it would be handy if it came up with the version number in the error message, would save a minute or two when posting these screenshots. Not sure how hard that would be for you.
Title: Re: 3D Gerber Viewer
Post by: doub on August 08, 2013, 07:05:58 pm
@all: The version number is actually a date and time in the form yyyymmddThhmm. At the moment it's OK to use only the last 4 digits, but as I build more versions it might get confusing so please report the whole tag.

@matseng: Can you create a file named display.conf in the tool directory, and write the following line in it?
Code: [Select]
cast_shadows = false
I added some detection code, but it seems it's not enough. Tell me if it works like that, and please report the console output next time so I can see what previse OpenGL version you have. I'm targeting 3.x to reach a wide audience, so you don't need to upgrade your drivers.

@veryevil: Thanks for the report, I'll study that further. It's a bit surprising, but I have an idea where to look at.

@Sleepwalker3: Thanks for giving me your time, especially if you don't plan to use it (but I'm sure once you see it working it'll win your heart :D). Can you try to create a file named grbv.conf in the tool directory, and write the following line in it?
Code: [Select]
translucent = false
Alternatively try the version I released this afternoon, which fixes this problem (ie. turn off translucency automatically when it's not available).

I'll look into how to display the version number, but note that to save time, instead of taking screenshots, when the error popup is displayed you can simply press Ctrl-C to copy the text into the clipboard and then paste it on the forum (this is a "hidden" Windows feature that works in many popup dialogs in various apps).
Title: Re: 3D Gerber Viewer
Post by: matseng on August 08, 2013, 08:00:57 pm
Trying grbv-20130808T1529-64bits.zip with a display.conf added containing cast_shadows = false
Code: [Select]
C:UsersMatsDesktop>cd "Gerber Viewer"

C:UsersMatsDesktopGerber Viewer>grbv.com
OpenGL:
        vendor: Intel
        renderer: Intel(R) HD Graphics Family
        version: 3.1 (3.1.0 - Build 8.15.10.2462)
        GLSL: 1.4 (1.40  - Intel Build 8.15.10.2462)
grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:72: ...De
sktopGerber Viewerlua5.2enginedisplayshader.lua:72: GLSL compilation error:
        while compiling ./shaderssky.glsl:
        ERROR: 3:35: 'inverse' : no matching overloaded function found (using implicit conversion)
stack traceback:
        [C]: in function 'error'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:72: in function 'compile'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:179: in function 'load'
        ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:227: in function 'new'
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:262: in main chunk
        [C]: in function 'xpcall'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:67: 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:72: 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:424: in function <C:UsersMatsDesktopGerber Viewerlua5.2eng
inegui.lua:422>
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:670: in main chunk
        [C]: in ?

C:UsersMatsDesktopGerber Viewer>

Here's a report for my OpenGL
Code: [Select]

Renderer: Intel(R) HD Graphics Family
Vendor: Intel
Memory: 1812 MB
Version: 3.1.0 - Build 8.15.10.2462
Shading language version: 1.40  - Intel Build 8.15.10.2462


Max texture size: 8192 x 8192
Max vertex texture image units: 16
Max texture image units: 16
Max geometry texture units: 0
Max anisotropic filtering value: 16
Max viewport size: 8192 x 8192
Max Clip Distances: 6
Max samples: 4


Extensions: 116

GL_3DFX_texture_compression_FXT1
GL_ARB_color_buffer_float
GL_ARB_compatibility
GL_ARB_copy_buffer
GL_ARB_depth_buffer_float
GL_ARB_depth_clamp
GL_ARB_depth_texture
GL_ARB_draw_buffers
GL_ARB_draw_elements_base_vertex
GL_ARB_draw_instanced
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_program
GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader
GL_ARB_framebuffer_object
GL_ARB_framebuffer_sRGB
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_map_buffer_range
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_sampler_objects
GL_ARB_seamless_cube_map
GL_ARB_shader_objects
GL_ARB_shading_language_100
GL_ARB_shadow
GL_ARB_sync
GL_ARB_texture_border_clamp
GL_ARB_texture_compression
GL_ARB_texture_compression_rgtc
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_float
GL_ARB_texture_non_power_of_two
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_transpose_matrix
GL_ARB_uniform_buffer_object
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_window_pos
GL_ATI_separate_stencil
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_clip_volume_hint
GL_EXT_compiled_vertex_array
GL_EXT_draw_buffers2
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXT_framebuffer_object
GL_EXT_gpu_program_parameters
GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil
GL_EXT_packed_float
GL_EXT_packed_pixels
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shadow_funcs
GL_EXT_stencil_two_side
GL_EXT_stencil_wrap
GL_EXT_texture3D
GL_EXT_texture_array
GL_EXT_texture_compression_s3tc
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_integer
GL_EXT_texture_lod_bias
GL_EXT_texture_rectangle
GL_EXT_texture_shared_exponent
GL_EXT_texture_snorm
GL_EXT_texture_sRGB
GL_EXT_texture_swizzle
GL_EXT_transform_feedback
GL_IBM_texture_mirrored_repeat
GL_INTEL_performance_queries
GL_NV_blend_square
GL_NV_conditional_render
GL_NV_primitive_restart
GL_NV_texgen_reflection
GL_SGIS_generate_mipmap
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_WIN_swap_hint
WGL_ARB_buffer_region
WGL_ARB_create_context
WGL_ARB_extensions_string
WGL_ARB_framebuffer_sRGB
WGL_ARB_make_current_read
WGL_ARB_multisample
WGL_ARB_pbuffer
WGL_ARB_pixel_format
WGL_ARB_pixel_format_float
WGL_EXT_depth_float
WGL_EXT_extensions_string
WGL_EXT_pixel_format_packed_float
WGL_EXT_swap_control

Core features
v3.0 (100 % - 23/23)
v3.1 (100 % - 8/8)
v3.2 (60 % - 6/10)
v3.3 (10 % - 1/10)
v4.0 (0 % - 0/14)
v4.1 (0 % - 0/7)
v4.2 (0 % - 0/12)
v4.3 (0 % - 0/18)

OpenGL driver version check (Current: 3.1.0 - Build 8.15.10.2462, Latest known: 8.15.10.2462):
Outdated version of display drivers detected
According the database, you are might be not using the latest version of display drivers for your video card.

No ICD registry entry
The current OpenGL driver doesn't expose the SOFTWARE/Microsoft/Windows (NT)/CurrentVersion/OpenGLDrivers registry entry. Unable to detect the driver version, driver revision name and filename.

Few texture units found
This may slow down some applications using fragment programs or extensive texture mapping.

Extension verification:
<truncated>


Title: Re: 3D Gerber Viewer
Post by: doub on August 08, 2013, 08:22:19 pm
@matseng: I just got a breakthrough in my understanding of the problem. Can you modify the line of display.lua that reads:
Code: [Select]
if glsl_version < 1.4 then
and replace the 1.4 with 1.5?
Title: Re: 3D Gerber Viewer
Post by: matseng on August 09, 2013, 05:16:54 am
After changing the 1.4 to 1.5 I can start the application.  That's one huge leap forward. :-)

The bottom of the window is showing a lot of flickering hash - see the attached screenshots.

And when I try to load some gerbers it crashes.

Code: [Select]
cannot guess type of file C:UsersMatsDocumentseagleCurrentLedgerLedger.pro
cannot guess type of file C:UsersMatsDocumentseagleCurrentLedgerLedger.gpi
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GML
outline found
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GBO
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GBL
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GBP
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GTS
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GBS
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GTL
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GTO
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GTP
generating outline
milling
tesselating top
rasterizing top_copper
grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1049: INVALID_FRAMEBUFFER_OPERATION_EXT
stack traceback:
        [C]: in function 'error'
        ...ersMatsDesktopGerber Viewerlua5.2glCheckError.lua:10: in function 'CheckError'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1049: in function 'render_image'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1493: in function 'generate_image'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1537: in function 'generate_images'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1743: in function 'gen_texture'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1829: in function 'gen_top_texture'
        C:UsersMatsDesktopGerber Viewergrbv.lua:340: in function 'load_board'
        C:UsersMatsDesktopGerber Viewergrbv.lua:622: in function 'reload'
        C:UsersMatsDesktopGerber Viewergrbv.lua:659: in function <C:UsersMatsDesktopGerber Viewergrbv.lua:657>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:670: in main chunk
        [C]: in ?
Title: Re: 3D Gerber Viewer
Post by: john932 on August 09, 2013, 09:35:07 am
[quote author="Stuff4Pi"]Still not working on a Windows 7 64 bits machine.[/quote]
I tried. It does not work on my Windows 7 64 bits machine, either.
Title: Re: 3D Gerber Viewer
Post by: doub on August 09, 2013, 08:59:49 pm
@matseng: Can you give me a link to the Gerber files that are not working? It can be in private if you prefer (you have my email address). The bottom flickering may be cause by some invalid out of bounds video memory access, but I've never seen that.

@john932: Can you copy and paste the error you get? Press Ctrl-C when the error popup is active, and then press Ctrl-V while writing a message on the forum (ideally within code tags).
Title: Re: 3D Gerber Viewer
Post by: doub on August 09, 2013, 10:30:53 pm
@veryevil: I just uploaded a new version (tagged 20130809T2109) that should fix your problem.
Title: Re: 3D Gerber Viewer
Post by: matseng on August 10, 2013, 02:33:25 am
It crashes as soon as I load any set of gerber files.... I attach one set to this post.
[attachment=0]
Code: [Select]
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:UsersMats>cd Desktop

C:UsersMatsDesktop>cd "Gerber Viewer"

C:UsersMatsDesktopGerber Viewer>grbv.com
OpenGL:
        vendor: Intel
        renderer: Intel(R) HD Graphics Family
        version: 3.1 (3.1.0 - Build 8.15.10.2462)
        GLSL: 1.4 (1.40  - Intel Build 8.15.10.2462)
cannot guess type of file C:UsersMatsDocumentseagleCurrentLedgerLedger.gpi
cannot guess type of file C:UsersMatsDocumentseagleCurrentLedgerLedger.dri
loading top mesh from cache
rasterizing bottom_copper
loading C:UsersMatsDocumentseagleCurrentLedgerLedger.GBL
grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1049: INVALID_F
RAMEBUFFER_OPERATION_EXT
stack traceback:
        [C]: in function 'error'
        ...ersMatsDesktopGerber Viewerlua5.2glCheckError.lua:10: in function 'CheckError'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1049: in function 'render_image'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1493: in function 'generate_image'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1537: in function 'generate_images'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1743: in function 'gen_texture'
        C:UsersMatsDesktopGerber Viewerlua5.2boards.lua:1829: in function 'gen_top_texture'
        C:UsersMatsDesktopGerber Viewergrbv.lua:340: in function 'load_board'
        C:UsersMatsDesktopGerber Viewergrbv.lua:622: in function 'reload'
        C:UsersMatsDesktopGerber Viewergrbv.lua:659: in function <C:UsersMatsDesktopGerber Viewergrbv.lua:657>
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:670: in main chunk
        [C]: in ?

C:UsersMatsDesktopGerber Viewer>
Title: Re: 3D Gerber Viewer
Post by: ferdinandk on August 10, 2013, 11:26:23 pm
I got it to run on my desktop PC (AMD CPU with integrated graphics), but it is quite slow. However on my four years old notebook I can't get it to work. The error message I get has stayed the same for the last revisions:

Code: [Select]
---------------------------
Gerber viewer
---------------------------
C:UsersferdinandDesktopGerber Viewerlua5.2nb.lua:149: ...erdinandDesktopGerber Viewerlua5.2enginerender.lua:72: ...DesktopGerber Viewerlua5.2enginedisplayshader.lua:72: GLSL compilation error:
while compiling ./shadersentity_textured.glsl:
ERROR: 3:69: 'texture' : no matching overloaded function found (using implicit conversion)
ERROR: 3:69: '=' :  cannot convert from 'const float' to '4-component vector of float'

stack traceback:
[C]: in function 'error'
...DesktopGerber Viewerlua5.2enginedisplayshader.lua:72: in function 'compile'
...DesktopGerber Viewerlua5.2enginedisplayshader.lua:179: in function 'load'
...DesktopGerber Viewerlua5.2enginedisplayshader.lua:227: in function 'new'
...rdinandDesktopGerber Viewerlua5.2enginedisplay.lua:233: in main chunk
[C]: in function 'xpcall'
...erdinandDesktopGerber Viewerlua5.2enginerender.lua:67: in function 'display'
...erdinandDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...erdinandDesktopGerber Viewerlua5.2enginerender.lua:100>
(...tail calls...)
stack traceback:
[C]: in function 'error'
...erdinandDesktopGerber Viewerlua5.2enginerender.lua:72: in function 'display'
...erdinandDesktopGerber Viewerlua5.2enginerender.lua:125: in function <...erdinandDesktopGerber Viewerlua5.2enginerender.lua:100>
stack traceback:
[C]: in function 'GetExitCodeThread'
...sferdinandDesktopGerber Viewerlua5.2enginegui.lua:424: in function <...sferdinandDesktopGerber Viewerlua5.2enginegui.lua:422>
stack traceback:
[C]: in function 'error'
C:UsersferdinandDesktopGerber Viewerlua5.2nb.lua:149: in function 'resume'
C:UsersferdinandDesktopGerber Viewerlua5.2nb.lua:244: in function 'run'
C:UsersferdinandDesktopGerber Viewergrbv.lua:670: in main chunk
[C]: in ?
---------------------------
OK 
---------------------------

Running it on the command line reveals that my GPU only supports GLSL 1.2 - that might be part of the problem.
Title: Re: 3D Gerber Viewer
Post by: doub on August 11, 2013, 10:08:21 pm
@matseng: Your Gerber files work just fine here, so it's probably a problem related to OpenGL hardware and drivers capabilities. I've just uploaded a new version (tagged 20130811T2036) which adds a check just before the error you get, and which may give me a more relevant feedback. Unfortunately I don't understand what the problem is yet, so I don't know what to fix.

@ferdinandk: GLSL 1.2 comes with OpenGL 2.1, which is rather old and lacks many feature that I may have used (sometimes inadvertently). Targeting such a platform would require extensive changes, and may be easier to do with a separate renderer. I don't have time for that at the moment, but it's all in Lua if someone is willing to give it a try. The two main pieces are the Gerber files rasterization (in boards.lua) and the rendering loop (in display.lua). These two files could be rewritten using only OpenGL 2.x APIs and GLSL 1.2 shaders. I can give a lot of explanations and some help if needed.

As for the slowness on your desktop PC, can you be more precise? Is the loading too long? Is the framerate low once loaded? Is the mouse manipulation of the board unresponsive?
Title: Re: 3D Gerber Viewer
Post by: ferdinandk on August 12, 2013, 11:44:26 am
I know, I know my notebook's hardware is quite dated. This is the most up-to-date driver Intel released, so I'm stuck. My Lua knowledge is minimal and I've never worked with OpenGL, but maybe I will give it try.
On my desktop machine (using version grbv-20130808T2148-64bits.zip) grbv completely blocks one of two cores (100% CPU load). So everything get rather unresponsive :) Trying the most current version (grbv-20130811T2036-64bits.zip) it even utilizes both cores to their fullest.
Title: Re: 3D Gerber Viewer
Post by: doub on August 13, 2013, 02:04:04 am
I have a similar GPU on my laptop, I tried a couple time to port the renderer so that it runs there, but there is so much missing that I gave up (twice).

Can you create a display.conf file with:
Code: [Select]
display_stats = true
wait for the graph to loop and discard loading spikes, and then take a screenshot?

Then create a render.conf file with
Code: [Select]
vsync = true
restart, wait for another graph loop, and take a second screenshot.
Title: Re: 3D Gerber Viewer
Post by: ferdinandk on August 13, 2013, 10:38:25 am
I just tried the settings on my desktop PC and took the following screenshots. I hope that helps.
Title: Re: 3D Gerber Viewer
Post by: matseng on August 13, 2013, 10:55:08 am
Nooooooo! :-)  The latest version, 20130811T2036-64bits.zip, is back to crashing on startup again.

Code: [Select]
C:UsersMatsDesktopGerber Viewer>grbv.com
OpenGL:
        vendor: Intel
        renderer: Intel(R) HD Graphics Family
        version: 3.1 (3.1.0 - Build 8.15.10.2462)
        GLSL: 1.4 (1.40  - Intel Build 8.15.10.2462)
grbv: C:UsersMatsDesktopGerber Viewerlua5.2nb.lua:149: ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:72: ...ats
DesktopGerber Viewerlua5.2enginedisplayfbo.lua:88: INVALID_ENUM
stack traceback:
        [C]: in function 'error'
        ...ersMatsDesktopGerber Viewerlua5.2glCheckError.lua:10: in function 'CheckError'
        ...atsDesktopGerber Viewerlua5.2enginedisplayfbo.lua:88: in function 'new'
        ...rsMatsDesktopGerber Viewerlua5.2enginedisplay.lua:312: in main chunk
        [C]: in function 'xpcall'
        ...ersMatsDesktopGerber Viewerlua5.2enginerender.lua:67: 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:72: 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:424: in function <C:UsersMatsDesktopGerber Viewerlua5.2eng
inegui.lua:422>
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:670: in main chunk
        [C]: in ?

C:UsersMatsDesktopGerber Viewer>
Title: Re: 3D Gerber Viewer
Post by: doub on August 14, 2013, 04:52:02 pm
I'm currently moving, and my desktop PC is still in a box, so I cannot do much at the moment.

@matseng: This is a surprising error. I'll see what I can do. Did you copy any .conf file you had in the previous version to this one?

@ferdinandk: Can you run the grbv.com version from a command line, and copy and paste the console output (it should tell me what kind of GPU you have)? In addition to that can you tell me what CPU you have, and how much CPU RAM and GPU RAM you have?
Title: Re: 3D Gerber Viewer
Post by: doub on August 19, 2013, 01:38:36 am
I've just released a new version, tagged 20130819T0027. There are only minor fixes, but it will show the actual release names (date-based) on the screenshots and (that's new) in the error popup title bar. So just pressing Ctrl-C and pasting the text here or in an email will include the version information (and CPU architecture).

@matseng: I had another user reporting the exact same problem as yours, I exchanged a few emails with him, and this version includes fixes that solve that problem. However he then has a rendering bug, which you may also get. Unfortunately if you do, I have almost no mean of debugging it since OpenGL reports that everything is fine.
Title: Re: 3D Gerber Viewer
Post by: doub on August 19, 2013, 11:44:00 pm
I just uploaded a new version that fixes a rendering bug that appeared as noise all over the window on Intel and AMD hardware. I also made some minor modifications that should help the program run on older/weaker hardware with no support for multisampling (which include for example some integrated GPU in modern Intel CPUs).
Title: Re: 3D Gerber Viewer
Post by: systemstech on August 20, 2013, 02:27:43 am
I tried earlier today this version and got this.

(http://http://farm4.staticflickr.com/3806/9551710668_3f277a27a8.jpg) (http://http://www.flickr.com/photos/79192364@N07/9551710668/)
error (http://http://www.flickr.com/photos/79192364@N07/9551710668/) by systems tech (http://http://www.flickr.com/people/79192364@N07/), on Flickr

Then just now tried the latest version and got this.

(http://http://farm4.staticflickr.com/3744/9548925765_90ba5606e2.jpg) (http://http://www.flickr.com/photos/79192364@N07/9548925765/)
Capture (http://http://www.flickr.com/photos/79192364@N07/9548925765/) by systems tech (http://http://www.flickr.com/people/79192364@N07/), on Flickr

(http://http://farm6.staticflickr.com/5497/9551745300_82ca5f7b68.jpg) (http://http://www.flickr.com/photos/79192364@N07/9551745300/)
win (http://http://www.flickr.com/photos/79192364@N07/9551745300/) by systems tech (http://http://www.flickr.com/people/79192364@N07/), on Flickr

(http://http://farm8.staticflickr.com/7315/9548956405_e15d9a0b1a.jpg) (http://http://www.flickr.com/photos/79192364@N07/9548956405/)
comp (http://http://www.flickr.com/photos/79192364@N07/9548956405/) by systems tech (http://http://www.flickr.com/people/79192364@N07/), on Flickr
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on August 20, 2013, 10:05:43 am
Still not working for me Vista 32, Core 2 Duo, 4MB, NVidia G-Force 9650M 1GB
Title: Re: 3D Gerber Viewer
Post by: doub on August 20, 2013, 11:02:04 am
@systemstech: There's a bug giving that error that I just fixed (in next version), but it likely happens because you tried to load an empty board (ie. it didn't recognize any file extension, or all recognized files are empty). Can you tell me if it works with one of the demo boards (double-click grbv.exe and press F6)?

@Sleepwalker3: Apparently your drivers don't support OpenGL 3.x, which is required for this tool. After a quick Internet search, it seems your hardware is capable of it, but you need to update your drivers.
Title: Re: 3D Gerber Viewer
Post by: matseng on August 20, 2013, 01:41:59 pm
Qapla'! (Klingon for "Absence of failure") 

The 20130820T0004 runs just fine on my computer now - no screen hash and no crashes.  But it is slow. I'd say that it takes about 3 times as long to load one of my gerbers and lags more when panning and rotating than the Mayhew Labs webgerber.
Title: Re: 3D Gerber Viewer
Post by: stryker on August 20, 2013, 02:35:21 pm
Hi & thanks for your work to date.

In 20130820T0004 x64 I'm getting it to load fine, and all the examples look great too.  Loading my own boards based on the sick-of-beige template, the radiused corners display square.  Loading the same files in the mayhew viewer also looks squared, until you check 'show outline' then the corners vanish and it looks like the mounting holes are not on the board (still not right, but a different issue).

Is this anomaly something local to my PC, a factor of a setting I should set another way, or just as it is?  Happy to grab some screen caps if this is news.

Thanks
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on August 20, 2013, 03:53:11 pm
@matseng: I'm glad that it finally works. Unfortunately the performance is something more difficult to diagnose. One thing you can try is edit the lua/5.2/grbv/boards.lua and look for two 4096, and replace them with a smaller power of two, like 1024 or 512. This will reduce video memory usage and may avoid some memory thrashing.

@stryker: The application should properly detect outline information and cut the board accordingly. If it's not, it's because my heuristics are incomplete. Can you please send me your board files? If you don't want them public send them by email directly to me (see the webpage for address).
Title: Re: 3D Gerber Viewer
Post by: 2thick4uni on August 31, 2013, 01:59:35 am
Absolutely awesome gerber viewer, great work!

Only one feature request - can it be made to work with 3Dconnexion Space navigator? Makes moving around the 3d world much easier than a mouse.....

Working well on my laptop under Win 7 64 with  i5-2540M CPU and Intel HD3000 grahics
Title: Re: 3D Gerber Viewer
Post by: doub on August 31, 2013, 03:55:09 pm
I'd be happy to support your input device, but without access to it it's very difficult (I'd be happy to be sponsored with one :D). I tried downloading the SDK but it seems to be requiring human validation so it could take a while.

Most of the input code is in Lua, so you can give it a try youself if it uses standard Windows input messaging.
Title: Re: 3D Gerber Viewer
Post by: 2thick4uni on August 31, 2013, 10:24:17 pm
Sadly I don't think I have the programming skill to get it up and running myself. Surprised that you don't use one, for anything 3D they are almost essential - I'd happily lend you mine to have a play with but unfortunately I've got a load of 3d drafting to do over the next few months so can't afford to be without it. You basically use it with the left hand and the mouse with right hand, it is a joystick that also rotates and moves up and down and is very easy and intuitive to use.

Lack of support for it won't stop me from using grbv, absolutely superb and even better now I've read the manual! Justfound the different skins available with the function keys :-)
Title: Re: 3D Gerber Viewer
Post by: doub on September 05, 2013, 02:36:03 am
I had a look at their SDK, and integration is not trivial (I need to link with their DLLs). So I'll probably not be able to implement it anytime soon.

I just released a new version with minor improvements in board outline detection (that should fix some ground plane border missing when it goes all around the board), and I added a new color scheme mechanism as a new feature. Have a look at the manual for more details, or simply look at the colors directory if you don't like reading documentation. The new version is tagged 20130905T0128.
Title: Re: 3D Gerber Viewer
Post by: doub on September 10, 2013, 03:10:22 am
I just released a new version, tagged 20130910T0203, which fixes a few Gerber parsing errors, and also contain the documentation in the ZIP. The main new feature is automatic error reporting when a Lua error happens, so you no longer have to take screenshots to report an error (see the doc for how to associate your name with the reports, or disable them).
Title: Re: 3D Gerber Viewer
Post by: honken on September 12, 2013, 10:41:06 pm
If run on a aws cuda node, Chris gammel is looking for a rest api. FYI.
Title: Re: 3D Gerber Viewer
Post by: doub on September 25, 2013, 01:10:23 pm
I just released a new version, tagged 20130925T1142. The main new feature is that it will merge Gerber paths at load time, which improves a lot outline detection. This should fix outline detection for Sick Of Beige based boards exported through EAGLE.

I also improved error reporting for OpenGL-related crashes, so if you have such problems please try the latest version.
Title: Re: 3D Gerber Viewer
Post by: matseng on September 25, 2013, 01:25:37 pm
Oh... Really nice. It got the outer outline of this board right, but failed on the internal cutouts.

It would be incredibly cool if during the compositing of copper, soldermask and silk you could remove silk that is on top of bare substrate or bare copper like the pcb fabs does.  It of course won't be true representation of the gerbers, but it would be truer to the actual pcb.

[attachment=0]
Title: Re: 3D Gerber Viewer
Post by: doub on September 25, 2013, 02:56:50 pm
Regarding the internal cuts, I have code handling that, but I didn't find a definitive universal way to define internal routing/milling/slots (I asked elsewhere on the forum and didn't get much answers). So far I'm looking at a .gml file (for "Gerber milling"), and anything drawn there will be milled out (if you draw with a line with a 2mm circular aperture, I assume it's a 2mm drill/mill bit taking matter out along that line). I'll have a look at your files and see if I can make the tool compatible with them. By the way, are they formated for a specific fab (so that I can name the profile/template if needs be)?

Regarding the silkscreen running over copper, I didn't mask it because A) some fabs don't mask it and will happily print over copper and B) it should be relatively easy to do the masking in a pre-processing step (between CAD export and visualization with grbv). However some fabs do the masking automatically so I'll see if I can add that as an option.

By the way I see that you don't have anti-aliasing, so I assume it's rendered with the "low-quality" code path (unless you tweaked your display.conf yourself). You might get better performance (if framerate is an issue) with similar quality by writing the following in a render.conf file:

Code: [Select]
renderer = 'simple'
Title: Re: 3D Gerber Viewer
Post by: matseng on September 25, 2013, 03:41:54 pm
From my limited experience with cutouts it seems like the fabs wants a cutout line with a 0 width (just like the outer outline) and then they will cut with a tools sized 0.8, 1.2, 1.5, or 1.6mm (Seeedstudio).  They are cutting "inside" the line so they don't remove any of the "real" pcb - this will of course leave artifacts in the 90 deg corners.  The size of the artifact will vary according to the toolsize.

My guess is that they use a larger tool if there are no acute angles.

For the time being I'd be happy to just have the parts inside the center (if non-0 width) of the cutouts removed. No need for emulating the cutting bit with for leaving the corner-artifacts.

The gerber is generated with the .cam-file from Smart-Prototyping.  I think that they are merging both the outline layer (Eagle 20) with the Milling layer (Eagle 46) into the same file.


I haven't found any tool to do the copper/silk masking in the gerbers. I'm sure there are tools for that but they probably only exists in some nice and expensive gerber editing packages.  A toggle option would be very cool to have.

A keystroke for toggling the board aligned flat front- and flat backside would also be very useful. It's so hard to flip the board to the backside keeping it aligned to get a straight screenshot.

The lack of anti-aliasing must be due to my old drivers, all the files are straight from the zip.  I'll try to change the .conf file and see what happens.
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on September 26, 2013, 08:04:26 am
A discrete 741 - Now that's different, haven't seen something like that in a very long time.
Title: Re: 3D Gerber Viewer
Post by: doub on September 26, 2013, 12:47:17 pm
A new version tagged 20130926T1023 has shortcuts to reset the board to front-facing and back-facing state. The default keys are HOME and END respectively. I introduced a bindings.conf file that let you change that, all the Fxx bindings (demo board and color selection), and let you add your own bindings (the set of available commands is very limited right now, see the sources).
Title: Re: 3D Gerber Viewer
Post by: matseng on September 26, 2013, 01:03:16 pm
Face Front/Back works perfectly.  Thanks.....
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on September 27, 2013, 01:49:38 am
OK, I've updated my Nvidia drivers to the very latest (310.90) and updated your program to the current one (20130926T2311) and now I can get your program up, though when the form fist comes up, only the frame of the form shows and then 13 seconds later, it finally shows the white background and the text saying to drag the gerber over.
I've tried various Gerbers including ones in the package, but even after 30 min, still no image. I've restarted, etc. Processor usage is high when this is running, around 60%-65% and the fan is going all the time when this program is running (quite noticable on my laptop). The program is also very unresponsive, if I move to it on the taskbar, it takes maybe 10 seconds before it shows up properly.

I haven't got the latest greatest laptop, but it's certainly no slug either, Asus Core 2 Duo T9400@2.53GHz, 4GB RAM, 1GB (dedicated) 2GB total, Nvidia GT9650M-GT, WXGA, etc. on Vista Ultimate.
Title: Re: 3D Gerber Viewer
Post by: doub on September 27, 2013, 11:32:35 am
You can try using the simplified renderer. Create a file named "render.conf" next to grbv.exe, and put the following in it:
Code: [Select]
renderer = 'simple'
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 04, 2013, 01:31:49 pm
Hello to everyone. I had 3 different pc. One is ok but on two I have this. What to do?
Title: Re: 3D Gerber Viewer
Post by: doub on October 04, 2013, 02:09:16 pm
Sorry about that, I uploaded broken versions. Please download the version tagged 20130926T2311. I'll re-package the app tonight with that problem fixed.
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 04, 2013, 04:22:59 pm
Thank you for your reply, now it starts but I have this.
Title: Re: 3D Gerber Viewer
Post by: doub on October 04, 2013, 05:21:56 pm
[Edited]

I received the automatic error reports, so I'll have a look and tell you if I can help.
Title: Re: 3D Gerber Viewer
Post by: doub on October 04, 2013, 10:43:08 pm
I just uploaded a new version that is likely to fix that problem. It's tagged 20131004T2136. It's a bit surprising nobody had the problem before.
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 05, 2013, 12:37:44 pm
Ok, thank you.I will try it monday
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 07, 2013, 08:38:50 am
Another error with this new version :-(
It happens dropping samples gerber files (Fio.* in this case)
Title: Re: 3D Gerber Viewer
Post by: doub on October 08, 2013, 01:52:55 am
I just uploaded a new version tagged 20131008T0045 that should fix this particular problem.
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 08, 2013, 08:06:42 am
Thank you. One PC is fixed, now it runs without problems. On second PC it says "Execution Error". It's a Win XP machine, does it needs some library, runtime or so?
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on October 08, 2013, 09:49:52 am
If you look on the first page of this thread you will see a few comments down...  "That's why my Windows version requires at least Vista.", so I'm guessing it won't run on XP.
Title: Re: 3D Gerber Viewer
Post by: MaxGItaly on October 08, 2013, 09:55:04 am
Thank you Sleepwalker, I miss that post.
Title: Re: 3D Gerber Viewer
Post by: doub on October 08, 2013, 11:05:55 am
It's also mentioned on the app webpage: http://piratery.net/grbv/ (http://piratery.net/grbv/)

It's only a matter of compiler, the one I use no longer supports XP. If another developper is willing to build versions working on XP I'd be happy to host them.
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on October 08, 2013, 11:37:47 am
Hi Doub,

I tried the details you gave above, making the file and adding the line. Didn't make any diff, still very slow for the Window to come up, fan goes on, Window is very very slow to update (if swapped or moved, will take perhaps 13 seconds to update). Dragging a Gerber (one of yours) onto it, still nothing changing after about 6 min, just still saying to drag and drop the file.
I haven't tried updating since the previous version I was using, is it likely to be any different?
Title: Re: 3D Gerber Viewer
Post by: doub on October 08, 2013, 01:15:21 pm
No, I didn't do any performance modification recently.

The only time I witnessed such slow behaviour was when I was exceeding the GPU memory of my computer, which put the OS in a memory thrashing loop. To check that I used GPU-Z that can display GPU memory usage. What you can try is edit the file named "lua/5.2/grbv/boards.lua" (not "lua/5.2/boards.lua"), locate two "4096" numbers, and change these to 256. If that fixes the problem, then it was memory thrashing. You can then try to increment the values by a factor of two to get better rendering quality (512, 1024, 2048).
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on October 08, 2013, 03:36:07 pm
Doesn't look like it's a Video memory issue. I got the latest version 20131008T0045 and changed the 2 x 4096 values to 256 in the file advised (made sure it was the correct file), no change that I could notice, still no Gerber image after 5+ minutes (just a Sanity check, I am just supposed to just drop a Gerber file onto it aren't I and it is the exe I run isn't it?). I was using the lilypad.gbl

Downloaded and installed GPU-Z and it shows a steep step up in things when the viewer starts, GPU temp goes up 10+ degrees to 55C, but GPU load is only 39% and memory usage (as reported by GPU-Z) is only 138MB and it's a 1GB dedicated V-RAM and 2048 total. I'll send you the log file and screenshots from GPU-Z shortly.

*Edit - Typo
Title: Re: 3D Gerber Viewer
Post by: Sleepwalker3 on October 08, 2013, 03:46:37 pm
OK, still no image 15 min later. Here is the GPU-Z info.
Title: Re: 3D Gerber Viewer
Post by: kiate on October 11, 2013, 07:01:32 am
It's going to be awesome if I can run this on my Win8 64-bit, Core2 duo T5670, 2GB RAM system. I got this message.

[attachment=0]
Title: Re: 3D Gerber Viewer
Post by: doub on October 11, 2013, 11:58:25 am
@Sleepwalker3: You can run either the .exe or the .com, and you can drop a single file on the window (but it's probably more useful to drop a bunch of related files at once). You can also load the full LilyPad board by pressing F5 (if you didn't change your key bindings). Can you run the .com instead of the .exe, and copy and paste the console output so that I can see where it gets stuck?

@kiate: I didn't receive the automatic error messages (you disabled them or have a proxy/firewall blocking outgoing HTTP). Can you send me an email with the error-report.txt file that you should have in your "Gerber Viewer" directory?
Title: Re: 3D Gerber Viewer
Post by: matseng on October 11, 2013, 12:37:37 pm
I'm using "Gerber Viewer version 13b56891f389 release 20130926T1023 for x64" and it is killed dead by the attached gerbers.  No error-report.txt is generated. I know that the version I'm using is a bit old, I'll try a newer....
...
... 
...
Nope - grbv-20131008T0045-64bits.zip dies just as dead with these gerbers.
Title: Re: 3D Gerber Viewer
Post by: doub on October 11, 2013, 02:19:44 pm
There is a double problem here. Your file use A) a composite aperture macro containing several primitives and B) some of these primitives are of the type "Center Line, primitive code 21".

Fixing B is relatively trivial, I just overlooked the case (and a few related ones) because I didn't have a test file for it.

Fixing A is not as straightforward, since having multiple primitives in an aperture may result in a shape with several contours, and eventually holes. Complete support for this would require extensive modification of my drawing code. In your case the final macro shape has a single contour and no holes, so I can probably hack a special case for these.

I'll try to post a new version fixing that soon.
Title: Re: 3D Gerber Viewer
Post by: doub on October 12, 2013, 01:11:10 am
I just released a new version tagged 20131012T0005. It fixes the problem matseng has (though his board doesn't load perfectly yet, there is too much unwanted stuff on the mechanical layer).

Among the new features, I introduced a new mouse rotation and translation scheme. The translation scheme is simply superior to the other one, so you'll probably like it. The rotation scheme though is different, and both the old and the new have their advantages. If you want to revert to the old behaviour for one or the other, you can edit your grbv.conf file and add one or two of these lines:

Code: [Select]
rotation_mode = 'free'
translation_mode = 'screen'

For the very curious, this version (and maybe one or two before that) supports displaying 3D models for parts. Since it's not very easy to use yet I won't talk too much about it, I'm planning to work on it some more before officially documenting it. But if you want to give it a try, look at the source code and ask here for detailed explanations if the code is not clear enough.
Title: Re: 3D Gerber Viewer
Post by: matseng on October 12, 2013, 03:48:25 am
Is there any information in the gerbers showing what software they were generated with?    It seems very advanced with having support for macros in a a language made for photoplotters back in the 60'ies - I suppose they were introduced in the newer 274X -standard.
Title: Re: 3D Gerber Viewer
Post by: doub on October 12, 2013, 04:08:20 am
There is no standardized method to declare the generator, but there are comment directives and each app can declare itself with them (or not). There are even tentatives of pseudo-standard extensions more or less based on comment directives or other generic headers to add more meta-data than anticipated in the spec (which itself changes quite regurlarly already).

In the last board you posted there is no comment indicating directly what was the app, but there are some of these comments containing meta-data so you may be able to determine what app generated them with some googling. For example (G04 is the comment directive):

Code: [Select]
G04 Layer_Color=255*
G04:AMPARAMS|DCode=24|XSize=216.54mil|YSize=78.74mil|CornerRadius=19.69mil|HoleSize=0mil|Usage=FLASHONLY|Rotation=270.000|XOffset=0mil|YOffset=0mil|HoleType=Round|Shape=RoundedRectangle|*

And as for the macro, it's not that complicated, it's for the pads with rounded corners. It's made of a horizontal rectangle, a vertical rectangle, and four circles in the corners to make a rounded rectangle. But yeah, you can do pretty complex stuff with these macros (which can have arithmetic expression, define named variables, etc.). While writing all my Gerber parsing code I was really regretting that EAGLE doesn't use all these nice features to generate cleaner Gerber files.
Title: Re: 3D Gerber Viewer
Post by: stryker on October 27, 2013, 12:48:54 pm
[quote author="doub"]I just released a new version, tagged 20130925T1142. The main new feature is that it will merge Gerber paths at load time, which improves a lot outline detection. This should fix outline detection for Sick Of Beige based boards exported through EAGLE.[/quote]Thanks so much !

I've been away since Sept 19 so tonight I updated to the latest version tonight and saw this for the first time (had to backtrack this thread to see your announcement).  I can confirm every board I've loaded - various sick-of-beige sizes and an Arduino sheild among them - all render now with the outline as expected.

This is such a useful viewer - thanks so much for all your work here.
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on October 27, 2013, 08:04:52 pm
[quote author="stryker"]This is such a useful viewer - thanks so much for all your work here.[/quote]

Thanks for the feedback, it's always nice to have satisfied users :D
Title: Re: 3D Gerber Viewer
Post by: 2thick4uni on November 27, 2013, 09:14:22 pm
This really is a superb Gerber viewer, been using it for a month or so now and its excellent, the finished boards I've got from fab house look identical to the previews :-)

Only thing I've noticed is that it doesn't show irregular shape pcb's correctly, I have a rectangular pcb with a semicircle cut out of it to clear a rotary switch on a lower board, it just renders it as a rectangular board. I can put the gerbers up if needed. Is it possible to fix? I'm using the current release 20131110T0146, 64bit version.

Thanks!

Allan
Title: Re: 3D Gerber Viewer
Post by: doub on November 27, 2013, 11:39:12 pm
Yes, sure, send me the files and I'll have a look. The tool support irregularly shaped PCBs, but the outline data must be in a form that is unambiguous. Your PCB fab loads the files with human intervention to resolve ambiguities. If I can't support your files directly at least I'll be able to tell you how to modify them so that they give the expected visualization.
Title: Re: 3D Gerber Viewer
Post by: 2thick4uni on November 28, 2013, 01:32:33 am
That's great, would really appreciate it if you can help!

Gerbers are zipped here: https://dl.dropboxusercontent.com/u/401 ... erbers.zip (https://dl.dropboxusercontent.com/u/40128603/Gerbers.zip)

Cheers,
Allan
Title: Re: 3D Gerber Viewer
Post by: doub on December 02, 2013, 11:38:57 pm
Hi 2thick4uni,

I've had a look at your data. It appears that the outline in the GML file is not closed properly. Zoom in the upper right corner using another basic Gerber viewer or your source data editor. There are two corners there, separated by about 0.2mm. Also there is an overlapping segment about 1mm long, which may prevent the merging of the two corners even if the merge radius was extended.
Title: Re: 3D Gerber Viewer
Post by: 2thick4uni on December 04, 2013, 08:17:22 pm
Thanks for looking into it doub, I'll redraw the board outline and see if I can get it to display correctly .
Title: Re: 3D Gerber Viewer
Post by: doub on January 07, 2014, 01:30:35 am
I just released a new version tagged 20140107T0117. It contains a few bug fixes, and two new features to fix the problems described in the post below.

[quote author="matseng"]Oh... Really nice. It got the outer outline of this board right, but failed on the internal cutouts.

It would be incredibly cool if during the compositing of copper, soldermask and silk you could remove silk that is on top of bare substrate or bare copper like the pcb fabs does.  It of course won't be true representation of the gerbers, but it would be truer to the actual pcb.

[attachment=1][/quote]

First, the holes in the middle are now properly milled. All zero-width closed lines in the milling/mechanical image (.gml) are interpreted as contours of zones to be removed. This is a bit crude, but it should cover most clear cases.

Second, it is now possible to mask the silkscreen print with the soldermask. This will remove any silkscreen marking not printed on top of the soldermask, which means there won't be silkscreen on top of exposed copper. However, this behaviour is not the default. To enable it, you need to edit your color scheme (the file colors/default.lua in the grbv distribution) and change the value of mask_silkscreen from false to true. This is because some PCB fabs do that mask operation, some don't. And the color file kinda represents how your PCB fab interprets Gerber data to make the PCB (that is, it's more than colours).

Here is an approximate screenshot of the same board as matseng provided as demo, with these two features enabled:

[attachment=0]

As always, comments and suggestions are welcome. I see regular crashes reported to my server, but nobody is complaining either here or to me by email. I fix some, but others require an exchange with the user, and the crash reports are anonymous by default so I can't contact affected people.

PS: I introduced a last minute bug in the version tagged 20140107T0023, so if you downloaded it while it was advertised here, please upgrade to a newer version 20140107T0117.
Title: Re: 3D Gerber Viewer
Post by: matseng on January 07, 2014, 05:40:07 am
Ooohhhhhh.... This is really nice!
j
I tested the latest version on a few different gerbers with internal cutouts and it rendered them flawlessly. And the no-silk-on-copper option works just fine as well.

Thank you for a fine piece of software.
Title: Re: 3D Gerber Viewer
Post by: gege2b on January 24, 2014, 06:07:17 pm
it did'nt work for me :(

Here's the error I get when loading gerbers :

Windows 7 x64
Title: Re: 3D Gerber Viewer
Post by: doub on January 25, 2014, 01:45:00 pm
Can you send me the Gerber file that cause the issue? It can be in a PM on an email (see grbv main website) if you don't want it public. Also please tell me what software you used to generate the file.

This error is caused by two appertures using the same name (here D10) in the same file. I'm not sure it's allowed by the Gerber spec. I'll check again.

Edit: The spec actually says: "Once a D-code number is assigned to an aperture it cannot be re-assigned.". So either your file is invalid, or there's a bug in my code. Either way I need the file to check.
Title: Re: 3D Gerber Viewer
Post by: gege2b on January 25, 2014, 05:39:40 pm
Hi,

Well, the gerbers was generated with gerbmerge (a python tool used to panelize boards), and the original gerbers was made using kicad
those gerbers was sent to seeedstudio some weeks ago and they all went fine except some bugs in silk screen, so you're probably right

look at your PM
Title: Re: 3D Gerber Viewer
Post by: doub on January 25, 2014, 07:23:55 pm
Yes, the silkscreen is the problematic file. The aperture D10 is defined twice, with different values. In another tool I use to test rendering (gEDA's gerbv) the faulty traces are also rendered wrong.

The bug is probably in the panelization script. It should re-assign aperture numbers to avoid conflicts. You should report the problem to the Python script author (redirect him here if you're not sure how to explain the problem). For a quick fix, rename the second ADD10 to ADD11 near the bottom of the file, and the D10 just below to D11.
Title: Re: 3D Gerber Viewer
Post by: gege2b on January 26, 2014, 12:13:00 am
thank you for your live debug ! :)
Title: Re: 3D Gerber Viewer
Post by: doub on January 31, 2014, 02:53:09 am
I just released a new version tagged 20140131T0210. It has many little invisible changes, but most importantly I found out the culprit of the big performance issue on some hardware (like nvidia 9600 era GPUs). So for those people (in particular Sleepwalker3) the app should now be much more usable, even with default rendering options.
Title: Re: 3D Gerber Viewer
Post by: matseng on February 06, 2014, 01:56:00 pm
Doub,  a time saving feature for me would be if I just could drop a zip file instead of the separate gerbers onto the viewer. I usually make a final check of the zipped gerbers before sending them off to the fab to spot any leftover brainfarts.

Another thing, it seems like if I have silk extending outside of the dimension layer the viewer doesn't clip it there.
Title: Re: 3D Gerber Viewer
Post by: doub on February 07, 2014, 02:43:07 am
The problem is not that the silkscreen extends outside the dimension, but rather that your outline polygon (which is present in several layers) is not cleanly connected. And the code that forcefully connect points close to each other had a rare bug that was triggered by this particular board (to be honest I was lucky that all my previous test boards with rounded corners did not trigger it).

I've just uploaded a new version tagged 20140207T0140 fixing that bug.

As for the ZIP opening, it's not straightforward to implement, so I'll keep the feature request in mind and eventually implement it when I find an opportune moment. I have another bug that touch similar code paths that I've been planning to fix for some time, but I can't promise anything right now.
Title: Re: 3D Gerber Viewer
Post by: matseng on February 07, 2014, 07:33:18 am
Ollright!  Now it renders nicely. Thanks.

But I couldn't find any "holes" in the outline. If I drag the different segments of the outline in Eagle its neighboring segments moved along, that usually indicates that Eagle have them connected. Maybe there was some rounding error in the write-as-gerbers function....
Title: Re: 3D Gerber Viewer
Post by: doub on February 07, 2014, 12:40:27 pm
The EAGLE runtime data is fine (well, within EAGLE capabilities), but it really sucks at exporting Gerber. Try gEDA's gerbv viewer, and zoom in at the junction between the rounder corner and the straight edge. At max zoom in gerbv there is a one pixel gap, it's actually one least significant digit with your 2.4 inches format, ie. 0.0001 inches or 2.54 µm.
Title: Re: 3D Gerber Viewer
Post by: t0mpr1c3 on February 07, 2014, 09:36:40 pm
I have been experiencing this problem with Eagle also and have resorted to manually editing the .GML file.
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on February 08, 2014, 11:47:40 pm
I get GLSL 1.30 is not supported.  This is under VMWARE Fusion on OSX.  Looks like I'm out of luck.
Title: Re: 3D Gerber Viewer
Post by: doub on February 09, 2014, 11:55:57 am
[quote author="TomKeddie"]I get GLSL 1.30 is not supported.  This is under VMWARE Fusion on OSX.  Looks like I'm out of luck.[/quote]

I'm not sure it will work on your platform, but you can try the following. Create a text file named render.conf next to grbv.exe. Edit it as a text file, and add the following line:
Code: [Select]
renderer = 'simple'
This should switch rendering to something less demanding, but with lower quality.
Title: Re: 3D Gerber Viewer
Post by: doub on February 24, 2014, 12:31:27 pm
I just released a new version tagged 20140224T1205. The main new feature is that it's trying to auto-detect the file format based on content, rather than assuming the drill file is in Excellon and the rest in Gerber.

This also introduces very initial support for DXF files. If you have some DXF files in your PCB data (for example the outline/routing), and you would like better support please ask.
Title: Re: 3D Gerber Viewer
Post by: pyrosster on March 20, 2014, 12:04:41 pm
it did'nt work for me :(

Here's the error I try to run the program. Can you help me please??

Nvidia Gforce 7300GT with latest drivers
Windows 7 x64
Title: Re: 3D Gerber Viewer
Post by: doub on March 20, 2014, 01:14:11 pm
This application requires OpenGL 3 support, and your graphics card is too old for that. From what I can read online (http://http://nvidia.custhelp.com/app/answers/detail/a_id/2443/~/what-nvidia-products-support-opengl-3.0%2F3.1%3F), OpenGL 3 support is only available in GeForce 8000 series or higher.
Title: Re: 3D Gerber Viewer
Post by: stryker on May 31, 2014, 12:30:44 pm
Hi doub

Not sure what's gone wrong here, but this has stopped for me.  Error I'm getting is
Quote
The operation could not be completed because desktop composition is disabled.

stack traceback:
[C]: in function 'assert'
C:UsersGeoffDesktopGerber Viewerlua5.2enginegui.lua237: in function 'init'
C:UsersGeoffDesktopGerber Viewergrbv.lua:200: in main chunk
[C]: in?
I have recently updated video drivers so when grbv couldn't launch I didn't pay attention to the error, but immediately updated to the latest version from your site.  It's the 2014-May-24 version, for 64 bit.  I'm running Windows 7 Pro 64 bit.  I'm running AMD Catalyst v14.4, OpenGL v 6.14.10.12874.

Any ideas why it might think desktop composition is disabled?  I've confirmed it's enabled and the Desktop Window Manager Session Manager is started and automatic as per MS knowledgebase.

Thanks
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on May 31, 2014, 01:04:23 pm
@stryker/Geoff:

I think you downloaded a wrong version by mistake. There are no version from 2014-May-24. The release date is in the ZIP file name, the latest version is grbv-20140519T1533-64bits.zip. The date next to it on the downloads page is when I uploaded all the files to the server, and I did copy all files to a new server on 2014-May-24.

I didn't receive automated error reports for your problem, so either enable them (so I can pinpoint the problem exactly) or make sure you have the release tagged 20140519T1533.
Title: Re: 3D Gerber Viewer
Post by: stryker on May 31, 2014, 01:38:23 pm
[quote author="doub"]@stryker/Geoff: I think you downloaded a wrong version by mistake.[/quote]I think you may have been right!

I think I downloaded the first 64bit version rather than the most recent.  Now I have, and I had a far more comprehensive error text on launch.  Did you receive it?

Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on May 31, 2014, 01:59:05 pm
[quote author="stryker"]Did you receive it?[/quote]

Yes, I got error reports. But these are errors that are very hard to debug, they're specific to your hardware and drivers (ie. the same code runs fine on other computers). Does the error happen as soon as you start the viewer? Do you start it with input files or just double-clicking the exe file?

First can you add a text file named grbv.conf next to the grbv.exe, and put the following in there:
Code: [Select]
translucent = false

If that doesn't work, you can try to add a new text file named render.conf next to grbv.exe, and put the following text in there:
Code: [Select]
renderer = 'simple'
Title: Re: 3D Gerber Viewer
Post by: stryker on May 31, 2014, 02:09:26 pm
hi doub

I'm sure you were watching the errors so you already know, but for the benefit of anyone else who gets that same issue it required both those .conf files in place to fix.

It's now working great again.  I'm so glad.  I thought I'd have to use mayhewlabs.com/webGerber/ (http://http://mayhewlabs.com/webGerber/) but it still has so many inaccuracies compared to yours when using DP's templates and still gets the silkscreens wrong.  That clearly wasn't an option.

Not only do you have the supreme gerber viewer but also the best tech support too - thanks so much!
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on May 31, 2014, 09:55:47 pm
The second config file means you get a lower quality renderer that use less advanced OpenGL features, so your rendering is not as good as it could get (you have an OpenGL 4.4 capable GPU and driver), but if you're happy enough with it I am too :D
Title: Re: 3D Gerber Viewer
Post by: doub on August 11, 2014, 03:32:33 pm
Good news for all AMD Catalyst users, I've fixed a long-standing error that prevented you from using my Gerber Viewer. This is more of a workaround (for a bug in the AMD driver), but the result is the same and you should now be able to use grbv out of the box.

The latest version which also includes several minor improvements accumulated over the months is tagged 20140811T1535. The download page at http://piratery.net/grbv/downloads/ (http://piratery.net/grbv/downloads/) has been revamped for better clarity.
Title: Re: 3D Gerber Viewer
Post by: stryker on August 11, 2014, 04:05:52 pm
Hi doub

Just downloaded the latest, and yes using AMD catalyst drivers here.

Even with the conf files setup as they were for no translucent and simple rendering, on launch I get this error:
...Gerber Viewerlua5.2boardsdrawing.lua:42:attempt to call field 'Init_FreeType' (a nil value)

Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on August 11, 2014, 04:27:15 pm
This is a very surprising error. Did you extract the new ZIP over the old installation or did you start from a new directory? Also what ZIP did you use? I didn't get an automated error report for this error, did you disable them?
Title: Re: 3D Gerber Viewer
Post by: doub on August 11, 2014, 04:38:45 pm
In my rush to publish I broke a basic feature, the corrected version is 20140811T1535.
Title: Re: 3D Gerber Viewer
Post by: stryker on August 12, 2014, 12:49:04 am
[quote author="doub"]In my rush to publish I broke a basic feature, the corrected version is 20140811T1535.[/quote]Sorry to report I'm still getting it in that version, and also in the 20140811T1704 which you must have published since the above post.
Title: Re: 3D Gerber Viewer
Post by: doub on August 12, 2014, 11:19:58 am
The thing I broke was not your problem, which is very peculiar. Can you answer my questions from above?
Title: Re: 3D Gerber Viewer
Post by: stryker on August 12, 2014, 12:06:33 pm
Hi, Sorry I should have answered those.  [quote author="doub"]This is a very surprising error. Did you extract the new ZIP over the old installation or did you start from a new directory? Also what ZIP did you use? [/quote]For the record I had expanded the last couple over each other rather than starting afresh.  I just downloaded grbv-20140811T1704-64bits.zip and it works from a fresh install.  Clearly starting from fresh is best.[quote author="doub"]I didn't get an automated error report for this error, did you disable them?[/quote]I haven't disabled them so presume it was failing before getting even that far.

Thanks again!
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on August 12, 2014, 07:25:06 pm
So no more bugs for you?
Title: Re: 3D Gerber Viewer
Post by: stryker on August 13, 2014, 01:01:07 am
[quote author="doub"]So no more bugs for you?[/quote]I am not using the simple render now and it's looking good.  Thanks so much.
Title: Re: 3D Gerber Viewer
Post by: stryker on January 28, 2015, 09:20:37 am
Hi doub,

Just noticed and downloaded the 2014/11/28 release.  Only goes to show it's been very stable so I only saw this when sending the link to a friend.  Is there anything significantly new in this build?

Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on January 28, 2015, 11:58:34 am
No, the last few releases are mostly for bug fixing, especially regarding Excellon file loading (which is still sub-par).
Title: Re: 3D Gerber Viewer
Post by: Royce on January 28, 2015, 05:20:57 pm
I pulled this down just now and tried it. Pretty neat! I simply dragged the files I had just sent to Elecrow on to it and it guessed the nature of each layer correctly. The only miss was that I had two NC Drill files and only one rendered. For whatever reason, Elecrow requests that plated holes and non-plated holes be submitted in separate files. (I'm not sure why, iTead, OSHPark, etc, are all good with a combined file.)

Thanks much!
Title: Re: 3D Gerber Viewer
Post by: doub on January 28, 2015, 06:29:13 pm
A quick workaround is to rename your non-plated drill file to .gml. This will tell grbv to interpret the image as a milling layer, the file format (Gerber vs. Excellon) is auto-detected in any case based on file content.

The proper way to correct that is to use a different board template. You can either modify the default one (see patterns in lua/5.2/boards/templates.lua) or put one in your data files with a .conf extension.
Title: Re: 3D Gerber Viewer
Post by: stryker on June 14, 2015, 01:08:26 pm
Hi doub

I created a board where I've traced a curved outline with lots of straight segments.  Your viewer is telling me somewhere a vertex isn't closed.  Do you have any tips on how you'd find this without investigating 300+ segments in KiCad?  (starting this process anyway, but asking for next time!)

Also is there a way by looking at the .oln file to work out what the maximum dimensions are as a final check to ensure a board with an irregular shape is going to fit inside a board maker's 50x50mm etc price clip?

Thanks
Geoff
Title: Re: 3D Gerber Viewer
Post by: doub on June 14, 2015, 06:29:08 pm
[quote author="stryker"]I created a board where I've traced a curved outline with lots of straight segments.  Your viewer is telling me somewhere a vertex isn't closed.  Do you have any tips on how you'd find this without investigating 300+ segments in KiCad?  (starting this process anyway, but asking for next time!)[/quote]

I don't remember that error. Can you send me the files (privately if you wish) so I can see what you're referring to? Otherwise please give me the exact error message (you can press Ctrl+C when a message box is displayed to copy the text to the clipboard).

Quote
Also is there a way by looking at the .oln file to work out what the maximum dimensions are as a final check to ensure a board with an irregular shape is going to fit inside a board maker's 50x50mm etc price clip?

You can use aperture scripting to do that. Create a simple text file and run it with the lua.exe in the Gerber Viewer package, with something like that:
Code: [Select]
local boards = require 'boards'
local extents = require 'boards.extents'

local board = boards.load("path/to/board")
local extents = extents.compute_outline_extents(board.outline, { unit = 'mm' })
print("width:", extents.right - extents.left)
print("height:", extents.top - extents.bottom)
Title: Re: 3D Gerber Viewer
Post by: stryker on June 15, 2015, 12:55:00 am
[quote author="doub"]
I don't remember that error. Can you send me the files (privately if you wish) so I can see what you're referring to? [/quote]
It doesn't give an error as such, but what I'm expecting to be the board outline appears as a line inside a rectangular shaped PCB in the viewer.  Since your viewer does this, I use it as a check before ordering the PCB to make sure my PCB edge is actually an enclosed shape.
[quote author="doub"]
You can use aperture scripting to do that. Create a simple text file and run it with the lua.exe in the Gerber Viewer package, with something like...[/quote]I will totally have to look into this scripting.  Thanks so much !

Geoff
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on August 19, 2015, 01:20:22 am
Hey Jerome, I'm struggling a little on OSX.  I think I have the wrong lua version perhaps.  Is that the correct thing to do with LUA_PATH?

The error might be related to http://lua-users.org/lists/lua-l/2013-03/msg00061.html (http://lua-users.org/lists/lua-l/2013-03/msg00061.html) (I really just want to panelise some boards, not learn lua ;-)
 Thanks, Tom

Code: [Select]
tomk-macbook-pro:201508 tom$ export LUA_PATH=~/hg/hg.piratery.net/aperture-scripting/boards.lua
tomk-macbook-pro:201508 tom$ lua panel.cfg
lua: error loading module 'lfs' from file '/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua':
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:263: too many C levels (limit is 200) in function at line 201 near ''-''
stack traceback:
[C]: in ?
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
...
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
/Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:7: in main chunk
[C]: in function 'require'
panel.cfg:1: in main chunk
[C]: in ?

panel.cfg is

Code: [Select]
tomk-macbook-pro:201508 tom$ cat panel.cfg 
local boards = require 'boards'
local waterlogger = assert(boards.load('../../kicad/waterlogger/gerber'))

tomk-macbook-pro:201508 tom$
Title: Re: 3D Gerber Viewer
Post by: doub on September 01, 2015, 11:59:33 am
This is not the correct thing to do with LUA_PATH. Use the following instead:

export LUA_PATH="~/hg/hg.piratery.net/aperture-scripting/?.lua;;"
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on September 01, 2015, 04:43:42 pm
Jerome, many thanks, I had got past that point with symlinks but will add the env var.  I'm now stuck with excellon files trying to panelise.

Here is the output I see, I will attach the files.  It seems that the excellon data is being scaled or shifted incorrectly perhaps?

Thanks,
Tom

Quote
tomk-macbook-pro:tmp tom$ lua panel.lua
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gbo
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gbl
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gtl
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gto
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gtp
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gts
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gbs
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.txt
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gml
warning: typing of macro OC8 is ambiguous
loading AVR-Pocket-Programmer/AVR-Pocket-Programmer.gbp
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gbo
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gbl
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gtl
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gto
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gtp
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gts
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gbs
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.txt
loading pyboard/pyboard.gml
warning: typing of macro OC8 is ambiguous
loading pyboard/pyboard.gbp
warning: typing of macro OC8 is ambiguous
30480000000.0   46990000000.0
39999920000.0   33999932000.0
saving ./final/tkeddie_201508.gbo
saving ./final/tkeddie_201508.gbl
warning: typing of macro OC8 is ambiguous
saving ./final/tkeddie_201508.gtl
warning: typing of macro OC8 is ambiguous
saving ./final/tkeddie_201508.gto
saving ./final/tkeddie_201508.gtp
saving ./final/tkeddie_201508.gts
warning: typing of macro OC8 is ambiguous
saving ./final/tkeddie_201508.gbs
warning: typing of macro OC8 is ambiguous
saving ./final/tkeddie_201508.txt
lua: .../hg/hg.piratery.net/aperture-scripting/gerber/blocks.lua:250: assertion failed!
stack traceback:
   [C]: in function 'assert'
   .../hg/hg.piratery.net/aperture-scripting/gerber/blocks.lua:250: in function 'gerber.blocks.save_number'
   ...g/hg.piratery.net/aperture-scripting/excellon/blocks.lua:104: in function <...g/hg.piratery.net/aperture-scripting/excellon/blocks.lua:101>
   (...tail calls...)
   [C]: in function 'tostring'
   ...g/hg.piratery.net/aperture-scripting/excellon/blocks.lua:254: in function 'excellon.blocks.save'
   ...s/tom/hg/hg.piratery.net/aperture-scripting/excellon.lua:406: in function 'excellon.save'
   (...tail calls...)
   /Users/tom/hg/hg.piratery.net/aperture-scripting/boards.lua:397: in function 'boards.save'
   panel.lua:32: in main chunk
   [C]: in ?
Title: Re: 3D Gerber Viewer
Post by: doub on September 01, 2015, 06:56:45 pm
The input Excellon files are bad. They both have a wrong number format (inconsistent between header and data), but in a different way.

To fix AVR-Pocket-Programmer.txt you need to replace M72 with:
Code: [Select]
INCH,TZ
;FILE_FORMAT=2:6

To fix pyboard.txt you need to replace M72 with:
Code: [Select]
INCH,TZ
;FILE_FORMAT=2:5

Then to be able to merge these two you need to make their formats match. Just after loading, in the panel file, add the following:
Code: [Select]
micropython.images.drill.format.decimal = 6

And the result:

[attachment=0]

Note that you can save some board space by better panelizing the sub-boards (you can rotate boards in your panel script).
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on September 03, 2015, 07:52:38 pm
Thanks for helping me with Eagle's crappy excellon generation.

Here is my final panel.  I've also attached my script.  Is png generation supported in the script?  I'm not using your viewer as I'm on a mac.

There is a bug there, I think the rounded corners are going to be milled off the board in the bottom right.

[attachment=2]

[attachment=0]

Code: [Select]
local boards = require 'boards'
local extents = require 'boards.extents'
local panelization = require 'boards.panelization'

local makeymusic = assert(boards.load('../../eagle/makeymusic/makeymusic'))
local avrpocket = assert(boards.load('../../../../git/sparkfun/Pocket_AVR_Programmer/Hardware/AVR-Pocket-Programmer'))
local micropython = assert(boards.load('../../../../git/micropython/pyboard/eagle/pyboard'))
local adafruitusbisolator = assert(boards.load('../../../../git/adafruit/Adafruit-USB-Isolator-PCB/Adafruit USB Isolator'))

-- excellon overrides
micropython.images.drill.format.decimal = 6
adafruitusbisolator.images.drill.format.decimal = 6
makeymusic.images.drill.format.decimal = 6

-- size
max_panel_height = 10e9
max_panel_width = 10e9

-- options
local spacing = 1.7e9
local options = {}
options["spacing"] = spacing;

-- extract extents and print them
local makeymusic_extents = extents.compute_board_extents(makeymusic)
local avrpocket_extents = extents.compute_board_extents(avrpocket)
local micropython_extents = extents.compute_board_extents(micropython)
local adafruitusbisolator_extents = extents.compute_board_extents(adafruitusbisolator)

local makeymusic_height=makeymusic_extents["top"]-makeymusic_extents["bottom"]
local makeymusic_width=makeymusic_extents["right"]-makeymusic_extents["left"]
print("makeymusic", makeymusic_height, makeymusic_width)

local avrpocket_height=avrpocket_extents["top"]-avrpocket_extents["bottom"]
local avrpocket_width=avrpocket_extents["right"]-avrpocket_extents["left"]
print("avrpocket", avrpocket_height, avrpocket_width)

local micropython_height=micropython_extents["top"]-micropython_extents["bottom"]
local micropython_width=micropython_extents["right"]-micropython_extents["left"]
print("micropython", micropython_height, micropython_width)

local adafruitusbisolator_height=adafruitusbisolator_extents["top"]-adafruitusbisolator_extents["bottom"]
local adafruitusbisolator_width=adafruitusbisolator_extents["right"]-adafruitusbisolator_extents["left"]
print("adafruitusbisolator", adafruitusbisolator_height, adafruitusbisolator_width)

-- make all the top panels the same height
local tab1 = panelization.empty_board(avrpocket_width, makeymusic_height-avrpocket_height)
local avrpocket_panel = panelization.panelize({tab1, avrpocket}, options, true)

local tab2 = panelization.empty_board(micropython_width, makeymusic_height-micropython_height)
local micropython_panel = panelization.panelize({tab2, micropython}, options, true)

local tab3 = panelization.empty_board(adafruitusbisolator_width, makeymusic_height-adafruitusbisolator_height)
local adafruitusbisolator_panel = panelization.panelize({tab3, adafruitusbisolator}, options, true)

local top_panel = assert(panelization.panelize({avrpocket_panel,  micropython_panel, adafruitusbisolator_panel}, options, false))

-- extract top panel extents
local top_panel_extents = extents.compute_board_extents(top_panel)
local top_panel_height=top_panel_extents["top"]-top_panel_extents["bottom"]
local top_panel_width=top_panel_extents["right"]-top_panel_extents["left"]
print("top_panel", top_panel_height, top_panel_width)

-- pad out bottom panel to same width as top
local tab4 = panelization.empty_board(top_panel_width-makeymusic_width-spacing, makeymusic_height)
local bottom_panel = assert(panelization.panelize({makeymusic, tab4}, options, false))

-- final panel
local panel = assert(panelization.panelize({top_panel,  bottom_panel}, options, true))
boards.merge_apertures(panel)

local panel_extents = extents.compute_board_extents(panel)
local panel_height=panel_extents["top"]-panel_extents["bottom"]
local panel_width=panel_extents["right"]-panel_extents["left"]
print("panel", panel_height, panel_width)

assert(boards.save(panel, './final/tkeddie_201508'))

Title: Re: 3D Gerber Viewer
Post by: doub on September 03, 2015, 10:05:09 pm
I have an utility to make PNGs but it's Windows only just like my viewer.

The rounded corner look fine in both my grbv and gEDA's Gerber Viewer.

However your drill data is still bad. And the copper layers look wrong too, even on your own pictures. Pads and traces are overlapping but that doesn't look to be on purpose.
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on September 04, 2015, 03:26:54 pm
Thanks for pointing that out, I'm switching back to gerbmerge for now.  The drill data is still out, am working on it.

[attachment=1]
Title: Re: 3D Gerber Viewer
Post by: doub on September 04, 2015, 11:17:45 pm
If that problem on the big board only appears with my tool, then I'd like to fix the bug. Can you send me the 4 sub-boards and the panel script you used? You can send it directly by email if it's proprietary stuff and you don't want it published.
Title: Re: 3D Gerber Viewer
Post by: TomKeddie on December 07, 2015, 01:25:13 pm
This is working well for me now.  I just wrote two library functions to calculate and add the tabs for me.  They don't do any checking so they fall over where boards don't match in size but there isn't enough space to add a tab to make them match.  Dirty PCBs should make this just fine, they made the panel above just fine.

[attachment=0]

Code: [Select]
local boards = require 'boards'
local extents = require 'boards.extents'
local panelization = require 'boards.panelization'
local manipulation = require 'boards.manipulation'

local max_panel_lr = 100e9
local max_panel_bt = 100e9
max_panel = panelization.empty_board(max_panel_lr, max_panel_bt)

-- options
spacing = 1.7e9
options = {}
options["spacing"] = spacing
options["routing_mode"] = "stroke"

function merge(name, board1, board2, match_lr)
  local board1_extents = extents.compute_board_extents(board1)
  local size1_bt = board1_extents["top"]-board1_extents["bottom"]
  local size1_lr = board1_extents["right"]-board1_extents["left"]
  local board2_extents = extents.compute_board_extents(board2)
  local size2_bt = board2_extents["top"]-board2_extents["bottom"]
  local size2_lr = board2_extents["right"]-board2_extents["left"]
  local merged_panel = {}

  if match_lr == 1 then
      if size1_lr ~= size2_lr then
        local tab = panelization.empty_board(size1_lr - size2_lr - spacing, size2_bt)
        local panel = panelization.panelize({board2, tab}, options, false)
        merged_panel =  panelization.panelize({board1, panel}, options, true)
      else
        merged_panel =  panelization.panelize({board1, board2}, options, true)
      end
  else
      if size1_bt ~= size2_bt then
        local tab = panelization.empty_board(size2_lr, size1_bt - size2_bt - spacing)
        local panel = panelization.panelize({board2, tab}, options, true)
        merged_panel =  panelization.panelize({board1, panel}, options, false)
      else
        merged_panel =  panelization.panelize({board1, board2}, options, false)
      end
  end

  local merged_panel_extents = extents.compute_board_extents(merged_panel)
  local size_bt = merged_panel_extents["top"]-merged_panel_extents["bottom"]
  local size_lr = merged_panel_extents["right"]-merged_panel_extents["left"]
  print("merge", name, size_lr, size_bt)

  return merged_panel
end

function pcb(filepath, pad_lr_board, pad_bt_board)
  local board = assert(boards.load(filepath))
  board.images.drill.format.zeros = 'L'
  board.images.drill.format.integer = 2
  board.images.drill.format.decimal = 6
  local board_extents = extents.compute_board_extents(board)
  local size_bt = board_extents["top"]-board_extents["bottom"]
  local size_lr = board_extents["right"]-board_extents["left"]
  print(filepath, size_lr, size_bt)

  if pad_lr_board ~= 0 then
      local new_extents = extents.compute_board_extents(pad_lr_board)
      local new_size_lr = new_extents["right"] - new_extents["left"]
      local tab_lr = panelization.empty_board(new_size_lr - size_lr - spacing, size_bt)
      local panel_lr = panelization.panelize({board, tab_lr}, options, false)

      board = panel_lr
      board_extents = extents.compute_board_extents(board)
      size_bt = board_extents["top"]-board_extents["bottom"]
      size_lr = board_extents["right"]-board_extents["left"]
      print("LR Adjusted size", size_lr, size_bt)
  end
  if pad_bt_board ~= 0 then
      local new_extents = extents.compute_board_extents(pad_bt_board)
      local new_size_bt = new_extents["top"] - new_extents["bottom"]
      local tab_bt = panelization.empty_board(size_lr, new_size_bt - size_bt - spacing)
      local panel_bt = panelization.panelize({board, tab_bt}, options, true)

      board = panel_bt
      board_extents = extents.compute_board_extents(board)
      size_bt = board_extents["top"]-board_extents["bottom"]
      size_lr = board_extents["right"]-board_extents["left"]
      print("BT Adjusted size", size_lr, size_bt)
  end

  return board
end

local elseq = pcb('../../../../git/sparkfun/EL_Sequencer/Hardware/EL_Sequencer', 0, 0)
local ft231x = pcb('../../../../git/sparkfun/FT231X_Breakout/hardware/ft231x-breakout', 0, 0)
local pstest = pcb('../../eagle/switching-ps-test/switching-ps-test', 0, 0)
local vert1_top = merge("vert1_top", ft231x, pstest, 0)

local vert1 = merge("vert1", elseq, vert1_top, 1)

-- vert2
local ftdibasic = pcb('../../../../git/sparkfun/FTDI_Basic_Breakout-5V/Hardware/FTDI Basic-5V', 0, 0)
local adafruitpowerboost1000c = pcb('../../../../git/adafruit/Adafruit-PowerBoost-1000C/Adafruit PowerBoost 1000C Rev B', 0, 0)
local fadecandy = pcb('../../../../git/scanlime/fadecandy/pcb/fc64x8/fc64x8', ftdibasic, 0)

local vert2 = merge("vert2a", ftdibasic, adafruitpowerboost1000c, 1)
vert2 = merge("vert2b", vert2, fadecandy, 1)

-- vert3
local sparkfunlipo = manipulation.rotate_board(pcb('../../../../git/sparkfun/Lipo_Charger_Basic-microUSB/Hardware/SparkFun_Lipo_Charger_Basic-microUSB', 0, 0), 90)
local tinyavrprog = manipulation.rotate_board(pcb('../../../../git/sparkfun/Tiny-AVR-Programmer/Hardware/Tiny_Programmer', 0, 0), 90)

local vert3 = merge("vert3", tinyavrprog, sparkfunlipo, 1)

-- panel
local panel = merge("panel", vert1, vert2, 0)
panel = merge("panel", panel, vert3, 0)
boards.merge_apertures(panel)

local panel_extents = extents.compute_board_extents(panel)
local panel_bt=panel_extents["top"]-panel_extents["bottom"]
local panel_lr=panel_extents["right"]-panel_extents["left"]
print("panel", panel_lr, panel_bt)
assert(boards.save(panel, './final/tkeddie_201512_1'))

os.exit()
Title: Re: 3D Gerber Viewer
Post by: stryker on September 18, 2016, 03:40:42 am
Hi Doub

Thanks again for this.  I just saw newer versions on your site, so have grabbed the latest. 

After using it for some time, if you can do this easy, I'd love to add something to the wish list.  A way of changing the colours used  in the viewer on the fly rather than editing colorsdefault.lua and restarting.  It's not a big thing, nor a high priority.  It's just a way to see how the boards might look in the different options from dirtyPCB primarily, but would also allow viewing in the way that someone's board maker of choice builds them.  Maybe the option could be behind one of the unused F-keys?

Cheers, Geoff
Title: Re: 3D Gerber Viewer
Post by: pablofern on August 13, 2019, 02:03:21 pm
Tried it on Windows x64 and it works just fine for me