Update Electrical Components and Add Examples #9

Open
Mathemensch wants to merge 2 commits from Mathemensch/circuiteria:main into main
First-time contributor

Refactor: Update Electrical Components and Add Examples

This PR updates the visual representation of electrical components and adds example circuits.

Changes:

  • Updated Electrical Components (src/elements/electrical/):
    • Revised symbols for better standard compliance and readability (e.g., IEC resistor default, battery symbol for DC source, redesigned switch).
    • Added explicit connection lines from ports to the component body where appropriate (sources, meters, lamp, inductor, switch).
  • Added Example Circuits (gallery/simple-circuit.typ):
    • Created a new example file demonstrating basic usage.
    • Includes examples for:
      • Series circuit (battery, two lamps).
      • RC charging circuit (battery, switch, resistor, capacitor).
**Refactor: Update Electrical Components and Add Examples** This PR updates the visual representation of electrical components and adds example circuits. **Changes:** * **Updated Electrical Components (`src/elements/electrical/`):** * Revised symbols for better standard compliance and readability (e.g., IEC resistor default, battery symbol for DC source, redesigned switch). * Added explicit connection lines from ports to the component body where appropriate (sources, meters, lamp, inductor, switch). * **Added Example Circuits (`gallery/simple-circuit.typ`):** * Created a new example file demonstrating basic usage. * Includes examples for: * Series circuit (battery, two lamps). * RC charging circuit (battery, switch, resistor, capacitor).
Mathemensch added 1 commit 2025-04-17 00:32:59 +00:00
Owner

Thanks for the additions !
It looks like you forgot to commit the example circuit though

Thanks for the additions ! It looks like you forgot to commit the example circuit though
Mathemensch added 1 commit 2025-04-17 11:35:15 +00:00
Author
First-time contributor

You were absolutely right.

I've added it right now.

You were absolutely right. I've added it right now.
Owner

There seem to be a small issue with inductors when placed vertically (see below). It also seems like the horizontal inductor needs a specific aspect-ratio between the width and height to display correctly
Apart from this, everything looks good to me !

CodeResult
#circuit({
  electrical.inductor(
    x: 0, y: 0,
    w: 1, h: 1,
    vertical: true,
    debug: (ports: true)
  )
})

image.png

There seem to be a small issue with inductors when placed vertically (see below). It also seems like the horizontal inductor needs a specific aspect-ratio between the width and height to display correctly Apart from this, everything looks good to me ! <table> <thead><tr><th>Code</th><th>Result</th></tr></thead> <tbody><tr><td> ```typ #circuit({ electrical.inductor( x: 0, y: 0, w: 1, h: 1, vertical: true, debug: (ports: true) ) }) ``` </td> <td> ![image.png](/attachments/fe7e2d32-7d6d-40d3-8a1d-63d626abc1c2) </td></tr></tbody> </table>
5.3 KiB
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:Mathemensch-main
git checkout Mathemensch-main
Sign in to join this conversation.
No description provided.