Skip to content

improve PCB footprint and graphic processing for handling the other #41

Open
techmannih wants to merge 2 commits intotscircuit:mainfrom
techmannih:jsaa
Open

improve PCB footprint and graphic processing for handling the other #41
techmannih wants to merge 2 commits intotscircuit:mainfrom
techmannih:jsaa

Conversation

@techmannih
Copy link
Copy Markdown
Member

Key Changes

  • Centralized Layer Utility: Replaced multiple ad-hoc layer mapping functions (mapTextLayer, this.mapLayer) with a single, robust getLayerMapping utility in layer-utils.ts.
  • Improved Board Outlines: Explicitly added Edge.Cuts support to the centralized mapping to ensure board outlines are correctly identified and processed in CollectGraphicsStage.
  • Standardized Text Alignment: Added anchor_alignment: "center" to all pcb_silkscreen_text objects. This provides a more accurate representation of KiCad's default text positioning and improves visual quality in renders.
  • Code Cleanup:
    • Removed redundant private methods and unused imports across CollectGraphicsStage.ts, process-text.ts, and process-graphics.ts.
    • Enhanced type safety by removing several as any casts in database insertion calls.
  • Updated Snapshots: Visual regressions in tests were verified to be improvements in text centering and have been updated.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

if (layerStr.includes("Silk")) {
type = side === "top" ? "top_silkscreen" : "bottom_silkscreen"
} else if (layerStr.includes("Edge.Cuts")) {
type = "edge_cuts"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO:
handling other layers

  if (layerStr.includes("Silk")) {
    type = side === "top" ? "top_silkscreen" : "bottom_silkscreen"
  } else if (layerStr.includes("Fab")) {
    type = side === "top" ? "top_fabrication_note" : "bottom_fabrication_note"
  } else if (layerStr.includes("CrtYd") || layerStr.includes("Courtyard")) {
    type = side === "top" ? "top_courtyard" : "bottom_courtyard"
  } else if (layerStr.includes(".Cu")) {
    type = side === "top" ? "top_copper" : "bottom_copper"
  } else if (layerStr.includes("Mask")) {
    type = side === "top" ? "top_soldermask" : "bottom_soldermask"
  } else if (layerStr.includes("Edge.Cuts")) {
    type = "edge_cuts"
  }

text: processedText,
anchor_position: pos,
layer: mapping.side,
anchor_alignment: "center",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO:

handling the anchor_alignment for pcb_silkscreen_text

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here, remove extra silkscreen path which is not silkscreen, might be fab or courtyard. as shown in the kicad snapshot.

TODO:
add support fab and coutyard layer

techmannih pushed a commit to techmannih/kicad-to-circuit-json that referenced this pull request Mar 21, 2026
Co-authored-by: GitHub Actions <actions@github.com>
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