Skip to content

Preserve courtyard RECT geometry in generated TSX - #494

Open
rushabhcodes wants to merge 3 commits into
tscircuit:mainfrom
rushabhcodes:fix/preserve-courtyard-rect-tsx
Open

Preserve courtyard RECT geometry in generated TSX#494
rushabhcodes wants to merge 3 commits into
tscircuit:mainfrom
rushabhcodes:fix/preserve-courtyard-rect-tsx

Conversation

@rushabhcodes

@rushabhcodes rushabhcodes commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes a data-preservation and geometry-type regression in EasyEDA footprint conversion: explicit courtyard-layer RECT elements were not preserved as courtyard rectangles in generated TSX.

Impact

Affected footprints could lose their rectangular courtyard keepout geometry or receive an extra synthetic courtyard outline when converted. The source payload contains an explicit courtyard RECT, but the conversion path previously relied on the BBox courtyard-outline fallback whenever no courtyard TRACK was present.

Root cause

  • generateFootprintTsx handled courtyard outlines but omitted pcb_courtyard_rect elements.
  • The BBox fallback treated the absence of a courtyard TRACK as proof that no explicit courtyard geometry existed, even when a courtyard RECT was present.

Fix

  • Emit each pcb_courtyard_rect as <courtyardrect>.
  • Preserve center position, width, height, and counter-clockwise rotation.
  • Suppress the synthetic BBox <courtyardoutline> when an explicit courtyard RECT exists.
  • Keep existing courtyard TRACK/outline behavior unchanged.

Regression coverage

The package RECT conversion test moves a RECT onto EasyEDA courtyard layer 13 and verifies:

  • one pcb_courtyard_rect is produced;
  • no synthetic pcb_courtyard_outline is added;
  • generated TSX contains <courtyardrect> and no <courtyardoutline>.

The existing footprint-generator test remains focused on standalone oval-hole generation; courtyard rectangles are covered at the conversion boundary where the geometry type is selected.

Validation

  • bun test tests/convert-package-rect.test.ts tests/generate-footprint-tsx.test.ts
  • bun run build

Copilot AI lite review requested due to automatic review settings August 20, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rushabhcodes rushabhcodes changed the title Preserve courtyard rectangles in generated TSX Preserve courtyard RECT geometry in generated TSX Aug 20, 2026
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.

2 participants