Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
Pass unit field through to kicad-sch-api's native multi-unit validation instead of custom bypass. Removes _add_multi_unit() that used incompatible internal API (_add_item vs _add_item_to_collection across API versions).
44 lines
2.0 KiB
Markdown
44 lines
2.0 KiB
Markdown
# Message 003
|
|
|
|
| Field | Value |
|
|
|-------|-------|
|
|
| From | timbre-phase1-project |
|
|
| To | mckicad-dev |
|
|
| Date | 2026-03-08T22:30:00Z |
|
|
| Re | apply_batch ignores `unit` field — multi-unit components (TL072) can't be fully placed |
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
After the library fix landed (thanks — SamacSys resolves now), `apply_batch` fails when placing multiple units of the same reference. The `unit` field in component entries is silently ignored. All placements default to unit 1, causing "Unit 1 of reference 'U2' already exists" on the second entry.
|
|
|
|
## Reproduction
|
|
|
|
```json
|
|
{"lib_id": "Amplifier_Operational:TL072", "reference": "U2", "value": "TL072", "x": 300, "y": 102, "unit": 1},
|
|
{"lib_id": "Amplifier_Operational:TL072", "reference": "U2", "value": "TL072", "x": 300, "y": 145, "unit": 3},
|
|
{"lib_id": "Amplifier_Operational:TL072", "reference": "U2", "value": "TL072", "x": 300, "y": 175, "unit": 2}
|
|
```
|
|
|
|
Error: `"Unit 1 of reference 'U2' already exists in schematic"`
|
|
|
|
## Impact
|
|
|
|
The TL072 is a dual op-amp with 3 units in KiCad's standard library:
|
|
- Unit 1: op-amp A (pins 1, 2, 3) — used in our Sallen-Key filter
|
|
- Unit 2: op-amp B (pins 5, 6, 7) — unused, needs no-connects
|
|
- Unit 3: power (pins 4, 8) — V+ to +5V, V- to GND
|
|
|
|
Without multi-unit support, only unit 1 is placed. Pins 4, 5, 6, 7, 8 don't exist in the schematic, so power_symbols and no_connects referencing those pins also fail.
|
|
|
|
## Workaround
|
|
|
|
Removed the extra U2 entries, power_symbols for U2:4/U2:8, and no_connects for U2:5/6/7. The signal section (pins 1, 2, 3) works correctly. ERC will warn about unplaced units and missing power connections, which is acceptable for a bench prototype.
|
|
|
|
## Feature request
|
|
|
|
Support a `unit` field in `apply_batch` component entries, allowing the same reference to be placed multiple times at different positions with different unit numbers. This is standard KiCad behavior for multi-unit symbols (op-amps, logic gates, etc.).
|
|
|
|
`add_component` would also benefit from a `unit` parameter.
|