T
tscircuit•2mo ago
Seve

@Abse if you want a fairly difficult

@Abse if you want a fairly difficult project, we need to integrate footprinter models into circuit-json-to-gltf. It requires converting jscad-planner objects into GLTF/OBJ objects. Sort of on the hard end
47 Replies
Abse
Abse•2mo ago
ok can I get quick brief
Seve
SeveOP•2mo ago
circuit json represents some 3d models with cad_component.footprinter_string you can see this in e.g. the usb-c-flashlight
Seve
SeveOP•2mo ago
No description
No description
Seve
SeveOP•2mo ago
we need to incorporate these footprinter_string models into the gltf output to do that, you have to use jscad-electronics to get the jscad representation then you have to convert the jscad representation into the gltf format jscad-electronics also annoyingly requires React, a good side quest is to build a version of jscad-electronics that doesn't require react by creating a custom h function (pragma function) so that you can just do import { getJscadModelForFootprint } from "jscad-electronics/vanilla" jscad-fiber could also export that pragma
Abse
Abse•2mo ago
@Seve I used a lot of ai help with jscad without react , I think I got something , need your review I will draft a PR soon
Seve
SeveOP•2mo ago
cool
Abse
Abse•2mo ago
to be honest I'm not sure if this is breaking anything or not , should we do more tests ?
Seve
SeveOP•2mo ago
yea you should try yalc'ing this in 3d-viewer probablyu just to make sure nothing breaks
Abse
Abse•2mo ago
ok
Seve
SeveOP•2mo ago
also the test files look insane, i'm not sure why you need all that complexity. But the result is pretty good the way it's used is so weird i'm not sure it works also why is there a useMemo shim it's generally correct i'm just confused i would try to build it, then create a fresh project, yalc add it, then see if you can import the vanilla without react being in your project or installed in any way
Abse
Abse•2mo ago
will I had alot of Ai help and I'm not sure I 100% understand the code too lol , I will clean it I just want to know that I'm on the right way
Seve
SeveOP•2mo ago
yea i think you did it right
Abse
Abse•2mo ago
3d viewer is working fine
No description
No description
No description
No description
Abse
Abse•2mo ago
new empty repo and this test passes it only had
{
"name": "bun-react-template",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "bun --hot src/index.tsx",
"build": "bun build ./src/index.html --outdir=dist --sourcemap --target=browser --minify --define:process.env.NODE_ENV='\"production\"' --env='BUN_PUBLIC_*'",
"start": "NODE_ENV=production bun src/index.tsx"
},
"dependencies": {
"@tscircuit/footprinter": "^0.0.230",
"jscad-electronics": "file:.yalc/jscad-electronics"
},
"devDependencies": {
"@types/bun": "latest"
}
}
{
"name": "bun-react-template",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "bun --hot src/index.tsx",
"build": "bun build ./src/index.html --outdir=dist --sourcemap --target=browser --minify --define:process.env.NODE_ENV='\"production\"' --env='BUN_PUBLIC_*'",
"start": "NODE_ENV=production bun src/index.tsx"
},
"dependencies": {
"@tscircuit/footprinter": "^0.0.230",
"jscad-electronics": "file:.yalc/jscad-electronics"
},
"devDependencies": {
"@types/bun": "latest"
}
}
@Seve
Abse
Abse•2mo ago
Abse
Abse•2mo ago
the file is too long , etc
Seve
SeveOP•2mo ago
Woah crazy Alright yea lmk if you feel like its clean and we can do a review and try to ship? I will also do some basic testing. Awesome contrib
Abse
Abse•2mo ago
I was wondering should I leave or remove the tests in the current PR ? yeah can I get another review + I'm not sure how to handle the types ( too much any ?)
Seve
SeveOP•2mo ago
Yea the tests are crazy, why dont you just make that importVanilla a tests/fixtures/importVanilla.js? would increase readability Will definitely test stuff tonight and can probably push some of my own contribs
Abse
Abse•2mo ago
@Seve we are getting somewhere
Abse
Abse•2mo ago
Abse
Abse•2mo ago
still need work tho
Seve
SeveOP•2mo ago
DUDE!!!!!! WTFFF!!!!! AMAZINGT!!@!!!!!!
Abse
Abse•2mo ago
using yalc
Seve
SeveOP•2mo ago
btw the issue you're having looks like back face culling the back faces are showing as front faces ai can usually fix that pretty quick if that is the issue
Abse
Abse•2mo ago
nice thanks for the help
Seve
SeveOP•2mo ago
ofc at some point we might want to move some stuff around on that project, like i almost think jscad-fiber should expose the h function then it could be imported from jscad-electronics but not a huge deal, just super happy that we don't need React to render the footprint models major simplification
Abse
Abse•2mo ago
ai one shot it lol
No description
Seve
SeveOP•2mo ago
awesome
Abse
Abse•2mo ago
now the type c is gone
Seve
SeveOP•2mo ago
i think the resistors might be "sunk" and need to be offset by the board height 🤔
Abse
Abse•2mo ago
need to get it back
Seve
SeveOP•2mo ago
oh weird
Abse
Abse•2mo ago
No description
Abse
Abse•2mo ago
so the size is off right ?
Seve
SeveOP•2mo ago
No that looks about right imo, the pads are usually bigger It is off center Also the button is also supposed to be a footprinter string 🤔
Abse
Abse•2mo ago
will test it repro in jscad etc @Seve are we using zod 4 now ?
Seve
SeveOP•2mo ago
no not yet we haven't even started the migration, and adding zod 4 will generally break everything
Abse
Abse•2mo ago
No description
Seve
SeveOP•2mo ago
circuit json util shouldn't have zod 4
Seve
SeveOP•2mo ago
this will fix it
No description
Abse
Abse•2mo ago
and I'm getting a zod parser error when using footprint string pushbutton
Seve
SeveOP•2mo ago
yea we need to get zod 4 outta there we will upgrade but probably not in August
Abse
Abse•2mo ago
I will fix it

Did you find this page helpful?