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

Spacing issue with PinSocket and PinHeader holes #10

Open
ghost opened this issue Apr 24, 2024 · 2 comments
Open

Spacing issue with PinSocket and PinHeader holes #10

ghost opened this issue Apr 24, 2024 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 24, 2024

There's a strange issue when rendering pin holes for PinHeader and PinSocket footprints. (standard arduino headers)

esp32_motor-pcb-x3_final-pcbflow_preview_all

It seems to add an additional, invisible hole every time a hole is drilled onto the board.

So rather than going 1, 2, 3, 4 -- it'll go 1, 3, 5, etc.

Must be some kind of maths problem. Here's where the bug manifests within the footprint, I just need to be able to locate the exact logic in the code:

  (pad 1 thru_hole rect (at 0 0) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 2 thru_hole oval (at 0 2.54) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 3 thru_hole oval (at 0 5.08) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 4 thru_hole oval (at 0 7.62) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 5 thru_hole oval (at 0 10.16) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 6 thru_hole oval (at 0 12.7) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 7 thru_hole oval (at 0 15.24) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
  (pad 8 thru_hole oval (at 0 17.78) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))

It gets the spacing right for the first two pads, but as soon as it loops through repeated hole shapes - it becomes an exponential pattern.

@ghost
Copy link
Author

ghost commented Apr 25, 2024

Fixed with the following code:

        for pad in self.pin_pads:
            diameter = pad["size"][0]
            dc.push()
            dc.goxy(*pad["xy"])
            dc.board.add_drill(dc.xy, pad["drill"])
            shape = pad["shape"]
            if shape in ["long", "circle", "octagon", "rect", "oval"]:
                n = {"long": 60, "circle": 60, "octagon": 8, "rect": 4, "oval": 60}[shape]
                if shape in ["rect", "oval"]:
                    diameter /= 1.1
                p = dc.copy()
                p.n_agon(diameter / 2, n)
                p.set_name(pad["name"])
                p.part = self.id
                self.pads.append(p)
                p.pin_pad()
                dc.pop()

I have forked a copy of pcbflow to include the fixes on my own account, since I will probably be fixing a lot of bugs, and maybe adding new features. cheers

esp32_motor-pcb-x3_final-pcbflow_preview_all

@michaelgale
Copy link
Owner

@khanumballz Great job! Thanks for the fix! I'd be happy to fold them into the main repo with a PR whenever you're ready.

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

1 participant