feat(board): add InteractiveMoveItems API and CLI command

This commit is contained in:
Milind Sharma 2026-02-20 18:59:02 +08:00
parent deb03b9c48
commit cdf37bb7b6
4 changed files with 192 additions and 4 deletions

View File

@ -46,6 +46,7 @@ Deferred manual/runtime verification (implemented after 2026-02-20 while user un
- `SetNetClasses`
- `SetTextVariables`
- `UpdateBoardStackup`
- `InteractiveMoveItems`
## KiCad v10 RC1.1 API Completion Matrix
@ -68,9 +69,9 @@ Legend:
| Common (base) | 6 | 6 | 100% |
| Common editor/document | 23 | 23 | 100% |
| Project manager | 5 | 5 | 100% |
| Board editor (PCB) | 22 | 21 | 95% |
| Board editor (PCB) | 22 | 22 | 100% |
| Schematic editor (dedicated proto commands) | 0 | 0 | n/a |
| **Total** | **56** | **55** | **98%** |
| **Total** | **56** | **56** | **100%** |
### Common (base)
@ -146,7 +147,7 @@ Legend:
| `SetActiveLayer` | Implemented | `KiCadClient::set_active_layer` |
| `GetBoardEditorAppearanceSettings` | Implemented | `KiCadClient::get_board_editor_appearance_settings_raw`, `KiCadClient::get_board_editor_appearance_settings` |
| `SetBoardEditorAppearanceSettings` | Implemented | `KiCadClient::set_board_editor_appearance_settings` |
| `InteractiveMoveItems` | Not yet | - |
| `InteractiveMoveItems` | Implemented | `KiCadClient::interactive_move_items_raw`, `KiCadClient::interactive_move_items` |
### Schematic editor

View File

@ -364,6 +364,12 @@ Refill all zones:
cargo run --bin kicad-ipc-cli -- refill-zones
```
Start interactive move tool for one or more item IDs:
```bash
cargo run --bin kicad-ipc-cli -- interactive-move --id <uuid> --id <uuid>
```
Show typed netclass map:
```bash

View File

@ -65,6 +65,7 @@ const CMD_GET_BOARD_EDITOR_APPEARANCE_SETTINGS: &str =
"kiapi.board.commands.GetBoardEditorAppearanceSettings";
const CMD_SET_BOARD_EDITOR_APPEARANCE_SETTINGS: &str =
"kiapi.board.commands.SetBoardEditorAppearanceSettings";
const CMD_INTERACTIVE_MOVE_ITEMS: &str = "kiapi.board.commands.InteractiveMoveItems";
const CMD_GET_ITEMS_BY_NET: &str = "kiapi.board.commands.GetItemsByNet";
const CMD_GET_ITEMS_BY_NET_CLASS: &str = "kiapi.board.commands.GetItemsByNetClass";
const CMD_GET_NETCLASS_FOR_NETS: &str = "kiapi.board.commands.GetNetClassForNets";
@ -1612,6 +1613,35 @@ impl KiCadClient {
self.get_board_editor_appearance_settings().await
}
pub async fn interactive_move_items_raw(
&self,
item_ids: Vec<String>,
) -> Result<prost_types::Any, KiCadError> {
if item_ids.is_empty() {
return Err(KiCadError::Config {
reason: "interactive_move_items_raw requires at least one item id".to_string(),
});
}
let command = board_commands::InteractiveMoveItems {
board: Some(self.current_board_document_proto().await?),
items: item_ids
.into_iter()
.map(|value| common_types::Kiid { value })
.collect(),
};
let response = self
.send_command(envelope::pack_any(&command, CMD_INTERACTIVE_MOVE_ITEMS))
.await?;
response_payload_as_any(response, RES_PROTOBUF_EMPTY)
}
pub async fn interactive_move_items(&self, item_ids: Vec<String>) -> Result<(), KiCadError> {
let _ = self.interactive_move_items_raw(item_ids).await?;
Ok(())
}
pub async fn get_title_block_info(&self) -> Result<TitleBlockInfo, KiCadError> {
let command = common_commands::GetTitleBlockInfo {
document: Some(self.current_board_document_proto().await?),

File diff suppressed because one or more lines are too long