Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tscircuit/jscad-electronics
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.25
Choose a base ref
...
head repository: tscircuit/jscad-electronics
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.26
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Feb 15, 2025

  1. v0.0.25

    actions-user committed Feb 15, 2025
    Copy the full SHA
    30a30d3 View commit details

Commits on Feb 21, 2025

  1. Introduce Female headers 3d model and added example (#89)

    * Introduce Female headers 3d model and added example
    
    * formatted
    
    * Added pinrow-female in footprinter3d
    AnasSarkiz authored Feb 21, 2025
    Copy the full SHA
    b95bd4a View commit details
Showing with 96 additions and 3 deletions.
  1. BIN bun.lockb
  2. +11 −0 examples/femaleHeader.example.tsx
  3. +13 −0 examples/footprinter3d/fp-pinrow6-female.example.tsx
  4. +63 −0 lib/FemaleHeader.tsx
  5. +7 −1 lib/Footprinter3d.tsx
  6. +2 −2 package.json
Binary file modified bun.lockb
Binary file not shown.
11 changes: 11 additions & 0 deletions examples/femaleHeader.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FemaleHeader } from "lib/FemaleHeader"
import { JsCadView } from "jscad-fiber"
import { ExtrudedPads } from "lib/index"
export default () => {
return (
<JsCadView zAxisUp showGrid>
<ExtrudedPads footprint="pinrow5_id01mm_p2.54mm_od01.6mm" />
<FemaleHeader numberOfPins={5} legsLength={3} pitch={2.54} />
</JsCadView>
)
}
13 changes: 13 additions & 0 deletions examples/footprinter3d/fp-pinrow6-female.example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { JsCadView } from "jscad-fiber"
import { Footprinter3d } from "lib/Footprinter3d"
import { ExtrudedPads } from "lib/ExtrudedPads"

const footprint = "pinrow6_id01mm_p2.54mm_od01.6mm_female"
export default () => {
return (
<JsCadView zAxisUp showGrid>
<Footprinter3d footprint={footprint} />
<ExtrudedPads footprint={footprint} />
</JsCadView>
)
}
63 changes: 63 additions & 0 deletions lib/FemaleHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Cuboid, Colorize, Hull, Subtract } from "jscad-fiber"

export const FemaleHeader = ({
numberOfPins,
pitch = 2.54,
legsLength = 3,
}: {
numberOfPins: number
pitch?: number
legsLength?: number
}) => {
const pinThickness = 0.63
const bodyHeight = 5
const bodyWidth = numberOfPins * pitch
const gapWidth = pinThickness * 1.6
const xoff = -((numberOfPins - 1) / 2) * pitch
const Body = (
<Colorize color="#1a1a1a">
<Subtract>
<Cuboid
color="#000"
size={[bodyWidth, pinThickness * 3, bodyHeight]}
center={[0, 0, bodyHeight / 2]}
/>
{Array.from({ length: numberOfPins }, (_, i) => (
<Cuboid
size={[gapWidth, gapWidth, bodyHeight]}
center={[xoff + i * pitch, 0, bodyHeight / 2]}
/>
))}
</Subtract>
</Colorize>
)
return (
<>
{Body}
{Array.from({ length: numberOfPins }, (_, i) => (
<>
{/*Long pins (bottom) */}
<Colorize color="silver">
<Hull>
<Cuboid
color="silver"
size={[pinThickness, pinThickness, legsLength * 0.9]}
center={[xoff + i * pitch, 0, (-legsLength / 2) * 0.9]}
/>
<Cuboid
color="silver"
size={[pinThickness / 1.8, pinThickness / 1.8, legsLength]}
center={[xoff + i * pitch, 0, -legsLength / 2]}
/>
</Hull>
<Cuboid
color="silver"
size={[gapWidth, gapWidth, gapWidth * 0.5]}
center={[xoff + i * pitch, 0, (gapWidth / 2) * 0.5]}
/>
</Colorize>
</>
))}
</>
)
}
8 changes: 7 additions & 1 deletion lib/Footprinter3d.tsx
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ import { A1206 } from "./A1206"
import { A1210 } from "./A1210"
import { A2010 } from "./A2010"
import { A2512 } from "./A2512"
import { FemaleHeader } from "./FemaleHeader"

/**
* Outputs a 3d model for any [footprinter string](https://github.com/tscircuit/footprinter)
@@ -30,6 +31,8 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => {
fn: string
thermalpad: { x: number; y: number }
imperial: String
male: boolean
female: boolean
}

switch (fpJson.fn) {
@@ -73,7 +76,10 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => {
/>
)
case "pinrow":
return <PinRow numberOfPins={fpJson.num_pins} pitch={fpJson.p} />
if (fpJson.male)
return <PinRow numberOfPins={fpJson.num_pins} pitch={fpJson.p} />
if (fpJson.female)
return <FemaleHeader numberOfPins={fpJson.num_pins} pitch={fpJson.p} />

case "cap": {
switch (fpJson.imperial) {
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jscad-electronics",
"type": "module",
"version": "0.0.24",
"version": "0.0.25",
"main": "./dist/index.js",
"repository": {
"type": "git",
@@ -32,7 +32,7 @@
"vite-tsconfig-paths": "^5.0.1"
},
"dependencies": {
"@tscircuit/footprinter": "^0.0.124",
"@tscircuit/footprinter": "^0.0.132",
"circuit-json": "^0.0.92"
}
}