Anas - @Seve polygon pcb smtpads not drown in c...

@Seve polygon pcb smtpads not drown in core using toMatchPcbSnapshot
51 Replies
Anas
AnasOP3w ago
import { test, expect } from "bun:test"
import { getTestFixture } from "../fixtures/get-test-fixture"

test("example30: polygon shape smtpad", async () => {
const { circuit } = getTestFixture()

circuit.add(
<board width="20mm" height="30mm">
<MyComponent name="U1" />
</board>,
)

await circuit.renderUntilSettled()
expect(circuit).toMatchPcbSnapshot(import.meta.path)
})

const MyComponent = (props: { name: string }) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
portHints={["1"]}
points={[
{ x: -1, y: 0 },
{ x: -1, y: 1 },
]}
/>
<smtpad
shape="polygon"
portHints={["2"]}
points={[
{ x: 1, y: 0 },
{ x: 1, y: 1 },
]}
/>
</footprint>
}
/>
)
}
import { test, expect } from "bun:test"
import { getTestFixture } from "../fixtures/get-test-fixture"

test("example30: polygon shape smtpad", async () => {
const { circuit } = getTestFixture()

circuit.add(
<board width="20mm" height="30mm">
<MyComponent name="U1" />
</board>,
)

await circuit.renderUntilSettled()
expect(circuit).toMatchPcbSnapshot(import.meta.path)
})

const MyComponent = (props: { name: string }) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
portHints={["1"]}
points={[
{ x: -1, y: 0 },
{ x: -1, y: 1 },
]}
/>
<smtpad
shape="polygon"
portHints={["2"]}
points={[
{ x: 1, y: 0 },
{ x: 1, y: 1 },
]}
/>
</footprint>
}
/>
)
}
Seve
Seve3w ago
We probably need circuit to svg support
Anas
AnasOP3w ago
No description
Anas
AnasOP3w ago
I think we already supported
Seve
Seve3w ago
i mean part of the issue is to just get polygon smtpads working, idk what's currently implemented or not, i just want it to work for the user
Anas
AnasOP3w ago
@Seve
No description
Seve
Seve3w ago
I'm going to be a tiny bit anal and say the shapes are too far off from a capacitive touch string 😁 . The nice thing about this approach is we can see if we get any "bad errors" because they have bounding box overlap
No description
Anas
AnasOP3w ago
Should I make a full board or just the pads?
Seve
Seve3w ago
Just the pads is find *fine
Anas
AnasOP3w ago
@Seve
No description
Seve
Seve3w ago
yep that's correct looks great also a great example for the docs
Anas
AnasOP3w ago
In the docs example, should I make a full example (board with a chip that has three polygon pads)?
Seve
Seve3w ago
@Anas can you clarify, were polygon smtpads working just didn't have a test? did you need to adjust any implementation etc. yea i think the three polygon pads is a good example, since people recognize capacitive strips, you could do both, your existing example as the simple example, then add a section with a "Example: Capacitive Touch Strip" it seems like the polygon smtpads were working so this PR was mostly adding a test and doc? Is that right?
Anas
AnasOP3w ago
Yes, I think that, I've modified the docs smtpad page, added a polygon with an example in this pr https://github.com/tscircuit/docs/pull/148
Anas
AnasOP3w ago
its a simple example
Anas
AnasOP3w ago
<smtpad /> | tscircuit docs
The <smtpad /> element is used to represent a surface mount pad.
Seve
Seve3w ago
hehe ok i thought there would be some fixes associated with this, so this is a pretty high bounty for a doc page can you add the "Capacitive Strip Tutorial" that has the 3 pads inside a <chip />, i think that'll be fair to claim the bounty
Seve
Seve3w ago
No description
Seve
Seve3w ago
you don't need to write anything, maybe 1-2 sentences, then show the code example and you're good to go
Anas
AnasOP3w ago
<board width={16}>
<PolygonSmtpads name="U1" />
</board>

const PolygonSmtpads = (props: {
name: string
}) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
layer="top"
portHints={["pin1"]}
points={[
{ x: -4.5, y: 2 },
{ x: -2.2, y: 2 },
{ x: -0.4, y: 0 },
{ x: -2.2, y: -2 },
{ x: -4.5, y: -2 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin2"]}
points={[
{ x: -1.8, y: 2 },
{ x: 1.8, y: 2 },
{ x: 3.6, y: 0 },
{ x: 1.8, y: -2 },
{ x: -1.8, y: -2 },
{ x: 0, y: 0 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin3"]}
points={[
{ x: 2.2, y: 2 },
{ x: 6, y: 2 },
{ x: 6, y: -2 },
{ x: 2.2, y: -2 },
{ x: 4, y: 0 },
]}
/>
</footprint>
}
/>
<board width={16}>
<PolygonSmtpads name="U1" />
</board>

const PolygonSmtpads = (props: {
name: string
}) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
layer="top"
portHints={["pin1"]}
points={[
{ x: -4.5, y: 2 },
{ x: -2.2, y: 2 },
{ x: -0.4, y: 0 },
{ x: -2.2, y: -2 },
{ x: -4.5, y: -2 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin2"]}
points={[
{ x: -1.8, y: 2 },
{ x: 1.8, y: 2 },
{ x: 3.6, y: 0 },
{ x: 1.8, y: -2 },
{ x: -1.8, y: -2 },
{ x: 0, y: 0 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin3"]}
points={[
{ x: 2.2, y: 2 },
{ x: 6, y: 2 },
{ x: 6, y: -2 },
{ x: 2.2, y: -2 },
{ x: 4, y: 0 },
]}
/>
</footprint>
}
/>
Seve
Seve3w ago
code style adjustments, <CapacitiveTouchStrip name="U1" /> make sure to include schPinArrangement
Anas
AnasOP3w ago
Do we need to add the other board components? like holes
Seve
Seve3w ago
nope you do need soldermask though the soldermask might actually be a problem 🤔 for a capacitive touch strip to work, the copper has to be covered with soldermask, same as traces we might want to introduce an <smtpad /> prop like coverWithSolderMask lmk if this makes sense, the tricky thing about soldermask is i don't think it shows up in circuit-to-svg currently
Anas
AnasOP3w ago
So this will be a new issue, I think
Seve
Seve3w ago
i can either cut the bounty for that issue $75 since there were no fixes or increase the bounty $100 to cover the soldermask issue, but the point of the issue was that a user needed a capacitive strip, so documenting something the user can't use is unfortunately not useful lmk what you'd like to do, i don't usually change bounties but in this case there were no fixes AND the user's issue isn't solved
Anas
AnasOP3w ago
U r right,I think we have to split the bounty
Seve
Seve3w ago
eh actually i'm thinking about this more i think we need to be mindful of intent, and you're not meeting the criteria of the issue to recreate the example design i'm going to tip your doc $50 for the unrelated improvement, but i'm rephrasing the original issue to more accurately describe the intent
Seve
Seve3w ago
the issue is here and the bounty has been increased to $250 https://github.com/tscircuit/tscircuit/issues/786
GitHub
Support Capacitive Touch Slider element, add solvermask support to ...
circuit-json supports polygon pcb smtpads, but there isn&#39;t an example in the docs https://github.com/tscircuit/circuit-json/blob/main/src/pcb/pcb_smtpad.ts Create a tscircuit/core pcb snapshot ...
Anas
AnasOP3w ago
tip not working
No description
Seve
Seve3w ago
?
Anas
AnasOP3w ago
Idk, but I'm not receiving the tip, also the algora comment looks strange
Seve
Seve3w ago
i paid via that stripe link so you should get it oh we exceeded our algora budget you should get it now
Anas
AnasOP3w ago
thnx Seve, I'm trying to run my code on tscircuit.com. 3D and PCB viewer do not support polygon SMT pads, or maybe we need to update the dep
export default () => (
<board width={16}>
<PolygonSmtpads name="U1" />
</board>
)


const PolygonSmtpads = (props: {
name: string
}) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
layer="top"
portHints={["pin1"]}
points={[
{ x: -4.5, y: 2 },
{ x: -2.2, y: 2 },
{ x: -0.4, y: 0 },
{ x: -2.2, y: -2 },
{ x: -4.5, y: -2 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin2"]}
points={[
{ x: -1.8, y: 2 },
{ x: 1.8, y: 2 },
{ x: 3.6, y: 0 },
{ x: 1.8, y: -2 },
{ x: -1.8, y: -2 },
{ x: 0, y: 0 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin3"]}
points={[
{ x: 2.2, y: 2 },
{ x: 6, y: 2 },
{ x: 6, y: -2 },
{ x: 2.2, y: -2 },
{ x: 4, y: 0 },
]}
/>
</footprint>
}
/>
)
}
export default () => (
<board width={16}>
<PolygonSmtpads name="U1" />
</board>
)


const PolygonSmtpads = (props: {
name: string
}) => {
return (
<chip
{...props}
footprint={
<footprint>
<smtpad
shape="polygon"
layer="top"
portHints={["pin1"]}
points={[
{ x: -4.5, y: 2 },
{ x: -2.2, y: 2 },
{ x: -0.4, y: 0 },
{ x: -2.2, y: -2 },
{ x: -4.5, y: -2 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin2"]}
points={[
{ x: -1.8, y: 2 },
{ x: 1.8, y: 2 },
{ x: 3.6, y: 0 },
{ x: 1.8, y: -2 },
{ x: -1.8, y: -2 },
{ x: 0, y: 0 },
]}
/>

<smtpad
shape="polygon"
layer="top"
portHints={["pin3"]}
points={[
{ x: 2.2, y: 2 },
{ x: 6, y: 2 },
{ x: 6, y: -2 },
{ x: 2.2, y: -2 },
{ x: 4, y: 0 },
]}
/>
</footprint>
}
/>
)
}
Anas
AnasOP3w ago
No description
Anas
AnasOP3w ago
No description
Seve
Seve3w ago
ah so the original issue was valid if you create issues on those repos i'll bounty them
Anas
AnasOP3w ago
ok, let me check first if the 3D-viewer and PCB-viewer repo support the polygon pads or not if not Iwill make issue
Anas
AnasOP3w ago
I found this in 3D-viewr
No description
Seve
Seve3w ago
nice yea looks very incomplete tbh we should be texturing the top of boards rather than performing manifold operations to recreate shapes so let's create an issue to texture the 3d model rather than continue adding on new manifold shapes
Seve
Seve3w ago
this is an example of a textured 3d model
No description
Anas
AnasOP3w ago
yeah we need that
Anas
AnasOP3w ago
also the PCB-viewer not support it
No description
Anas
AnasOP3w ago
I will create issue
Anas
AnasOP3w ago
445 commits behind long time 🤕
No description
Anas
AnasOP3w ago
No description
Anas
AnasOP3w ago
GitHub
feat: add polygon shape support for pcb_smtpad by AnasSarkiz · Pul...
Implement polygon shape rendering for SMT pads Add example fixture demonstrating various polygon pad configurations /fixes #376 /claim #376

Did you find this page helpful?