I’m curious to know…
If opening the PCB in a Text-Editor, what gets listed for a Footprint’s Courtyard Layer?
Here’s an Example of mine (typical of all mine that have Courtyards on Front…
I’m curious to know…
If opening the PCB in a Text-Editor, what gets listed for a Footprint’s Courtyard Layer?
Here’s an Example of mine (typical of all mine that have Courtyards on Front…
Thanks for following up…
I agree with
Something fishy…
I haven’t tried messing with the Format, in particular, Indentation. Your Indentation is different from mine (screenshot).
Also, the Python version can make a difference…
Python is verrrrrrry picky about indentation. And, version’s can simply Not run some previously Good Code… Perhaps not in this case but, possibly??
Even fishier. Now I get 0.0 on the MacBook, after quitting and reopening the same project.
So I don’t think it’s version/OS related. Something to do with GetCourtyard and the state of the board.
After setting fp to the selected footprint:
>>> fp.GetReferenceAsString()
‘J8’
>>> fp.BoardLayerCount()
26
>>> fp.GetLayer()
0
>>> fp.GetArea()
115312500000000.0
>>> fp.GetCourtyard(pcbnew.F_CrtYd).Area()
0.0
>>> fp.GetCourtyard(pcbnew.F_CrtYd).IsEmpty()
True
>>> fp.GetCachedCourtyard(pcbnew.F_CrtYd).IsEmpty()
True
I noticed the plot_board_layers module uses fp.GetEffectiveShape().BBox() as a fallback. Might be okay as a workaround, but it’s hardly a fix.
Don’t use this directly. Instead call GetCourtyard which will either return the cached courtyard or build the courtyard cache.
Also ensure your courtyards are actually completed and closed shapes.
Added in V10, because someone I know wanted it and I found it amusing to enable…discord through causing arguments to cram in more parts.
It attempts to deduplicate courtyards. It is legal to overlap courtyards and do weird shit with them if you opt to ignore the DRC, so have to account for that ![]()
https://dev-docs.kicad.org/en/apis-and-binding/index.html
I think it’s better to start with the developer documentation rather than the general user documentation.
Good to know!
Any idea why we’re getting zero sometimes, even on the same board?
Board stats look good!
Maybe better discussed in the bug report, but for now - why so? As a user, I would go to the user docs to learn about the scripting feature:
https://docs.kicad.org/9.0/id/pcbnew/pcbnew.html#scripting
Heh, and lo and behold, there’s now a link there, which seems sensible to me.
Meanwhile, in my mind the develop docs are targeted to two use cases:
So I wouldn’t instinctively go there for the Python API docs. But cross referencing wouldn’t hurt.
For what it’s worth, that doxygen link has been there for years. They’re even linked there in the 5.1 docs. (I update it to the new stable version every year but it’s otherwise the same link in the same place).