Files
dxdesigner-part-replacement/docs/superpowers/specs/2026-09-01-dxdesigner-795-refdes-design.md
T

15 KiB

DxDesigner 7.9.5 Automatic Reference Designator Tool

Date: 2026-09-01

1. Purpose

Build the first module of a maintainable DxDesigner 7.9.5 productivity suite: automatic reference designator assignment with preview, validation, safe write-back, and recovery.

The tool replaces the legacy workflow that copies selected reference designators to Excel, generates values manually, and pastes them back. Excel is not part of the new annotation workflow.

2. Compatibility Baseline

DxDesigner/Expedition Enterprise 7.9.5 is the only supported schematic integration baseline for this phase.

The installation and import flow must remain compatible with the method demonstrated by the supplied legacy tool:

  1. The user opens DxDesigner 7.9.5.
  2. The user opens Settings -> Run at Startup.
  3. The user adds one MenuAdd.vbs file to the Scripts list.
  4. After DxDesigner restarts, one Dx Productivity menu appears on the Sheet Menu Bar.

The integration must not require a newer Xpedition add-in framework, a copied DLL from another release, COM re-registration, or a project-format upgrade.

MenuAdd.vbs uses only interfaces already demonstrated in the legacy package:

  • Scripting.GetEnvVariable
  • CommandBars("Sheet Menu Bar").Controls.Add
  • menu control captions and OnAction
  • the 7.9.5 internal scripting host

The installer sets a user-level DXTOOLS_HOME environment variable. MenuAdd.vbs resolves every tool path through Scripting.GetEnvVariable("DXTOOLS_HOME"); it contains no D:\NET_CHECK or other fixed installation path. DxDesigner must be restarted after installation so its script host sees the new environment value.

3. Compatibility Probe

The first implementation milestone is a read-only 7.9.5 probe imported through the exact startup-script flow above. It must not change a schematic.

The probe verifies:

  • the imported script can add and remove its own menu entries without duplication;
  • a menu item can enter the internal VBS bridge and launch the configured Python executable;
  • ActiveView.Query(VDM_COMP, VD_SELECTED) returns selected components;
  • Application.DesignComponents enumerates the full design;
  • component reference designator, sheet number, X/Y position, attributes, full path, and stable identity are readable;
  • the bridge can hold component object references while the Python process is open;
  • UTF-8 snapshot and result files can be exchanged through the user-local run directory.

The release menu action uses the first 7.9.5-native route proven by the probe. The permitted routes, in order, are:

  1. a named bridge procedure in the imported startup VBS;
  2. the 7.9.5 Run script action;
  3. the proven Form action with a minimal 7.9.5 EFM launcher.

No unverified route is shipped. If the first two routes are unavailable, the launcher EFM is created or adapted using the 7.9.5 form format; it is not copied from a newer release.

4. Architecture

DxDesigner 7.9.5
  -> imported MenuAdd.vbs
  -> internal VBS bridge
  -> UTF-8 snapshot + in-memory component map
  -> Python/PySide6 application
  -> validated bridge_id/new_refdes result
  -> VBS write-back and full-design verification

4.1 VBS integration layer

The VBS layer owns every DxDesigner COM/API call. It reads the current design, launches Python, waits for the result, revalidates the snapshot, applies changes, verifies the design, and rolls back on failure.

Python does not attach directly to ViewDraw.Application. This avoids 32-bit versus 64-bit COM registration and licensing incompatibilities between DxDesigner 7.9.5 and modern Python.

4.2 Python domain layer

The Python domain layer is independent of DxDesigner. It parses snapshots, groups components, computes deterministic annotation plans, validates collisions, and produces an immutable change set.

This layer has no GUI imports and can be exhaustively unit tested with fixtures.

4.3 Python UI layer

The desktop UI uses PySide6 and a local style sheet. It implements the approved three-column workbench:

  • suite navigation on the left;
  • annotation rules in the center;
  • live old-to-new preview on the right.

The source remains runnable with the installed Python 3.12 environment. A later packaging step may produce a standalone executable, but packaging does not change the VBS bridge protocol.

5. Bridge Protocol

Each run uses a unique directory:

%LOCALAPPDATA%\DxProductivity\runs\<run_id>\
  request.json
  result.tsv
  apply-status.json

VBS writes request.json as UTF-8 using a deterministic JSON escaping helper. Python writes an ordered result.tsv apply schedule with five constrained fields: sequence, bridge_id, expected_refdes, new_refdes, and final_refdes. Tabs and line breaks are illegal in every result field.

Each sequence number is unique and contiguous from 1. A bridge ID normally appears once. It may appear twice only when a validated reannotation cycle requires a temporary placeholder step followed by the final assignment. VBS verifies expected_refdes immediately before every step and verifies final_refdes after the complete schedule.

Each snapshot component contains:

  • ephemeral bridge_id assigned by the current VBS run;
  • stable UID when exposed by 7.9.5;
  • hierarchical full path as an identity fallback;
  • sheet number and current-view membership;
  • X and Y schematic coordinates;
  • current reference designator;
  • symbol-level default reference designator or prefix when available;
  • selection state;
  • part number and Value for preview;
  • lock or protection state when exposed by 7.9.5.

VBS retains an in-memory bridge_id -> component object map while Python is open. Result rows never rely on COM enumeration order.

Before write-back, VBS confirms that the active design, component identity, component count in scope, and original reference designators still match the snapshot. A mismatch invalidates the plan and requires a refresh.

6. Annotation Behavior

6.1 Scope

The UI supports three explicit scopes:

  • selected components, which is the default;
  • current sheet;
  • full design.

If the selected scope is empty, Apply remains disabled. The tool does not silently fall back to another scope.

6.2 Processing mode

The default mode fills only unannotated components:

  • blank reference designators;
  • placeholders matching a leading alphabetic prefix followed by one or more question marks, such as R?, C??, or TP?.

Existing formal reference designators are preserved. A separate, explicit mode reannotates every eligible component in scope.

6.3 Prefix resolution

Prefix resolution is deterministic:

  1. use the alphabetic prefix in the current placeholder;
  2. otherwise use the symbol-level default reference designator/prefix exposed by 7.9.5;
  3. otherwise require an explicit prefix in the preview table.

An unresolved prefix is a blocking validation error. Prefix comparison is case-insensitive and output is normalized to uppercase.

6.4 Multi-unit components

All symbols that represent the same logical component are grouped by stable component identity. They receive one base reference designator. Symbol units or gates do not consume additional sequence numbers.

If 7.9.5 does not expose a stable UID, the compatibility adapter derives a stable grouping key from the hierarchical component path and validated component metadata. Ambiguous groups are blocked rather than guessed.

6.5 Sorting

The default order is:

  1. numeric sheet number ascending;
  2. schematic Y coordinate from top to bottom;
  3. X coordinate from left to right within the same visual row;
  4. stable identity as the final deterministic tie-breaker.

Because schematic Y-axis direction is API-dependent, the compatibility adapter normalizes coordinates so larger visual height always sorts first. Components are grouped into visual rows using a default 5 mm tolerance. The user can change the tolerance.

Alternative orders are available for left-to-right column scanning and reverse directions.

6.6 Numbering modes

Continuous mode is the default. Each prefix owns an independent sequence beginning at 1 unless the user changes the start value. Numbers already used anywhere outside the target set are skipped.

Page mode uses:

number = numeric_sheet_number * page_step + page_start

The defaults are page_step = 100 and page_start = 1, so sheet 3 starts at 301. Each prefix has an independent page sequence. Non-numeric sheet identifiers require an explicit numeric mapping before Apply.

6.7 Collision rules

Validation is case-insensitive and covers:

  • duplicates inside the proposed change set;
  • collisions with components outside the target set;
  • illegal or empty prefixes;
  • invalid numeric ranges;
  • duplicate existing formal reference designators in the source design;
  • multiple proposed values for one logical component.

Blocking issues disable Apply. Warnings remain selectable and can locate the affected schematic component.

7. Safe Apply and Recovery

Every Apply operation follows this sequence:

  1. revalidate the snapshot against the active design;
  2. run all collision and format checks again;
  3. write a timestamped backup mapping under %LOCALAPPDATA%\DxProductivity\backups;
  4. apply changes using the in-memory component map;
  5. re-enumerate the full design and verify every expected reference designator;
  6. write a machine-readable apply status and append an operation-history entry.

Fill-only plans normally write directly because they cannot swap existing formal identifiers.

Full reannotation plans are ordered as a dependency graph. Acyclic moves are applied first. Cycles use the component prefix placeholder, such as R?, as a temporary value, then complete the cycle. This uses a placeholder format already accepted by DxDesigner 7.9.5 instead of inventing a new temporary reference-designator syntax.

If any assignment or verification fails, VBS restores every component from the backup mapping and verifies the restoration. A rollback failure is reported prominently with the backup path and the exact remaining mismatch.

The operation-history view exposes Restore Last Annotation. Restore performs the same preflight, backup, apply, and verification sequence; it is not a blind file replay.

8. User Interface and Visual Acceptance

The approved mockup is the visual baseline. The release implementation follows these measurable requirements derived from Apple Human Interface Guidelines while remaining a Windows desktop application:

  • 13 pt default content text and no essential text below 10 pt;
  • approximately 28 by 28 pt default desktop controls and no interactive target below 20 by 20 pt;
  • 16 px simplified line icons with consistent weight and optical alignment;
  • tooltips and accessible names for icon-only controls;
  • one semantic use per status color;
  • text contrast of at least 4.5:1 for normal text;
  • icons or text in addition to color for every status;
  • light, dark, and increased-contrast-compatible palettes;
  • complete keyboard navigation with visible focus;
  • no clipping or overlap at 100%, 125%, and 150% Windows display scaling;
  • a resizable window with a minimum supported content area of 1100 by 700 logical pixels;
  • no required command placed only at the bottom edge of the window;
  • no automatic, blinking, bouncing, or decorative motion.

Interface icons use a cross-platform icon set with Apple-like semantic consistency. Apple SF Symbols are a design reference only and are not redistributed in the Windows application.

Official design references:

9. Error Handling

Errors are divided into three levels:

  • blocking: Apply is disabled, for example duplicate output or missing prefix;
  • warning: the plan remains applicable after review, for example a nonstandard existing designator outside scope;
  • informational: no action required, for example a locked component preserved by policy.

The UI shows an icon, short message, affected component count, and location action. Technical details and bridge logs are available in a diagnostics view and retained per run. Normal users do not need to inspect raw JSON, TSV, COM error codes, or Python tracebacks.

If Python is missing or cannot start, the VBS bridge shows a concise message with the configured executable path and exits without changing the design.

10. Testing Strategy

10.1 Automated domain tests

Tests cover:

  • placeholder recognition and prefix normalization;
  • continuous and page numbering;
  • occupied-number skipping;
  • row tolerance and every sort direction;
  • numeric and non-numeric sheet identifiers;
  • multi-unit grouping;
  • duplicate and collision detection;
  • deterministic output for equal coordinates;
  • reannotation dependency graphs and cycles;
  • backup and restore plan generation.

10.2 Bridge contract tests

Pure VBS helpers are tested with cscript where possible. Tests cover UTF-8, JSON escaping, result parsing, invalid rows, duplicate or noncontiguous sequence numbers, unknown bridge IDs, illegal repeated bridge steps, stale snapshots, and simulated assignment failures.

Python contract tests use captured 7.9.5-compatible fixtures and never require a live DxDesigner instance.

10.3 UI tests

Qt tests cover default selections, scope changes, preview filtering, blocking-error behavior, keyboard tab order, light/dark themes, and Apply confirmation for full reannotation.

Screenshots are checked at representative 1100 by 700 and 1440 by 900 window sizes under 100%, 125%, and 150% scaling. Text, controls, and tables must not overlap or clip.

10.4 Live 7.9.5 acceptance

The user runs the compatibility probe and a sample-project acceptance checklist on the target DxDesigner 7.9.5 installation. Live acceptance covers startup-script import, menu creation, selected/current/full scopes, coordinate order, write-back, duplicate prevention, rollback, restoration, Chinese installation paths, and paths containing spaces.

No release is marked 7.9.5-compatible solely from mocked COM tests.

11. Deliverables for Phase One

  • 7.9.5 compatibility probe;
  • installer and uninstall instructions using startup-script import;
  • MenuAdd.vbs and the verified 7.9.5 bridge adapter;
  • Python source and dependency metadata;
  • automatic reference designator GUI;
  • annotation domain tests and bridge contract tests;
  • live 7.9.5 acceptance checklist;
  • user guide for installation, annotation, preview, Apply, and Restore.

12. Non-Goals

This phase does not implement Value/Value1/Part Number editing, attribute visibility, design audits, network navigation, BOM generation, BOM-to-schematic navigation, or Expedition PCB assembly text placement. Those modules reuse the verified bridge and shared application shell in later phase-specific designs.

This phase does not import code or binaries from newer Xpedition releases and does not modify the DxDesigner project format.