Karel-Tavernier / gerber_writer

A python library to write gerber files
Apache License 2.0
13 stars 4 forks source link

How to set edges of cutting? #7

Closed elderkeltir closed 6 months ago

elderkeltir commented 6 months ago

Hello, I'm enjoying your project so far, it almost fully covers m needs, except I can't create a proper edges for cutting. in Kicad pcb editor I usually create rectangle(not filled) on EdgeCuts layer, this produces separate gbr file that later used to set borders for machine to cut.

how can I achieve this with code? I assume there is no way to make not filled rectangle?

thnx in advance!

elderkeltir commented 6 months ago

Here is content of gbr file exported from kicad, that only contains EdgeCuts layer with a single rectangle(not filled) for a reference.

%TF.CreationDate,2024-04-22T10:45:47+03:00*%
%TF.ProjectId,,58585858-5858-4585-9858-585858585858,rev?*%
%TF.SameCoordinates,Original*%
%TF.FileFunction,Profile,NP*%
%FSLAX46Y46*%
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
G04 Created by KiCad (PCBNEW 8.0.1) date 2024-04-22 10:45:47*
%MOMM*%
%LPD*%
G01*
G04 APERTURE LIST*
%TA.AperFunction,Profile*%
%ADD10C,0.050000*%
%TD*%
G04 APERTURE END LIST*
D10*
X120000000Y-50000000D02*
X220000000Y-50000000D01*
X220000000Y-150000000D01*
X120000000Y-150000000D01*
X120000000Y-50000000D01*
M02*
Karel-Tavernier commented 6 months ago

If you define the outline with a region it must be filled; the contour of the region defines the outline of the PCB, and its interior defines where the PCB is. This is needed because a PCB can have holes. However, the outline is usually defined by traces with small width. Theoretically this is less good, but this is what people are used to. And this is what KiCad does. The second example in the documentation is an outline constructed in this manner, the program shows how to do it. Please have a look at the documentation.