I’m writing a simple tool to have my pcb plotted as vectors.
Why the data of polygons (fills) is repeated after G36 almost identical also after G37?
What is the idea and what are the differences exactly. With a quick look I see the only difference being that in G36 the last vector is listed two times?
G35/G36 defines filled regions. The duplication of the last point is probably just to make sure the contour is closed.
The second set (after G37) effectively draws the outline of the filled area, I’m not sure what the purpose of that is.
The comment in the code says this :
// Gerber format does not know filled polygons with thick outline
// Therefore, to plot a filled polygon with outline having a thickness,
// one should plot outline as thick segments
G36/G37 draw the region with a zero thickness line, so the outline is traced over again with the desired line thickness.
Do you start form gerber or do you have a kicad project to start with?
If you start from kicad you could try out the svg plot option. Maybe this already does what you want to achieve.
(Could also be useful for testing your tool)
I’m using Kicad to design. I’m aware there are some tools doing plotting with bitmaps, but my (maybe too) ambitious idea is not going back and forth with vectors and bitmaps (G-code is vectors).
I’m also aware of not achieving the “negative” parts this way but this is for my own projects - and whenever the gerber gets too complicated, I might then add some pixel based parts.
Although, I’m using only one size of focus at this stage.