boldport / pcbmode

A printed circuit board design tool with a twist
MIT License
405 stars 59 forks source link

Gerber outline not watertight #50

Open JarrettR opened 6 years ago

JarrettR commented 6 years ago

I think this is a gerber output error. I haven't delved into it much, so I'm not sure whether this error is a bug in the viewer, the generator, the SVG parser, etc. Either way, it is a compatibility issue.

The outline of my board is:

 "outline": {
    "shape": {
      "height": 36,
      "radii": {
        "bl": 3,
        "br": 3,
        "tl": 3,
        "tr": 3
      },
      "type": "path",
      "value": "m 0.128613,-18.458008 c 0,0 -0.559852,0.105145 -1.120508,0.52168 l -2.782617,-0.359571 c 0,0 -0.333081,0.149523 -0.686914,0.484375 l -2.985937,0.257227 c 0,0 -0.397779,0.294579 -0.694532,0.833203 l -2.570898,0.861328 c 0,0 -0.258334,0.308915 -0.419531,0.801758 l -2.309375,1.407031 c 0,0 -0.223306,0.434435 -0.236133,1.033203 l -1.707227,1.695703 c 0,0 -0.07391,0.304244 -0.0332,0.720118 l -1.396484,2.1576167 c 0,0 -0.0069,0.300477 0.114844,0.683985 l -0.84336,2.428906 c 0,0 0.07457,0.337591 0.325,0.705859 l -0.255664,2.308985 c 0,0 0.178355,0.380056 0.578907,0.703125 l 0.25664,2.050781 c 0,0 0.16796,0.20997 0.47207,0.400586 l 0.73418,2.082031 c 0,0 0.283396,0.229285 0.722266,0.341602 l 1.088281,1.674804 c 0,0 0.268018,0.12728 0.649219,0.151367 l 1.429297,1.387696 c 0,0 0.351212,0.079039 0.780664,-0.022266 l 1.524023,1.904883 c 0,0 0.230461,-0.00377 0.519141,-0.10918 l 1.796875,0.598242 c 0,0 0.276241,-0.06438 0.567773,-0.276367 l 1.675,0.163867 c 0,0 0.227128,-0.110549 0.445703,-0.351367 l 1.683008,-0.214062 c 0,0 0.239399,-0.191564 0.400195,-0.53125 l 1.41211,-0.533399 -0.011133,0.143164 c 0.088135,2.137288 0.569198,3.6336573 6.786523,4.9357433 6.081849,1.273715 4.186329,6.874609 4.186329,6.874609 l 3.569531,-3.305273 c 0,0 0.173058,-0.619132 0.08418,-1.442188 l 2.437696,-3.563867 c 0,0 0.03964,-0.7788883 -0.334766,-1.6587893 l 1.37168,-3.588477 c 0,0 -0.09201,-0.491403 -0.424219,-1.069922 l 0.616016,-4.056836 c 0,0 -0.264408,-0.623967 -0.885938,-1.191797 l -0.321289,-3.698632 c 0,0 -0.328456,-0.443046 -0.932812,-0.815821 l -1.13125,-3.52539 c 0,0 -0.506786,-0.436622 -1.29961,-0.6458987 l -1.708984,-2.816797 c 0,0 -0.381164,-0.19584 -0.947461,-0.275195 l -2.424023,-2.551563 c 0,0 -0.50944,-0.135975 -1.172852,-0.04316 L 4.11475,-17.524605 c 0,0 -0.469307,-0.01693 -0.038476,0.187109 z",
      "width": 36
    }
  }

The OSHPark gerber viewer displays: image

As you can see, it is not watertight. That's the beginning/end point of the SVG path at the top.

I hacked on a straight line to very end of the SVG, going back to the origin:

"outline": {
    "shape": {
      "height": 36,
      "radii": {
        "bl": 3,
        "br": 3,
        "tl": 3,
        "tr": 3
      },
      "type": "path",
      "value": "m 0.128613,-18.458008 c 0,0 -0.559852,0.105145 -1.120508,0.52168 l -2.782617,-0.359571 c 0,0 -0.333081,0.149523 -0.686914,0.484375 l -2.985937,0.257227 c 0,0 -0.397779,0.294579 -0.694532,0.833203 l -2.570898,0.861328 c 0,0 -0.258334,0.308915 -0.419531,0.801758 l -2.309375,1.407031 c 0,0 -0.223306,0.434435 -0.236133,1.033203 l -1.707227,1.695703 c 0,0 -0.07391,0.304244 -0.0332,0.720118 l -1.396484,2.1576167 c 0,0 -0.0069,0.300477 0.114844,0.683985 l -0.84336,2.428906 c 0,0 0.07457,0.337591 0.325,0.705859 l -0.255664,2.308985 c 0,0 0.178355,0.380056 0.578907,0.703125 l 0.25664,2.050781 c 0,0 0.16796,0.20997 0.47207,0.400586 l 0.73418,2.082031 c 0,0 0.283396,0.229285 0.722266,0.341602 l 1.088281,1.674804 c 0,0 0.268018,0.12728 0.649219,0.151367 l 1.429297,1.387696 c 0,0 0.351212,0.079039 0.780664,-0.022266 l 1.524023,1.904883 c 0,0 0.230461,-0.00377 0.519141,-0.10918 l 1.796875,0.598242 c 0,0 0.276241,-0.06438 0.567773,-0.276367 l 1.675,0.163867 c 0,0 0.227128,-0.110549 0.445703,-0.351367 l 1.683008,-0.214062 c 0,0 0.239399,-0.191564 0.400195,-0.53125 l 1.41211,-0.533399 -0.011133,0.143164 c 0.088135,2.137288 0.569198,3.6336573 6.786523,4.9357433 6.081849,1.273715 4.186329,6.874609 4.186329,6.874609 l 3.569531,-3.305273 c 0,0 0.173058,-0.619132 0.08418,-1.442188 l 2.437696,-3.563867 c 0,0 0.03964,-0.7788883 -0.334766,-1.6587893 l 1.37168,-3.588477 c 0,0 -0.09201,-0.491403 -0.424219,-1.069922 l 0.616016,-4.056836 c 0,0 -0.264408,-0.623967 -0.885938,-1.191797 l -0.321289,-3.698632 c 0,0 -0.328456,-0.443046 -0.932812,-0.815821 l -1.13125,-3.52539 c 0,0 -0.506786,-0.436622 -1.29961,-0.6458987 l -1.708984,-2.816797 c 0,0 -0.381164,-0.19584 -0.947461,-0.275195 l -2.424023,-2.551563 c 0,0 -0.50944,-0.135975 -1.172852,-0.04316 L 4.11475,-17.524605 c 0,0 -0.469307,-0.01693 -0.038476,0.187109 L 0.128613,-18.458008 z",
      "width": 36
    }
  }

This doesn't seem to have an effect on the path (before / after images look identical): image

OSHPark's gerber viewer now shows:

image

Good enough! (tm)

I'll have full board files up on Github eventually, but I suspect that any board with the outline I've posted will do the same thing if someone wants to reproduce.

threebytesfull commented 6 years ago

Have you tried this against my development branch? It's a while since I worked on the path maths but I made some changes to the bezier handling and it's possible that it fixes the issue you see there...

JarrettR commented 6 years ago

That's the branch I'm using, actually, should have mentioned. Didn't consider that gerber generation could have changed, my bad.

Neon22 commented 6 years ago

weirdly your initial svg has a z on the end and this should have joined it back up to make a closed path. So probably the SVG is not being interpreted correctly...?

saardrimer commented 6 years ago

Sorry for the late response. @Neon22 is correct. The 'z' at the end is not dealt with appropriately by PCBmodE. What I do is split one of the 'offending' nodes using the 'Break path' tool. That's it. Now it should appear closed on the Gerber.

saardrimer commented 4 years ago

I'm starting to work on the next version of PCBmodE at branch cinco-master. This is definately something to fix as part of the SVG processing review.