TS
Handle fp_poly with arcs
tscircuit/kicad-component-converter#160

/closes #159 /claim #159

Problem

The KiCad component converter was unable to parse fp_poly elements that contained arc definitions. This was because the parser only expected xy coordinates within the pts attribute of an fp_poly. When an arc was present, the parser would fail, leading to incorrect or incomplete component conversions.

Solution

This pull request introduces the following changes to address the issue:

  1. Updated Zod Schema: The fp_poly_def in src/kicad-zod.ts has been updated to include a poly_pts_def that allows for both xy coordinates and arc definitions within the pts array.
  2. Enhanced formatAttr Function: The formatAttr function in src/get-attr.ts has been improved to correctly parse pts attributes containing both xy and arc elements. It now identifies the type of each element and formats it accordingly.
  3. Improved Soup Conversion: The convertKicadJsonToTsCircuitSoup function in src/convert-kicad-json-to-tscircuit-soup.ts has been updated to handle the new arc elements within fp_poly. It now generates a series of points to represent the arc, ensuring that the resulting tscircuit-soup is a correct representation of the KiCad component.

BEFORE FIX:

https://github.com/user-attachments/assets/0bf924a2-f31c-4bd4-a9e2-9a39dfa8e0e9

AFTER FIX:

https://github.com/user-attachments/assets/b12bcecd-5be6-4c3d-b120-42bd480a71c5

Claim

Total prize pool $40
Total paid $0
Status Pending
Submitted October 26, 2025
Last updated October 26, 2025

Contributors

EX

Exceluyi

@Exceluyi

100%

Sponsors

TS

tscircuit

@tscircuit

$40