bug on some gerber
Hi, kicad can open (but show error) but flatcam not
Comments (8)
-
-
Recommendation: if you generated that Gerber X2 file, perhaps it is better to uncheck that option in KiCAD and therefore export it in Gerber 274X format, maybe it will be exported correctly. It is also possible to be a KiCAD bug so it may help you to inquire in the KiCAD support forums.
-
reporter If I can suggest: option to ignore and just continue the file processing will be great
-
Just so you understand what I said previously I made an experiment.
From the file that you uploaded I’ve removed the pads (3 of them that created the issues, they were the only ones using the missing Aperture Macro
RotRect
. And then I loaded the file correctly in FlatCAM Beta.After that, I created a new Gerber file where I left only the pads with problems and removed anything else, but instead of using the missing aperture I assigned a random rectangle aperture and I loaded also the file. They are in RED color in the attached picture.
They are of course with wrong dimensions but I just wanted to have a rough idea where they are located.
-
Looks like Altium Gerber Viewer is cutting the corners and accepts to not show some elements. Yet, I still think it is not OK.
-
- changed status to open
-
As you suggested I allowed the display of the damaged file but with WARNINGS so the user knows that this is maybe just so he can see it but I’m not sure if such a damaged file can be processed by the application.
Changes are in the latest commit here: https://bitbucket.org/marius_stanciu/flatcam_beta/branch/Beta_8.995
-
- Log in to comment
Hi,
First the file is in Gerber X2 format which is different than the normal Gerber RS274X which is supported by FlatCAM by default.
Nevertheless, in FlatCAM beta I’ve added the support for Gerber X2 but this file is damaged and it cannot be opened by FlatCAM beta too.
It the lines 87 and 88 of the uploaded Gerber file you can find this:
The
RotRect
is a reference to a kind of Aperture Macro which must be defined before being associated to an aperture, task that is done in those two lines.But the
RotRect
is not defined anywhere in the Gerber file therefore the program will give an error and will not register the apertures 84 and 85 (in the previous lines see the ADD84 and ADD85).And when the parsing of Gerber file reach the place in the file where those apertures are called with the commands
D84
and respectively,D85
, it will crash the parsing and the program will report that it cannot open the file.You say that KiCAD opens that file.
I assume the following possibilities:
When KiCAD opens the Gerber file and it reaches the lines:
Case 1: it sees that it cannot identify those aperture macros (they are not defined), it will store them as damaged and it will continue to parse the Gerber file, effectively ignoring those Gerber elements (some pads from what I can see in the file) that are associated with the wrong apertures. This will result in displaying an incomplete Gerber file, with missing copper features, which is not correct.
Case 2: because the Gerber file was generated by KiCAD maybe it has some
defaults
where it looks and where will have some kind of predefined Aperture Macros, among them one namedRotRect
and it will use it to solve the situation displaying a correct file in the end. But this is not OK because the Gerber file is supposedly to be opened from other software too not only by KiCAD and those other software do not have that aperture macros database that KiCAD, perhaps, has.The short answer: FlatCAM correctly reports that the file is damaged because it is indeed. This behavior is therefore not a bug and it is the expected behavior when encountering a damaged file.