Skip to content

Fix KiCad 10 footprint cast — Cast_to_FOOTPRINT was removed#240

Open
jafrado wants to merge 1 commit intobennymeg:masterfrom
jafrado:master
Open

Fix KiCad 10 footprint cast — Cast_to_FOOTPRINT was removed#240
jafrado wants to merge 1 commit intobennymeg:masterfrom
jafrado:master

Conversation

@jafrado
Copy link
Copy Markdown

@jafrado jafrado commented Apr 26, 2026

The existing duplicate_footprint() already handles KiCad 10's Duplicate(addToParentGroup) signature, but the cast back to FOOTPRINT afterward still relies on pcbnew.Cast_to_FOOTPRINT(). That helper was removed in KiCad 10 in favor of a .Cast() method on the returned BOARD_ITEM object. Without the cast, downstream calls like SetOrientationDegrees() fail with 'BOARD_ITEM' object has no attribute 'SetOrientationDegrees' whenever a footprint is rotated to a non-multiple-of-90-degrees angle (common case: an inter-panel solder strip aligned to a slant edge).

This PR adds .Cast() as a fallback for KiCad 10+, while preserving the existing Cast_to_FOOTPRINT path for older versions.
Repro on KiCad 10: any board with a footprint at e.g. 80° rotation triggers the error during plugin run.
Verified on: KiCad 10.0, board with WS2812B-based design where 6 inter-panel solder strips are placed at +/-80° rotations.

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

Successfully merging this pull request may close these issues.

1 participant