Commit Graph

4 Commits

Author SHA1 Message Date
Shane Ringrose 756cfd98c0 Fix terminal grouping: use functiondefinition block, not pin designation
The previous grouping compared `connectionDesignation` values (e.g. "1",
"2", "3") to detect group boundaries.  Those values are pin position
numbers within a terminal block, not functional group identifiers, so
devices like the ABB ACS880 produced 11+ tiny single-pin "groups" instead
of the ~8 functional blocks (AC-IN, Motor-OUT, DC-Bus, Brake-Resistor,
Analog-I/O, Digital-I/O, ...) the reviewer identified.

Fix:
- Add `group` field to EdzPin, populated from the `functiondefinition`
  attribute on <functiontemplate> (newer EPLAN) or its parent <function>
  element (older EPLAN).
- Sort pins by group first (preserving XML appearance order per group),
  then by designation within each group using natural sort.
- Use `groupKey()` — group when present, designation as fallback — for
  the group-break detection that drives separator lines and Y-gaps.

Parts without any functiondefinition data retain the previous
designation-based behaviour unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 01:54:23 +12:00
Shane Ringrose 27534a379b Group terminals by designation with visual separator lines
Pins are already sorted by designation (see EdzPart::parse natural sort).
This change makes same-designation groups visually obvious in the element
symbol by:

  - Inserting a 5 px gap between consecutive terminals whose designation
    differs, so each group reads as a distinct block.
  - Drawing a thin dashed horizontal line through each gap, mirroring
    the grouped-I/O style shown in typical manufacturer datasheets.

The body rectangle and bounding box grow automatically to accommodate the
extra gaps, so no fixed sizes change.  Unique terminal names (added in the
previous commit) are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 22:44:06 +12:00
Shane Ringrose 207c0c9544 Fix copyright years and deduplicate terminal names
Two issues raised in PR review:

1. Copyright year: new files carried "2006" (the project's founding year).
   Updated to "2006-2026" to reflect the actual authorship period.

2. Duplicate terminal names: EPLAN parts can have multiple connection
   templates sharing the same connectionDesignation (e.g. a drive where
   both wire entries of terminal "1" are labelled "1").  QET requires
   unique terminal names for wiring and terminal-diagram generation.

   Resolution order in EdzElementBuilder::build():
   - Unique designation → used as-is.
   - Duplicated designation with distinct sanitised description →
     "designation_description" (e.g. "1_L_P").
   - Otherwise → numeric suffix: "1", "1_2", "1_3", …

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 22:39:11 +12:00
Shane Ringrose 7cc5790f7c Add EdzPart + EdzElementBuilder: .edz part -> .elmt (M1)
Port of the edz2qet.py prototype's mapping to C++. EdzPart parses an EPLAN
part.xml into a portable model (identity/metadata, localized names, connection
list); EdzElementBuilder turns that into a QET element (generic symbol: body
rectangle + one west-facing terminal per pin, per-pin labels, localized <name>s,
and elementInformations for the BOM).

Pins are natural-sorted by designation so they stack 1,2,3,4 regardless of the
order EPLAN lists them (MFH200 lists 1,3,4,2). Output verified structurally
identical (uuids aside) to the Python oracle for three ifm samples — KG6000
(4-pin), MFH200 (4-pin, reordered) and R1D200 (5-pin, incl. Dutch name) — and
the generated element loads in the QET editor with correct UTF-8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 07:11:09 +12:00