Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for incorrectly identified drill file #2

Closed
ju5t opened this issue Apr 24, 2018 · 3 comments
Closed

Workaround for incorrectly identified drill file #2

ju5t opened this issue Apr 24, 2018 · 3 comments

Comments

@ju5t
Copy link
Contributor

ju5t commented Apr 24, 2018

It should probably be enough to change stackupZip to the following code (and include whats-that-gerber):

function stackupZip(zip) {
  return jszip.loadAsync(zip)
    .then(zip => {
      const files = [];
      zip.forEach((path, file) => {
        if (!file.dir) {
          const layerType = whatsThatGerber(file)
          files.push(
            file
              .async("text")
              .then(contents => ({
                gerber: contents,
                filename: path,
                options: {
                  filetype: (layerType === 'drl') ? 'drill' : 'gerber'
                }
              }))
          );
        }
      });
      return Promise.all(files);
    })
}

Ref:
mcous/gerber-plotter#14 (comment)
mcous/gerber-parser#23

ju5t added a commit that referenced this issue Apr 24, 2018
@ju5t ju5t closed this as completed Apr 24, 2018
@mcous
Copy link

mcous commented Apr 25, 2018

Just FYI, this is actually a workaround for mcous/gerber-parser#23

@ju5t ju5t changed the title Workaround for plotter crash on stroke with non-existent tool Workaround for incorrectly identified drill file Apr 25, 2018
@ju5t
Copy link
Contributor Author

ju5t commented Apr 25, 2018

@mcous thanks, I've updated the subject and description.

@ju5t
Copy link
Contributor Author

ju5t commented Aug 2, 2018

It turns out that const layerType = whatsThatGerber(file) should be const layerType = whatsThatGerber(path).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants