Skip to content

improve PCB footprint and graphic processing for handling the other layers#40

Open
techmannih wants to merge 1 commit intotscircuit:mainfrom
techmannih:ap
Open

improve PCB footprint and graphic processing for handling the other layers#40
techmannih wants to merge 1 commit intotscircuit:mainfrom
techmannih:ap

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.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be730065d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/stages/pcb/CollectGraphicsStage.ts
Copy link
Copy Markdown
Member Author

@techmannih techmannih Feb 28, 2026

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 techmannih closed this Feb 28, 2026
@techmannih techmannih reopened this Feb 28, 2026
@techmannih techmannih changed the title improve PCB footprint and graphic processing for handling the other improve PCB footprint and graphic processing for handling the other layers Mar 1, 2026
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
…rary bundle (tscircuit#40)

* Introduce CircuitJsonToKicadLibraryConverter that creates a kicad-library bundle

* split code

* remove node:path

* update

* update

* update

* rename

* rename types

* rename file

* rename file

* update

* update

* add snapshot test

* add 3d snapshots feature
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