-
Notifications
You must be signed in to change notification settings - Fork 5
Mask overlapping outlines is not removed in board view #20
Comments
So this is an interesting problem, because the board outline gerber has a tiny, 0.0001in gap in the outline (at lines 454 and 455 in BusPirate-v3.6-SSOP.gko). The board shape feature works by building a graph of adjacent outline points and walking them in order to create a manifold shape that can be filled to mask the board. If it fails to find a manifold shape it will fall back to just drawing the board as a rectangle with the outline indicated by a line. Neither the old builder or the new builder has any sort of gap repair functionality, although this certainly provides a good case for when it would be needed. |
I see (though I can't decipher the gerber format yet). There is a similar problem with the MC HCK gerbers (now in mm!) and I have seen it on a few other boards as well so I think closing gaps would be really good. |
I've looked at those MC HCK gerbers, and there's a slightly different problem with them: the outline is manifold, but it's drawn using three different tool sizes (line widths). The (new) outline builder splits shapes up by tool size for safety. That being said, in this case the tool sizes are 0.1 mm, 0.0996mm, and 0.09906 mm, so I'm thinking by default the outline builder should combine tools that are within some size threshold, and also have an option to combine all tools. |
I looked into this a bit but I am really struggling. So the outline builder will crash on this (ith) i - 1:
{ x: 438.6,
y: 617.6,
segments:
[ { seg:
{ start:
{ x: 438.8,
y: 609.9,
segments:
[ { seg: [Object], rel: 'end' },
{ seg: [Circular], rel: 'start' },
{ seg: [Object], rel: 'end' },
{ seg: [Object], rel: 'start' } ] },
end: [Circular] },
rel: 'end' },
{ seg:
{ start: [Circular],
end:
{ x: 438.8,
y: 609.9,
segments:
[ { seg: [Object], rel: 'end' },
{ seg: [Object], rel: 'start' },
{ seg: [Circular], rel: 'end' },
{ seg: [Object], rel: 'start' } ] } },
rel: 'start' } ] }
i:
{ x: 438.7,
y: 617.6,
segments:
[ { seg:
{ start: [Circular],
end:
{ x: 438.7,
y: 1759.3,
segments: [ { seg: [Circular], rel: 'end' } ] } },
rel: 'start' } ] }
i + 1:
{ x: 438.7,
y: 1759.3,
segments:
[ { seg:
{ start:
{ x: 438.7,
y: 617.6,
segments: [ { seg: [Circular], rel: 'start' } ] },
end: [Circular] },
rel: 'end' } ] } |
So the gap is the fact that Point i-1 and Point i were created as separate points. I haven't tried anything with this yet, but I think the key to gap filling will be this line and this line in build-board-outline.coffee. Those two lines are responsible for checking if a given point has been recorded already, and if they could be expanded to check not only points with the exact same coordinates but also coordinates within some tiny distance, we might be able to fix our problem. |
I had an incling that was it and did try this: diff --git a/src/build-board-outline.coffee b/src/build-board-outline.coffee
index 5deed2d..26dc413 100644
--- a/src/build-board-outline.coffee
+++ b/src/build-board-outline.coffee
@@ -67,7 +69,10 @@ module.exports = (outline) ->
if i >= outline.length then break
else
start = find points, { x: x, y: y }
- if not start? then newStart = true; start = new Point x, y
+ if not start?
+ start = find points, (p) ->
+ Math.abs(p.x - x) <= 0.1 && Math.abs(p.y - y) <= 0.1
+ if not start? then newStart = true; start = new Point x, y
# check our current character again to get the end of the segment
if outline[i] is 'L'
@@ -91,7 +96,10 @@ module.exports = (outline) ->
# set the path start if ncessary
if not pathStart? then pathStart = start
end = find points, { x: x, y: y }
- if not end? then newEnd = true; end = new Point x, y
+ if not end?
+ end = find points, (p) ->
+ Math.abs(p.x - x) <= 0.1 && Math.abs(p.y - y) <= 0.1
+ if not end? then newEnd = true; end = new Point x, y But that made the whole board disappear and trying it with a threshold of 0.01 still has the same |
The whole board disappearing is interesting and sounds like you might be on the right track and hitting a different bug entirely. what does the board mechanical mask layer SVG look like? |
This is the top.svg and this is the |
The Bus Pirate v3.6 gerbers are a good example. The edges are rounded but the mask just keeps going.
The text was updated successfully, but these errors were encountered: