ThisIsNotRocketScience / GerberTools

Tools to load/edit/create/panelizer sets of gerber files
MIT License
725 stars 144 forks source link

Gerber Panelizer does not merge Silkscreen on Some Boards #127

Open Thore-Krug opened 3 years ago

Thore-Krug commented 3 years ago

I created a CAM File for the Export of Eagle since the Standard Eagle Gerber Output now uses the same file ending for all Files.

It outputs the following Files files:

This all gets zipped up into a .zip archive by the CAM Processor.

A Tree of the File structure within the zip File:

Project-Gerber/
├── Gerber/
│   ├── gerber_job.gbrjob
│   ├── other.GML
│   └── other.GKO
│ 
├── Project.GBL
├── Project.GBO
├── Project.GBP
├── Project.GBS
├── Project.GTL
├── Project.GTO
├── Project.GTP
├── Project.GTS
└──Project.TXT

Importing into the Panelizer works flawlessly with this Setup and i produce a panelized Gerber every Time. Yet the top Silkscrren is missing on every Board exept one i tried to panelize.

Which is very mcuh to my surprise as all Boards used the same CAM Output as the Board which had no issues with the Top Silkscreen.

I checked the Gerber Output of my CAD Program ( Eagle ) to ensure that the top Layer is present which is in Fact the case and it can also be read from other Gerber Viewers.

Gerber-viewer

On the Left is the Gerber Which has the Top Silkscreen Issue, The Silkscreen is present even after panelization on the board located on the right.

And even though both Files contain the Top Silkscreen Layer its only present in one File after creating the Panel. I tried multiple other Boards but no sucess i re exported the Boards to make sure its not a broken file or similar.

But on the non sucessful Board the Top Silkscreen gets not merged.

( Sorry for the Phone Fotos i tried to make screenshots at the right moment but never were able to time it correctly )

Sucessful Board

gerber-merge-sucessful

Board with Silkscreen Error

gerber-merge-failure jp

Hence there is no merged Silkscreen Output for the Top Silkscreen.

Bottom

Orange-pi-adc-panel_Combined_Bottom

Top

Orange-pi-adc-panel_Combined_Top

noisemaker00 commented 3 years ago

I downloaded the source code and debugging it. In my case the board has no top silkscreen and I noticed the *.GTO file does not exist in the GeneratedFiles list. The program crash in GerberPanel.cs on GIC2.ClipBoard(f, tempfile, Logger); and an exception is thrown, so the layer file is not processed.

Going deeper the exception is throw in ImageCreator on

ClipperLib.Clipper CP = new ClipperLib.Clipper();
foreach (var ol in ols)
{
    ...
    var R = ol.FindLargestPolygon();
    var poly = R.Item2.toPolygon();
    ...
}

due to R is null when this happens ols has 2 items:

Layer Outline (.GKO)
Layer Mill(.GML)

and crash on ol layer is BoardLayer.Mill

I'm keep investigatinv but I've not knowledge on how gerber works in details, so I hope these information may be usefull to the developer to fix.

StijnKuipers commented 3 years ago

If you have a zip with the gerbers, I can take a look..

On Tue, 9 Feb 2021 at 17:58, noisemaker00 notifications@github.com wrote:

I downloaded the source code and debugging it. In my case the board has no top silkscreen and I noticed the *.GTO file does not exist in the GeneratedFiles list. The program crash in GerberPanel.cs on GIC2.ClipBoard(f, tempfile, Logger); and an exception is thrown, so the layer file is not processed.

Going deeper the exception is throw in ImageCreator on

ClipperLib.Clipper CP = new ClipperLib.Clipper(); foreach (var ol in ols) { ... var R = ol.FindLargestPolygon(); var poly = R.Item2.toPolygon(); ... }

due to R is null when this happens ols has 2 items:

Layer Outline (.GKO) Layer Mill(.GML)

and crash on ol layer is BoardLayer.Mill

I'm keep investigatinv but I've not knowledge on how gerber works in details, so I hope these information may be usefull to the developer to fix.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ThisIsNotRocketScience/GerberTools/issues/127#issuecomment-776085533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSI6MKTM6ZFFXRQVQRDC3S6FSSPANCNFSM4VPRAHAQ .

noisemaker00 commented 3 years ago

Yes, I'm using this one esp8266 breakout board_2021-02-08.zip

noisemaker00 commented 3 years ago

I tried to add a check wrapping after R is assigned

var R = ol.FindLargestPolygon();
if (R != null)
{
   var poly = R.Item2.toPolygon();
   ...
   CP.AddPolygon(poly, ClipperLib.PolyType.ptClip);
}

and the top silk screen has been added on the final merged board image, but I don't know if something may me missing due to the skipped code in curly braces

EDIT: I tried to combine two different boards and then open the combined board on the Viewer but it seems now crashing on combined.gtl layer. Instead ,if I only export the board in the .zip file above it seem to be ok on the Viewer

StijnKuipers commented 3 years ago

that should be safe - could you commit that change?

On Tue, 9 Feb 2021 at 18:21, noisemaker00 notifications@github.com wrote:

I tried to add a check wrapping after R is assigned

var R = ol.FindLargestPolygon(); if (R != null) { var poly = R.Item2.toPolygon(); ... CP.AddPolygon(poly, ClipperLib.PolyType.ptClip); }

and the top silk screen has been added on the final merged board image, but I don't know if something may me missing due to the skipped code in curly braces

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ThisIsNotRocketScience/GerberTools/issues/127#issuecomment-776101705, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSI6O5FKERGOJI2L4ZIO3S6FVIJANCNFSM4VPRAHAQ .

noisemaker00 commented 3 years ago

I'm still having crashes on the merged files when I open with the viewer, so I suspect something wrong happens during the process even if the null exception seems resolved

weissjuergen commented 2 years ago

Since ths is a while ago and I may have missed the point. Is there any solution to be able to panalize Eagle 9.6 output ?

CRImier commented 2 years ago

do you have the "clip to board outlines" checkbox checked in panel properties? uncheck that and regenerate. it's an option enabled by default that's supposed to clip silk and I assume other elements to board outline, but instead seems to remove most if not all of the silk.

CRImier commented 2 years ago

The latest downloadable build (2020) cannot process gerbers from KiCad 6, too - unless you disable aperture macros when plotting the gerbers. Alternatively: install visual studio community edition with desktop C# support, download this repo as a ZIP, open the project as described in README, open the Panelizer subproject, then just press "Start", it will compile you a new Panelizer with proper support for things.