Fix pin-centering asymmetry and 3D model placement (c_origin) - #8
Open
CP0274 wants to merge 2 commits into
Open
Conversation
The offsets list used to anchor each side's pins had "+ gridSize" on the LEFT/RIGHT entries but not on TOP/BOTTOM, so top/bottom pins landed shifted by one grid step (100mil) relative to the symbol rectangle instead of being centered like left/right pins. Added the missing "+ gridSize" to both TOP and BOTTOM offsets to match.
c_origin is wherever the 3D CAD tool's own workspace zero happened to be when the STEP model was authored - an artifact of the modeling tool, not a meaningful placement reference. It was previously parsed and run through ConvertX/ConvertY (the bounding-box-centering conversion used by pads/tracks/etc.), which only produced correct placement by coincidence for symmetric parts. Stop parsing c_origin; Translation.X/Y are now 0 (local-origin) and are passed directly into CreateComponentBody instead of through ConvertX/ConvertY a second time. This lands the model at Altium coordinate (0,0), the same bounding-box-center reference point every other shape already resolves to via ConvertX/ConvertY.
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.
Summary
Two real bugs found while porting this plugin to CircuitStudio, both confirmed present in this upstream codebase as well (not CS-specific):
SymbolDrawing.LayoutPins: TOP/BOTTOM pin centering asymmetry. Theoffsetslist used to anchor each side's pins had+ gridSizeon the LEFT/RIGHT entries but not on TOP/BOTTOM, so top/bottom pins landed shifted by one grid step (100mil) relative to the symbol rectangle instead of being centered like left/right pins are. Fixed by adding the missing+ gridSizeto both TOP and BOTTOM offsets.EeFootprint3dModel: 3D model placement usedc_origin, which is unrelated to placement.c_originis wherever the 3D CAD tool's own workspace zero happened to be when the STEP model was authored — an artifact of the modeling tool, not a meaningful placement reference. It was parsed and run throughConvertX/ConvertY(the same bounding-box-centering conversion used for pads/tracks/etc.), which only produced correct placement by coincidence for parts wherec_originhappened to match the footprint's own geometric center. Fixed by no longer parsingc_origin:Translation.X/Yare now0(local-origin) and are passed directly intoCreateComponentBodyinstead of throughConvertX/ConvertYa second time, landing the model at the same bounding-box-center reference point every other shape already resolves to.Both were verified by hand-tracing against real component data before being applied here, and confirmed to reproduce character-for-character in this repo's own source (not something introduced by a port).
Test plan