pcb-tools icon indicating copy to clipboard operation
pcb-tools copied to clipboard

AMs not correctly persisted when parsing then writing gerber

Open geekman opened this issue 9 years ago • 1 comments

I'm using the library to modify gerbers, but aperture macros (AMs) are not being correctly persisted after the file is written out. Sample code is below:

f = gerber.read('test.gto')
f.write('test2.gto')

The AM from my file looks like this:

%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%

Firstly, self.primitives is empty as __init__ doesn't convert self.instructions into self.primitives.

Secondly, 2e2b4e49c3182cc7385f12d760222ecb57cc1356 is not a good way to handle the issue because macros may contain variables ($1 in this example). Even if I called self.build() to populate self.primitives, the variables cannot be preserved this way.

geekman avatar Dec 06 '15 12:12 geekman

@geekman, I've added a test case to catch this on #49 . Help there is welcome, I'll have a busy week.

phsilva avatar Dec 06 '15 23:12 phsilva