Fix empty/garbage imports on Altium Designer 25 (.NET 6 host + invariant-culture parsing) - #7
Merged
Conversation
- 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>
There was a problem hiding this comment.
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-windowsvia an SDK-style.csprojand retains the oldnet48project as a legacy file. - Makes numeric parsing culture-invariant across symbol/footprint parsing paths to prevent decimal-comma locale breakage.
- Fixes layer mappings, corrects
CreateTextY placement, and addsImportLog+ 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.dllshipped with AD25 targets.NETCoreApp,Version=v6.0. The plugin was built fornet48, 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 tonet6.0-windowsfixes it.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,MMsToCoordoverflows, and primitives land kilometers off-origin. All EasyEDA numeric parsing now usesCultureInfo.InvariantCulture(via centralEeParsehelpers).Additional fixes
Document,ComponentShapeLayer,LeadShapeLayer,ComponentMarkingLayer,BottomAssembly, and theBoardOutLinespelling actually emitted by EasyEDA; fixedBottomSolderMaskLayermapping to bottom solder mask (it mapped to paste).CreateTextY coordinate — it usedGetState_XLocationfor Y, so all text placed on a diagonal.Documents\AltiumEE\import-errors.logso failures like the above are diagnosable.Build changes
dotnetCLI (the old project file is kept asEasyEDA-Loader.csproj.legacy).Assemblies\folder (git-ignored, not committed — they're Altium's proprietary DLLs). To build, copy from your AD25 installation intoEasyEDA-Loader\Assemblies\:Altium.SDK.dll,Altium.SDK.Interfaces.dll,Altium.Controls.dll,Altium.Controls.Skins.dll, and theDevExpress.*.v22.1assemblies 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.