{"action":"opened","issue":{"url":"https://api.github.com/repos/curtacircuitos/pcb-tools/issues/48","labels_url":"https://api.github.com/repos/curtacircuitos/pcb-tools/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/curtacircuitos/pcb-tools/issues/48/comments","events_url":"https://api.github.com/repos/curtacircuitos/pcb-tools/issues/48/events","html_url":"https://github.com/curtacircuitos/pcb-tools/issues/48","id":120632151,"number":48,"title":"AMs not correctly persisted when parsing then writing gerber","user":{"login":"geekman","id":563153,"avatar_url":"https://avatars.githubusercontent.com/u/563153?v=3","gravatar_id":"","url":"https://api.github.com/users/geekman","html_url":"https://github.com/geekman","followers_url":"https://api.github.com/users/geekman/followers","following_url":"https://api.github.com/users/geekman/following{/other_user}","gists_url":"https://api.github.com/users/geekman/gists{/gist_id}","starred_url":"https://api.github.com/users/geekman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geekman/subscriptions","organizations_url":"https://api.github.com/users/geekman/orgs","repos_url":"https://api.github.com/users/geekman/repos","events_url":"https://api.github.com/users/geekman/events{/privacy}","received_events_url":"https://api.github.com/users/geekman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-06T12:43:19Z","updated_at":"2015-12-06T12:43:19Z","closed_at":null,"body":"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:\r\n\r\n    f = gerber.read('test.gto')\r\n    f.write('test2.gto')\r\n\r\nThe AM from my file looks like this:\r\n\r\n    %AMOC8*\r\n    5,1,8,0,0,1.08239X$1,22.5*\r\n    %\r\n\r\nFirstly, `self.primitives` is empty as `__init__` doesn't convert `self.instructions` into `self.primitives`.\r\n\r\nSecondly, 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.\r\n"}}