feat(pcb): add delete_graphics so a board outline can be replaced - #335
Merged
mixelpixx merged 2 commits intoAug 29, 2026
Merged
Conversation
pauliuszaleckas
force-pushed
the
feat/delete-board-graphics
branch
from
August 26, 2026 20:33
bc23f76 to
3c3bdb9
Compare
add_board_outline and set_board_size only append, so an outline was write-once: calling either twice left two overlapping rectangles and a DRC failure, and shrinking a board meant deleting the old edges by hand in KiCAD. delete_trace and delete_component were the only delete verbs on the tool surface, so nothing exposed delete_items for graphics. delete_graphics deletes top-level board graphics — lines, rects, arcs, circles, polys, curves, text, textboxes, dimensions — matching every filter given (uuids, layer, types). Resizing is now delete_graphics(layer='Edge.Cuts') then add_board_outline; both outline tools keep appending and say so. - No filter, no deletion: an unfiltered call would wipe the board's artwork. dry_run lists the matches, and its UUIDs feed back into uuids. - Only direct children of (kicad_pcb …), so a footprint's own graphics are never cut out. Zones, tracks and vias are not graphics here. - Reference images are excluded on both paths: KiCad 10's ReferenceImage is an empty placeholder, so a file-only delete would make them disagree. - An IPC rejection fails closed with no file fallback, like place_component: a reachable KiCad may hold the board. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pauliuszaleckas
force-pushed
the
feat/delete-board-graphics
branch
from
August 28, 2026 14:24
3c3bdb9 to
b165b3b
Compare
mixelpixx
added a commit
that referenced
this pull request
Aug 29, 2026
Adds `cargo xtask fix-doc-counts`, which rewrites every tool and toolset count in the documentation from router::registry. The guard is unchanged and still authoritative: doc_tool_counts fails if anything is stale. What changes is how you satisfy it. Roughly seven documents quote the catalogue totals plus a per-toolset heading in tool-directory.md, all maintained by hand, so any two PRs that add a tool conflicted by construction -- and a release that moved the counts conflicted with the entire open queue at once. v0.10.0 did that to eleven open pull requests, and I have now hand-resolved the same conflict three times (#160, #232, #335). The fixer never guesses. It rewrites a number only when that number is one of the two known previous values, and it identifies which is which by the fact that a registered/total pair always differs by exactly the meta-tool count. Presented with anything else it refuses and says so rather than writing a wrong number into every file. Detection and rewriting cover the same three spellings the guard reads -- "N tools", "N registered", "N total" -- so a half-applied run cannot look finished. Verified both directions: bumping a tool_count makes the guard fail, the fixer repairs six files and the guard passes with nothing hand-edited; reverting the registry and re-running restores all six documents byte-identical to their committed state. xtask is a workspace member but never ships -- release.yml and flake.nix both pin `-p konnect`, and the flake reads Cargo.lock directly so there is no vendor hash to refresh.
mixelpixx
added a commit
that referenced
this pull request
Aug 29, 2026
Minor: three new tools and two response-shape changes. New tools: - set_predefined_sizes / get_predefined_sizes (verification, #346) — the PCB Editor's track/via palette, which is a third .kicad_pro key distinct from DRC floors and netclass optima. - delete_graphics (pcb_board, #335) — the missing generic delete verb, so a board outline can be replaced instead of only appended to. Response-shape changes, both toward reporting what is true: - get_netclasses reports settings resolved, with `inherits` naming what a class takes from the Default and `missing_fields` naming what nothing resolves (#333). Callers reading null as "unset" need updating: null claimed a class had no clearance when it inherited the Default's. - auto_place_from_schematic and refine_placement_force_directed report `held`, naming every footprint they refused to move and why (#350). Correctness: - Neither placement planner relocates a footprint KiCad has locked. The lock was never parsed at all, so both planners moved locked parts (#350). - update_footprints_from_library accepts the fp_text user that 15,238 of 15,447 official footprints carry, losslessly (#331). - design_review, sch_analysis, sch_export and sch_batch resolve pins through the placed unit; #182 is closed. - The Default netclass is written complete, and a incomplete one repaired (#326) — junction dots were suppressed project-wide. - Per-user Windows KiCad installs are discovered (#254); MCP startup no longer reinstalls guidance after an explicit uninstall (#242); placed symbols carry Datasheet and Description from the library (#226). Project: - GOVERNANCE.md states how the project is run; CODEOWNERS registers areas. - `cargo xtask fix-doc-counts` derives every documented count from the registry, so tool-adding PRs no longer conflict by construction. 20 toolsets, 217 registered tools, 223 total.
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.
Stacked on #334 — that PR's commit is the first of the two shown here, because
GitHub cannot base a fork PR on another fork branch. Review only the second commit;
merging #334 first collapses this to a single-commit diff.
add_board_outlineandset_board_sizeboth append fourEdge.Cutslines, socalling either a second time leaves two overlapping rectangles and a DRC failure.
The board outline was effectively write-once: shrinking a board mid-layout meant
deleting the old one by hand in KiCad. The IPC client already had
delete_items,but no tool exposed it for graphics —
delete_traceanddelete_componentwerethe only delete verbs on the tool surface.
delete_graphics(pcb_board) is that missing generic delete verb. It removestop-level board graphics — lines, rects, arcs, circles, polys, curves, text,
textboxes, dimensions — matching every filter given (
uuids,layer,types),so resizing an outline is
delete_graphics(layer='Edge.Cuts')thenadd_board_outline.Deliberate choices:
add_board_outlineandset_board_sizekeep appending. They are public API andreplacing silently would be a behaviour change; their descriptions now say they
append and point at this tool.
"delete everything".
New in
konnect-ipc:get_board_graphics_in(shapes, text, textboxes, dimensionsread in one
GetItemsrequest, dispatched ontype_url).Tool count moves 206 → 207 across
registry.rs,tool-directory.md,DEV.md,README.md,packaging/metadata.json, andplugin/plugin.json.Gate run locally on this commit:
cargo test --workspace --locked --lib --tests,cargo test --workspace --locked --doc,cargo clippy --workspace --locked -- -D warnings,cargo fmt --all -- --check.