PCBNew GetBoardEdgesBoundingBox() anomaly

Using PCBNew 5.1.9.

The GetBoardEdgesBoundingBox() returns an EDA_RECT that includes the width of the board edge lines (on the Edge.Cuts layer), and thus does not accurately report the cuts themselves.

This would make sense if this was a function concerned with the graphics extent of the drawing lines of the board. However it does not make sense in trying to determine the coordinates of the edge of the board itself, for use as a frame of reference for the components on the board.

Instead, I think we want a function that excludes the width of the Edge.Cuts lines. Ie: for rectangular boards, it would report the coordinates of the corner points of the four edge cut lines.

(Of course, with the existing function, we could add/subtract the half-widths of the Edge.Cuts line, but for that we need to know the width of the line, which is tedious to discover, or brittle if hard-coded.)

Am I thinking about this right? Have I missed some other function that does what I want?

As far as I know all the functions are for KiCad internal use and they are just exposed to the python API (I assume you mean the python API). It just happens that what you want isn’t needed internally.

1 Like

Indeed, GetBoardEdgesBoundingBox is used internally for situations where the graphical extents are needed.

1 Like

Consensus seems to be there is no actual board-edge-locating function. OK, thanks for the responses!

Here’s some code for inspiration. It takes into account line thickness as well but should be easy to modify to not do that.

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