Sub-mil coordinates for track/via/pad placement and the position getters - #31
Closed
bblacklock3 wants to merge 2 commits into
Closed
bblacklock3 wants to merge 2 commits into
bblacklock3 wants to merge 2 commits into
Conversation
…getter IPCB_Arc has no Width member, so obj_query with Width on an eArcObject raised a modal 'Undeclared identifier: Width' in the script engine before any Try/Except ran, which stopped the polling loop until a human dismissed it and re-ran StartMCPServer. Reported from a live board on 2026-09-14 while exporting coil copper. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…tion getters The bridge parsed placement coordinates with StrToIntDef and the Utils.pas wrappers MilsToCoord / CoordToMils are Integer, so every placed or queried position was quantised to 1 mil (25.4 um) although Altium's TCoord resolves 1/10000 mil. On a generated coil trace with 0.09 mm chords that is a +-18 um vertex error and a visibly kinked trace; for exports it caps copper geometry at 1 mil. Adds MilsToCoordF(Double) / CoordToMilsF -> Double next to the integer wrappers (nothing else changes), parses the coordinates of PCB_PlaceTrack, PCB_PlaceTracks, PCB_PlaceVia and PCB_PlacePad with StrToFloatDef, and returns X, Y, X1, Y1, X2, Y2 from the obj_query getter through FloatToJsonStr(CoordToMilsF(...)). Whole-mil positions still print as integers (FloatToStr(100) = '100'), so existing callers see decimals only where the copper has them. Sizes, widths and hole sizes stay integer mils. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
|
Merged as 66e9e62, on top of #30. Three things I checked before taking it, since all three would have been quiet failures:
Two follow-ups on our side, neither of them yours to fix:
One question: the four Cherry-picked rather than merged through the PR, so this shows as closed rather than merged. Both commits carry your authorship. |
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.
Placement coordinates were parsed with
StrToIntDef, and theUtils.paswrappersMilsToCoord/CoordToMilsareInteger, so every placed or queried position was quantised to 1 mil (25.4 µm) although Altium'sTCoordresolves 1/10000 mil. For scripted geometry that matters: on a generated coil trace with 0.09 mm chords the rounding is a ±18 µm vertex error and a visibly kinked trace, and copper exported throughobj_queryis capped at 1 mil.This PR:
MilsToCoordF(Double)andCoordToMilsF -> Doublenext to the integer wrappers (which are untouched, so the other ~300 call sites are unaffected);PCB_PlaceTrack,PCB_PlaceTracks,PCB_PlaceViaandPCB_PlacePadwithStrToFloatDefand converts them withMilsToCoordF; widths, sizes and hole sizes stay integer mils;X,Y,X1,Y1,X2,Y2from the PCB property getter throughFloatToJsonStr(CoordToMilsF(...)).Compatibility: whole-mil positions still print as integers (
FloatToStr(100) = '100'), so existing callers only see decimals where the copper actually has them. The placement responses echo the parsed doubles the same way.Verified on Altium Designer 26.9.1: a track placed at
100.25,100.75,150.5,120.125reads back with exactly those values; a 1475-track generated coil round-trips 0 missing / 0 extra within 0.01 mil.Based on #30 (the
Arc.LineWidthfix) because both touchPCBGeneric.pas; the two commits are independent otherwise.🤖 Generated with Claude Code