-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Fails to load .gdo gerber files #360
Comments
Can you provide the Gerber file? If not, can you patch the code? What happens when you add a check in there? var runMacro = function(mods, blocks) {
var emptyMacro = {shape: [], box: boundingBox.new()}
var exposure = 1
blocks = blocks || []
return blocks.reduce(function(result, block) {
var shapeAndBox
// add this below
if (block == null) {
return result
}
if (block.type !== 'variable' && block.type !== 'comment') {
|
I'm not sure, I'm using the I can't provide the whole gerber, but essentially here is the issue:
This set from Mentor had those options, and then defined some custom shapes, and then finally had the instructions:
If I remove the custom shape definition sections (AMVB_RECTANGLE, AMVB_Custom..., etc) from the file, then it parses correctly with no issues. There may be some rectangles that are drawn incorrectly, as those shapes are referenced in the instructions later in the file, but as far as I'm aware the gerbers are essentially correct for 99% of use cases. I'll try patching the code and report back results. My guess is |
@kasbah Adding that check prevents the error and allows the gerbers to render. Now the issue is that the gerbers are rendered slightly incorrectly (but this is at least better than the code breaking!) I have found the issue for my gerber set -- the gerber specifies G74* (Disable 360° circular interpolation (single quadrant)) |
Best guess is that @mehulmshah are you able to post the full contents of these aperture blocks? Everything (including newlines) starting with You could also trying running the file through just the parser using the example code: var fs = require('fs')
var gerberParser = require('gerber-parser')
var parser = gerberParser()
parser.on('warning', function(w) {
console.warn('warning at line ' + w.line + ': ' + w.message)
})
fs.createReadStream('/path/to/gerber/file.gbr')
.pipe(parser)
.on('data', function(obj) {
console.log(JSON.stringify(obj))
}) I'd be curious what, if any warnings popped out |
@mcous I think your assessment is correct. I'd prefer not to post the contents publicly on this Issue, but if you let me know your email I'm happy to privately message you the full file so you can take a look. I'll try running it through the parser as well and see what the results are. Thoughts on adding Interpolation settings to Gerber Settings? It looks like other CAM software is able to open these Gerbers (although I'm not sure how considering the Gerber says G74 (Disable circular interpolation), but it only renders correctly when I manually change to G75 (enable multiquadrant circular interpolation) |
I would say the arc thing is separate from the macro parsing issue, and that I'd heavily suspect you're running into #82 with those arcs. If so, then I don't think extra plotting settings are the right move to work around a bug in the plotter |
Tried to upload a set of Gerber Files exported from Mentor PADS (extension .gdo).
Error I get is:
Uncaught TypeError: Cannot read property 'type' of undefined
from_pad-shape.js:239
Those few lines of code:
Line 239 is the last line^, looks like
block
is undefined... not sure if there needs to be some type of parsing adding for Mentor files, or if there just needs to be a check that returns from the function ifblock===undefined
The text was updated successfully, but these errors were encountered: