Dimensions don't line up!

I’m making a board, and want to use a pair of 4 x 6 inch piece of plastic as a case. I wanted to make it easy to locate the holes on the plastic sheet, so I arranged it so the holes would be 0.5 inches, 12.5mm, from the edge. Since my board is smaller than 4x6 inches, I made a border around the layout. The border is 101.6mm x 152.4mm (4 x 6). Measuring this shows exactly 101.6 in the x axis. I placed the holes 0.5 inches, 12.5mm, from the edge of the border that’s 4x6. Since the x length is 101.6 and the distances from the holes are 12.5, the distance between the holes SHOULD be 76.2 (3 inches), but it’s 76.6. Is this a rounding error converting inches to mm? Something else?

0.5 inch = 12.7 mm exactly. The inch or foot has been defined in terms of the metre for a while now.

1 Like

I was also tempted to state that, and then noticed he correctly calculated:

25.4 * 4 = 101.6
25.4 * 6 = 152.39999999999998
25.4 * 3 = 76.19999999999999

(Silly computer floating point rounding thing.) For this reason KiCad avoids the use of floating point calculations wherever possible. KiCad’s native format are 32 bit integers interpreted as nanometer resolution.

You can also freely switch between a normal grid and the banana grid in KiCad without penalties, as KiCad internally always uses metric (For the PCB at least) So if you want to do some things such as easily lining up PCB headers or mounting holes on a grid in inches, then just set the grid to a convenient fraction of that unit.

It is indeed something else. When you place the holes 12.5mm from the edge, that 0.2mm less than half a banana. So the pitch between the two holes becomes 0.4mm too big.

I often use the location (127mm, 127mm) as a reference somewhere on my PCB because it lines up with both grids, and usually gets the whole PCB within the paper size. But you can move both the grid origin and the “Drill / Place File” to any location you like. KiCad also has some settings in the preferences for how to handle coordinates during exports and gerber file creation.

Silly me, Thanks for the help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.