{"action":"created","issue":{"url":"https://api.github.com/repos/mcous/gerber-plotter/issues/14","repository_url":"https://api.github.com/repos/mcous/gerber-plotter","labels_url":"https://api.github.com/repos/mcous/gerber-plotter/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/mcous/gerber-plotter/issues/14/comments","events_url":"https://api.github.com/repos/mcous/gerber-plotter/issues/14/events","html_url":"https://github.com/mcous/gerber-plotter/issues/14","id":317178654,"number":14,"title":"Plotter crashes and burns on stroke with non-existent tool","user":{"login":"ju5t","id":3635751,"avatar_url":"https://avatars1.githubusercontent.com/u/3635751?v=4","gravatar_id":"","url":"https://api.github.com/users/ju5t","html_url":"https://github.com/ju5t","followers_url":"https://api.github.com/users/ju5t/followers","following_url":"https://api.github.com/users/ju5t/following{/other_user}","gists_url":"https://api.github.com/users/ju5t/gists{/gist_id}","starred_url":"https://api.github.com/users/ju5t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ju5t/subscriptions","organizations_url":"https://api.github.com/users/ju5t/orgs","repos_url":"https://api.github.com/users/ju5t/repos","events_url":"https://api.github.com/users/ju5t/events{/privacy}","received_events_url":"https://api.github.com/users/ju5t/received_events","type":"User","site_admin":false},"labels":[{"id":257444578,"url":"https://api.github.com/repos/mcous/gerber-plotter/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-24T11:12:20Z","updated_at":"2018-04-24T14:27:42Z","closed_at":null,"author_association":"NONE","body":"I ran into a problem today and for some reason I can't seem to `try {} catch {}` my way out of it. I get the following error when trying to parse gerber files that were created with Vutrax.\r\n\r\n```\r\n/usr/local/lib/node_modules/gerber-to-svg/node_modules/gerber-plotter/lib/_operate.js:358\r\n  if (!region && (tool.trace.length === 0)) {\r\n                       ^\r\n\r\nTypeError: Cannot read property 'trace' of null\r\n    at interpolate (/usr/local/lib/node_modules/gerber-to-svg/node_modules/gerber-plotter/lib/_operate.js:358:24)\r\n    at operate (/usr/local/lib/node_modules/gerber-to-svg/node_modules/gerber-plotter/lib/_operate.js:405:13)\r\n    at Plotter._transform (/usr/local/lib/node_modules/gerber-to-svg/node_modules/gerber-plotter/lib/plotter.js:177:18)\r\n    at Plotter.Transform._read (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_transform.js:184:10)\r\n    at Plotter.Transform._write (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_transform.js:172:83)\r\n    at doWrite (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_writable.js:418:64)\r\n    at writeOrBuffer (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_writable.js:407:5)\r\n    at Plotter.Writable.write (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_writable.js:334:11)\r\n    at Parser.ondata (/usr/local/lib/node_modules/gerber-to-svg/node_modules/readable-stream/lib/_stream_readable.js:619:20)\r\n    at Parser.emit (events.js:180:13)\r\n```\r\n\r\n@mcous I can send you the gerber files via e-mail if that helps."},"comment":{"url":"https://api.github.com/repos/mcous/gerber-plotter/issues/comments/383952594","html_url":"https://github.com/mcous/gerber-plotter/issues/14#issuecomment-383952594","issue_url":"https://api.github.com/repos/mcous/gerber-plotter/issues/14","id":383952594,"user":{"login":"mcous","id":2963448,"avatar_url":"https://avatars1.githubusercontent.com/u/2963448?v=4","gravatar_id":"","url":"https://api.github.com/users/mcous","html_url":"https://github.com/mcous","followers_url":"https://api.github.com/users/mcous/followers","following_url":"https://api.github.com/users/mcous/following{/other_user}","gists_url":"https://api.github.com/users/mcous/gists{/gist_id}","starred_url":"https://api.github.com/users/mcous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcous/subscriptions","organizations_url":"https://api.github.com/users/mcous/orgs","repos_url":"https://api.github.com/users/mcous/repos","events_url":"https://api.github.com/users/mcous/events{/privacy}","received_events_url":"https://api.github.com/users/mcous/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T14:27:42Z","updated_at":"2018-04-24T14:27:42Z","author_association":"OWNER","body":"@ju5t pcb-stackup still has the ability to [pass options into `gerber-to-svg`](https://github.com/tracespace/tracespace/blob/next/packages/pcb-stackup/API.md#layer--object)\r\n\r\n```js\r\nconst fs = require('fs')\r\nconst pcbStackup = require('pcb-stackup')\r\nconst whatsThatGerber = require('whats-that-gerber')\r\nconst shortId = require('shortid')\r\n\r\nconst fileNames = [\r\n  '/path/to/board-F.Cu.gtl',\r\n  '/path/to/board-F.Mask.gts',\r\n  '/path/to/board-F.SilkS.gto',\r\n  '/path/to/board-F.Paste.gtp',\r\n  '/path/to/board-B.Cu.gbl',\r\n  '/path/to/board-B.Mask.gbs',\r\n  '/path/to/board-B.SilkS.gbo',\r\n  '/path/to/board-B.Paste.gbp',\r\n  '/path/to/board-Edge.Cuts.gm1',\r\n  '/path/to/board.drl',\r\n  '/path/to/board-NPTH.drl',\r\n]\r\n\r\nconst layers = fileNames.map(filename => ({\r\n  filename,\r\n  gerber: fs.createReadStream(path),\r\n  options: {\r\n    id: shortId.generate()\r\n    filetype: (layerType === 'drl') ? 'drill' : 'gerber'\r\n  }\r\n}))\r\n\r\npcbStackup(layers, (error, stackup) => {\r\n  if (error) return console.error(error)\r\n\r\n  console.log(stackup.top.svg) // logs \"<svg ... </svg>\"\r\n  console.log(stackup.bottom.svg) // logs \"<svg ... </svg>\"\r\n})\r\n```"}}
{"actor":{"display_login":"mcous"}}