fix: apply nominalTraceWidth from <net> and nested <group> - #3423
Open
Msa360 wants to merge 1 commit into
Open
Conversation
nominalTraceWidth was declared in @tscircuit/props for both netProps and baseGroupProps, but core only read it off the subcircuit that runs autorouting. A <net nominalTraceWidth> and a non-subcircuit <group nominalTraceWidth> were both parsed and then silently dropped. Traces now resolve their width as: trace thickness/width > connected net nominalTraceWidth > closest ancestor group defaultTraceWidth/nominalTraceWidth > subcircuit/board nominalTraceWidth (unchanged) The resolved width is written to source_trace.min_trace_thickness, which getSimpleRouteJsonFromCircuitJson already uses for both direct-trace and net connections.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
nominalTraceWidthis declared in@tscircuit/propsfor bothnetPropsandbaseGroupProps, but core only read it off the subcircuit that runs autorouting (Group._runLocalAutorouting). Both of these are parsed and then silently dropped:No error or warning is emitted. Setting
nominalTraceWidthon<board>, or on a group that has thesubcircuitprop set, already worked.Fix
A trace resolves its width by falling back through the things that can specify it:
thickness/widthnominalTraceWidthof the nets it connects to (widest wins if it connects several)defaultTraceWidth/nominalTraceWidthof the closest ancestor groupSimpleRouteJsonThe resolved width is written to
source_trace.min_trace_thickness, whichgetSimpleRouteJsonFromCircuitJsonalready reads for both direct-trace and net connections, so autorouted, manual, and per-trace-ijump routes all pick it up.The ancestor walk stops before the enclosing subcircuit, since that value is already applied by
Group._runLocalAutorouting— this keeps existing board-level behaviour identical.Tests
tests/features/net-and-group-nominal-trace-width-autorouting.test.tsxcovers:<net nominalTraceWidth>sets the autorouted widththicknessbeats netnominalTraceWidth<group nominalTraceWidth>sets the autorouted widthbunx tsc --noEmitis clean.bun test tests/groups tests/subcircuits tests/drc tests/utils tests/breakout tracepasses apart from 4 tests that time out identically on unmodifiedmainlocally (repro-bq25895-cross-net-trace-overlap,repro-rp2040-gamepad-trace-alignment,example35-minimize-trace-crossing,ground-net-label-preserves-solver-orientation).