Skip to content

Fix empty/garbage imports on Altium Designer 25 (.NET 6 host + invariant-culture parsing) - #7

Merged
expired6978 merged 1 commit into
expired6978:mainfrom
AdiVacaru:fix/ad25-dotnet6-culture
Aug 10, 2026
Merged

Fix empty/garbage imports on Altium Designer 25 (.NET 6 host + invariant-culture parsing)#7
expired6978 merged 1 commit into
expired6978:mainfrom
AdiVacaru:fix/ad25-dotnet6-culture

Conversation

@AdiVacaru

Copy link
Copy Markdown
Contributor

On Altium Designer 25 the extension registers and shows its menu, but every import produces an empty or garbage footprint. This PR fixes the two root causes and several smaller bugs found while debugging them.

Root causes

1. AD25 hosts extensions on .NET 6, not .NET Framework

Altium.SDK.dll shipped with AD25 targets .NETCoreApp,Version=v6.0. The plugin was built for net48, and under the .NET 6 host the 2D-primitive interop calls (CreateTrack, CreatePad, …) fail silently — the importer runs to completion but nothing is placed. Retargeting the project to net6.0-windows fixes it.

Compatibility tradeoff: a net6.0-windows build will no longer load on AD24 and older, which host extensions on .NET Framework. I'm happy to rework this into dual-targeting (net48 + net6.0-windows, producing two output DLLs) if you'd prefer to keep older versions supported — let me know which way you want to go. This likely also explains #5: AD26 registers the extension but shows no menu, which is the same load-failure symptom; AD26 may bundle a newer runtime again, so it's worth checking what Altium.SDK.dll in AD26 targets.

2. Coordinate parsing breaks under decimal-comma cultures

Altium's .NET host runs with the OS culture. On any locale where the decimal separator is a comma (most of Europe), double.Parse("3968.898") either throws or parses as 3968898 — every coordinate containing a dot is corrupted, MMsToCoord overflows, and primitives land kilometers off-origin. All EasyEDA numeric parsing now uses CultureInfo.InvariantCulture (via central EeParse helpers).

Additional fixes

  • Missing layer mappings — added Document, ComponentShapeLayer, LeadShapeLayer, ComponentMarkingLayer, BottomAssembly, and the BoardOutLine spelling actually emitted by EasyEDA; fixed BottomSolderMaskLayer mapping to bottom solder mask (it mapped to paste).
  • CreateText Y coordinate — it used GetState_XLocation for Y, so all text placed on a diagonal.
  • Error visibility — per-primitive import exceptions were swallowed; they are now logged to Documents\AltiumEE\import-errors.log so failures like the above are diagnosable.

Build changes

  • The csproj is converted to SDK style so it builds with the dotnet CLI (the old project file is kept as EasyEDA-Loader.csproj.legacy).
  • Altium/DevExpress references resolve from an Assemblies\ folder (git-ignored, not committed — they're Altium's proprietary DLLs). To build, copy from your AD25 installation into EasyEDA-Loader\Assemblies\: Altium.SDK.dll, Altium.SDK.Interfaces.dll, Altium.Controls.dll, Altium.Controls.Skins.dll, and the DevExpress.*.v22.1 assemblies referenced in the csproj.

Tested on Altium Designer 25 (Windows 11, on a decimal-comma locale): symbols and footprints from LCSC/EasyEDA now import with correct geometry, layers, and text placement.

- Retarget plugin to net6.0-windows: AD25 hosts extensions on .NET 6
  (Altium.SDK targets .NETCoreApp v6.0); the net48 build ran in compat
  mode and every 2D primitive interop call failed silently.
- Parse all EasyEDA numeric fields with CultureInfo.InvariantCulture:
  Altium's .NET host runs with a decimal-comma culture, so coordinates
  like 3968.898 parsed 1000x too large, overflowing MMsToCoord and
  scattering previews.
- Convert csproj to SDK style so it builds with the dotnet CLI.
- Surface per-primitive import errors to Documents\AltiumEE\import-errors.log
  instead of swallowing them.
- Map missing EasyEDA layers (Document, ComponentShape/LeadShape/
  ComponentMarking, BottomAssembly, BoardOutLine spelling); fix
  BottomSolderMaskLayer mapping to bottom solder instead of paste.
- Fix CreateText using XLocation for the Y coordinate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 9, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the EasyEDA Loader Altium extension to work correctly under Altium Designer 25’s .NET 6 hosting environment and fixes locale-dependent numeric parsing that caused corrupted coordinates (leading to empty/garbage imports). It also improves layer mapping correctness, fixes a text-placement coordinate bug, and adds diagnostic logging for previously swallowed per-primitive exceptions.

Changes:

  • Retargets the extension to net6.0-windows via an SDK-style .csproj and retains the old net48 project as a legacy file.
  • Makes numeric parsing culture-invariant across symbol/footprint parsing paths to prevent decimal-comma locale breakage.
  • Fixes layer mappings, corrects CreateText Y placement, and adds ImportLog + UI warning for import failures.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
EasyEDA-Loader/SymbolShapes/EeSymbolRectangle.cs Uses invariant culture for rectangle coordinate parsing.
EasyEDA-Loader/SymbolShapes/EeSymbolPin.cs Uses invariant culture for pin/font-size parsing to avoid locale issues.
EasyEDA-Loader/SymbolShapes/EeSymbolEllipse.cs Uses invariant culture for ellipse numeric parsing.
EasyEDA-Loader/SymbolShapes/EeSymbolCircle.cs Uses invariant culture for circle numeric parsing.
EasyEDA-Loader/Shapes.cs Central parsing helpers now use invariant culture; point list parsing fixed.
EasyEDA-Loader/ImportLog.cs New file: persistent per-primitive error logging with error counter.
EasyEDA-Loader/FootprintShapes/EeFootprintVia.cs Uses invariant culture for via numeric parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintTrack.cs Uses invariant culture for track stroke width parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintText.cs Uses invariant culture for footprint text numeric parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintRectangle.cs Uses invariant culture for footprint rectangle numeric parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintPad.cs Uses invariant culture for pad geometry/rotation parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintHole.cs Uses invariant culture for hole geometry parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintCircle.cs Uses invariant culture for footprint circle numeric parsing.
EasyEDA-Loader/FootprintShapes/EeFootprintArc.cs Uses invariant culture for SVG-arc numeric parsing and stroke width parsing.
EasyEDA-Loader/FootprintShapes/EeFootprint3dModel.cs Uses invariant culture for 3D model transform parsing.
EasyEDA-Loader/EEPCB.cs Corrects/extends layer mappings; fixes CreateText Y coordinate placement.
EasyEDA-Loader/EasyEDALoader.cs Resets/imports error logging, logs per-footprint failures, warns user post-import.
EasyEDA-Loader/EasyEDA-Loader.csproj.legacy Adds preserved legacy net48 project file for reference/back-compat builds.
EasyEDA-Loader/EasyEDA-Loader.csproj Converts to SDK-style net6.0-windows project and updates references/package usage.
EasyEDA-Loader/API/EasyedaApi.cs Uses invariant culture for 3D transform parsing in API layer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@expired6978
expired6978 merged commit 1ade34d into expired6978:main Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants