Fix KiCad 10 footprint cast — Cast_to_FOOTPRINT was removed#240
Open
jafrado wants to merge 1 commit intobennymeg:masterfrom
Open
Fix KiCad 10 footprint cast — Cast_to_FOOTPRINT was removed#240jafrado wants to merge 1 commit intobennymeg:masterfrom
jafrado wants to merge 1 commit intobennymeg:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.