T
tscircuit9mo ago
Seve

3d Viewer / 3D SVGs

CC @૮༼⚆︿⚆༽つ @ansh.grover @Rishabh let's discuss the 3d viewer stuff here, I know people are having a bunch of issues getting it to work
19 Replies
Seve
SeveOP9mo ago
So there are 2-ish issues going on. * Something with bundling jscad/modeling, @ansh.grover can you put your test on a PR/draft PR that I can look at * @Rishabh in @૮༼⚆︿⚆༽つ 's 3d svg implementation, he didn't need jsdom (I think?), I'm curious if that's a real dep we need- using jsdom is usually kind of a hack
Seve
SeveOP9mo ago
@૮༼⚆︿⚆༽つ 's PR for reference: https://github.com/tscircuit/circuit-to-svg/pull/166/files
GitHub
Support 3d Rendering via 3d-viewer with SvgRenderer by DrSensor · P...
close #138 /claim #138 WarningThis draft has some sorcery. (review with caution!) if Copilot (or other AI) hallucinated, try: git blame, https://githistory.xyz, or https://semanticdiff.com Importa...
ansh.grover
ansh.grover9mo ago
@Seve no the problem is with jscad/modelling dependicies
ansh.grover
ansh.grover9mo ago
No description
Seve
SeveOP9mo ago
@ansh.grover yes I'm familiar with it.... I've seen this error a million times now. I need a repro on the 3d-viewer repo
ansh.grover
ansh.grover9mo ago
see so i have created a esm-test-load.js file and then test it
Seve
SeveOP9mo ago
yes can you link that PR
ansh.grover
ansh.grover9mo ago
No description
ansh.grover
ansh.grover9mo ago
but the thing is the test build for this script is failing after 2 modules transformed
Seve
SeveOP9mo ago
when you're creating a repro, you don't have to merge it, it's just so that i can pull it and quickly fix the issue the PR helps me quickly pull it, it's much better than sending me a screenshot etc. because i can inspect the code for example in the message you just sent me, I would have to guess that you modified the index.html screenshots are great too, but w/o the code i'm just guessing what you might have changed etc.
ansh.grover
ansh.grover9mo ago
as these are some changes should i make a ci workflow to test it
Seve
SeveOP9mo ago
ok not quite the approach i was looking for i'll PR in a sec- usually if you have something in a scripts/ directory, it means it's a node script not something loaded by vite idk if we need to test compat w/ vite, i think we want to test compat with node i'll show you what i mean in a sec
૮༼⚆︿⚆༽つ
dom emulation is a must because that's how three.js SVGRenderer works. i use happy-dom rather than jsdom based on bun docs recommendation. it's not as complete as jsdom but faster than jsdom. (some trivia: i've experience using jsdom in deno v1 and it fail)
Seve
SeveOP9mo ago
ok makes sense!!!
Seve
SeveOP9mo ago
@Rishabh @૮༼⚆︿⚆༽つ I spent a couple hours trying to get react-three-fiber to render to an SVG and I'm annoyed enough that I think we can go native with a vanilla js implementation: https://github.com/tscircuit/3d-viewer/issues/149 I want to throw out the entire repo and start from scratch. The only constraints: - Vite should be used - React Cosmos should be used - React can only be used in dev (*.fixture.tsx and /lib/react for a React component export) - ThreeJS usage should be vanilla, no react-three-fiber @Rishabh do you want to lead the effort to refactor it? We will work on an orphan branch and eventually release it as version 0.1.x (we are currently on 0.0.120)
GitHub
vanilla.js version · Issue #149 · tscircuit/3d-viewer
since #143 implemented without R3F (react-three), it should be possible now to provide vanilla.js (a.k.a just three.js) version. related: tscircuit/tscircuit#508 also, some store/app that use non-J...
Seve
SeveOP9mo ago
also because we're doing this from scratch, we can now do SVG regression testing the entire time, so cosmos will just be for interactivity
Seve
SeveOP9mo ago
@Rishabh @૮༼⚆︿⚆༽つ blank branch here: https://github.com/tscircuit/3d-viewer/tree/v01 somebody should bootstrap it! We need to convert all that react-three code over. The README now has a notice about the branch:
GitHub
GitHub - tscircuit/3d-viewer at v01
3d viewer for printed circuit boards created using tscircuit - GitHub - tscircuit/3d-viewer at v01
No description

Did you find this page helpful?