leomcelroy / svg-pcb

Design PCBs in the Browser
https://www.leomcelroy.com/svg-pcb-website
GNU General Public License v3.0
64 stars 9 forks source link

Getting via pad radius instead of diameter #51

Closed kr15h closed 1 year ago

kr15h commented 1 year ago

I am calculating the size of a via pad using the state.pcb.components[x].footprint.via.shape variable and I get half the size I expect. I am getting a weird size actually, as I see that the radius of the drill is exactly 1/2 of the pad, and I get 0.864 for the drill diameter and 0.894 for the pad. I wonder where did the calc go wrong?

image

kr15h commented 1 year ago

Ah, i see, it is because of this.

const via = (diameterHole, diameterCopper, layers = ["F.Cu", "B.Cu"]) => ({
  "via": {
    pos: [0, 0],
    layers: layers,
    shape: getPathData(circle(diameterCopper/2)),
    drill: {
      diameter: diameterHole,
      start: layers[0],
      end: layers[1],
      plated: true
    },
  }
})

More specifically this.

shape: getPathData(circle(diameterCopper/2)),

I will just multiply it by 2.

kr15h commented 1 year ago

It was actually something related to rounding the values.