-
Notifications
You must be signed in to change notification settings - Fork 41
add LED5050 3D model #312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add LED5050 3D model #312
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { JsCadView } from "jscad-fiber" | ||
| import { ExtrudedPads, Led5050 } from "../lib" | ||
|
|
||
| export default () => ( | ||
| <JsCadView zAxisUp showGrid> | ||
| <Led5050 /> | ||
| <ExtrudedPads footprint="led5050" /> | ||
| </JsCadView> | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { | ||
| Colorize, | ||
| Cuboid, | ||
| Cylinder, | ||
| Rotate, | ||
| Subtract, | ||
| Translate, | ||
| } from "jscad-fiber" | ||
| import { ChipBody } from "./ChipBody" | ||
|
|
||
| export interface Led5050Props { | ||
| color?: string | ||
| bodyColor?: string | ||
| leadColor?: string | ||
| } | ||
|
|
||
| export const Led5050 = ({ | ||
| color = "#ffff00", | ||
| bodyColor = "#ffffff", | ||
| leadColor = "#dedede", | ||
| }: Led5050Props) => { | ||
| const bodySize = 5 | ||
| const leadSpan = 5.4 | ||
| const bodyBottom = 0.2 | ||
| const bodyHeight = 1.3 | ||
| const bodyTop = bodyBottom + bodyHeight | ||
| const leadLength = 1.4 | ||
| const leadWidth = 1 | ||
| const leadThickness = 0.2 | ||
| const leadCenterX = leadSpan / 2 - leadLength / 2 | ||
| const lensRadius = 2 | ||
| const lensHeight = 0.25 | ||
| const lensTop = 1.55 | ||
| const cornerCutDepth = 0.3 | ||
| const leadYPositions = [-1.7, 0, 1.7] | ||
| const leadSides = [-1, 1] | ||
|
|
||
| return ( | ||
| <> | ||
| {leadYPositions.flatMap((y) => | ||
| leadSides.map((side) => ( | ||
| <Cuboid | ||
| key={`${side}-${y}`} | ||
| color={leadColor} | ||
| size={[leadLength, leadWidth, leadThickness]} | ||
| center={[side * leadCenterX, y, leadThickness / 2]} | ||
| /> | ||
| )), | ||
| )} | ||
|
|
||
| <Colorize color={bodyColor}> | ||
| <Subtract> | ||
| <ChipBody | ||
| width={bodySize} | ||
| length={bodySize} | ||
| height={bodyHeight} | ||
| heightAboveSurface={bodyBottom} | ||
| center={{ x: 0, y: 0, z: 0 }} | ||
| color={bodyColor} | ||
| taperRatio={0.036} | ||
| straightHeightRatio={0.01} | ||
| includeNotch={false} | ||
| /> | ||
| <Cylinder | ||
| radius={lensRadius} | ||
| height={lensHeight} | ||
| center={[0, 0, bodyTop - lensHeight / 2]} | ||
| /> | ||
| <Translate | ||
| offset={[ | ||
| -bodySize / 2, | ||
| bodySize / 2, | ||
| bodyTop - cornerCutDepth / 2 + 0.005, | ||
| ]} | ||
| > | ||
| <Rotate rotation={[0, 0, Math.PI / 4]}> | ||
| <Cuboid size={[0.9, 0.9, cornerCutDepth + 0.01]} /> | ||
| </Rotate> | ||
| </Translate> | ||
| </Subtract> | ||
| </Colorize> | ||
|
|
||
| <Cylinder | ||
| color={color} | ||
| radius={lensRadius} | ||
| height={lensHeight} | ||
| center={[0, 0, lensTop - lensHeight / 2]} | ||
| /> | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| export default Led5050 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { expect, test } from "bun:test" | ||
| import "../fixtures/png-matcher" | ||
| import { renderFootprint } from "../helpers/render-footprint" | ||
|
|
||
| test("led5050", async () => { | ||
| const pngBuffer = await renderFootprint("led5050") | ||
| await expect(pngBuffer).toMatchPngSnapshot(import.meta.path) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.