Skip to content

Fix pin-centering asymmetry and 3D model placement (c_origin) - #8

Open
CP0274 wants to merge 2 commits into
expired6978:mainfrom
CP0274:fix/3d-placement-and-pin-centering
Open

Fix pin-centering asymmetry and 3D model placement (c_origin)#8
CP0274 wants to merge 2 commits into
expired6978:mainfrom
CP0274:fix/3d-placement-and-pin-centering

Conversation

@CP0274

@CP0274 CP0274 commented Aug 10, 2026

Copy link
Copy Markdown

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. 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 are. Fixed by adding the missing + gridSize to both TOP and BOTTOM offsets.

  • EeFootprint3dModel: 3D model placement used c_origin, which is unrelated to placement. 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 parsed and run through ConvertX/ConvertY (the same bounding-box-centering conversion used for pads/tracks/etc.), which only produced correct placement by coincidence for parts where c_origin happened to match the footprint's own geometric center. Fixed by no longer 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, 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

  • Import a schematic symbol with pins on all four sides and confirm top/bottom pins are now centered like left/right pins
  • Import a footprint with a 3D model (e.g. C730129) and confirm the model lands on the footprint instead of offset

CP0274 added 2 commits August 10, 2026 23:28
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.
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.

1 participant