Spaces:
Running
Running
Link the 19 coupled assets' joints one way in the 3D view
Browse filesmake_previews.py reads each package's joint_couplings (sidecar) into a one-way mimic link; the viewer moves the driven joint with its driver while it can still be moved on its own. viewer.js v=34, app.js v=36.
Files changed (23)
- app.js+2-2
- index.html+1-1
- previews/bath_lift.json+1-1
- previews/bolt_cutter.json+1-1
- previews/folding_chair.json+1-1
- previews/grabber_tool.json+1-1
- previews/hand_crank_egg_beater.json+1-1
- previews/hand_crank_ice_cream_maker.json+1-1
- previews/hole_punch.json+1-1
- previews/locking_pliers.json+1-1
- previews/manual_book_press.json+1-1
- previews/manual_can_crusher.json+1-1
- previews/manual_die_cutting_machine.json+1-1
- previews/nail_clipper.json+1-1
- previews/pedal_trash_can.json+1-1
- previews/pipe_wrench.json+1-1
- previews/stapler.json+1-1
- previews/tabletop_pinball_machine.json+1-1
- previews/trash_bin_pedal_metal.json+1-1
- previews/winged_corkscrew.json+1-1
- previews/wringer_bucket.json+1-1
- tools/make_previews.py+43-2
- viewer.js+23-10
239 unmodified lines240241242243244245246197 unmodified lines444445446447448449450239 unmodified linesasync function getViewer() {if (viewer || viewerFailed) return viewer;try {const { createViewer } = await import(signed("./viewer.js?v=33"));viewer = createViewer();} catch (e) {console.error("3D viewer failed to start", e);197 unmodified linesconst step = r.type === "hinge" ? 1 : Math.max((r.hi - r.lo) / 200, 0.0005);const input = el("input", { type: "range", min: r.lo, max: r.hi, step, value: r.val, "aria-label": `${r.name} position` });input.addEventListener("input", () => viewer.setJoint(i, parseFloat(input.value)));if (r.follows) row.append(el("div", { class: "joint-link" }, `Linked: moves with ${r.follows}`));row.append(input);row._input = input;r.row = row;239 unmodified lines240241242243244245246197 unmodified lines444445446447448449450239 unmodified linesasync function getViewer() {if (viewer || viewerFailed) return viewer;try {const { createViewer } = await import(signed("./viewer.js?v=34"));viewer = createViewer();} catch (e) {console.error("3D viewer failed to start", e);197 unmodified linesconst step = r.type === "hinge" ? 1 : Math.max((r.hi - r.lo) / 200, 0.0005);const input = el("input", { type: "range", min: r.lo, max: r.hi, step, value: r.val, "aria-label": `${r.name} position` });input.addEventListener("input", () => viewer.setJoint(i, parseFloat(input.value)));if (r.follows) row.append(el("div", { class: "joint-link" }, r.oneWay ? `Linked: driven by ${r.follows}` : `Linked: moves with ${r.follows}`));row.append(input);row._input = input;r.row = row;
82 unmodified lines83848586878882 unmodified lines</aside></div><script src="app.js?v=35"></script></body></html>82 unmodified lines83848586878882 unmodified lines</aside></div><script src="app.js?v=36"></script></body></html>
1{"joints":[{"name":"lift","type":"hinge","parent":"base","child":"scissor","pivot":[0.0,0.145,-0.18],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":20.053522},{"name":"cross_scissor","type":"hinge","parent":"scissor","child":"crossarm","pivot":[0.0,0.3525,-0.0],"axis":[1.0,0.0,-0.0],"lower":-40.107044,"upper":0.0},{"name":"level_seat","type":"hinge","parent":"crossarm","child":"seat","pivot":[0.0,0.56,-0.18],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":20.053522},{"name":"recline","type":"hinge","parent":"seat","child":"back","pivot":[0.0,0.645,-0.18],"axis":[1.0,0.0,-0.0],"lower":-28.64789,"upper":0.0}]}1{"joints":[{"name":"lift","type":"hinge","parent":"base","child":"scissor","pivot":[0.0,0.145,-0.18],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":20.053522},{"name":"cross_scissor","type":"hinge","parent":"scissor","child":"crossarm","pivot":[0.0,0.3525,-0.0],"axis":[1.0,0.0,-0.0],"lower":-40.107044,"upper":0.0,"mimic":{"ref":"lift","gearing":2.0,"offset":0.0,"one_way":true}},{"name":"level_seat","type":"hinge","parent":"crossarm","child":"seat","pivot":[0.0,0.56,-0.18],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":20.053522,"mimic":{"ref":"lift","gearing":-1.0,"offset":0.0,"one_way":true}},{"name":"recline","type":"hinge","parent":"seat","child":"back","pivot":[0.0,0.645,-0.18],"axis":[1.0,0.0,-0.0],"lower":-28.64789,"upper":0.0}]}
1{"joints":[{"name":"left_jaw_pivot","type":"hinge","parent":"bridge","child":"left_jaw","pivot":[-0.028299,0.729796,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-2.979381,"upper":0.0},{"name":"left_handle_pivot","type":"hinge","parent":"left_jaw","child":"left_handle","pivot":[-0.035766,0.597028,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":25.210142},{"name":"right_jaw_pivot","type":"hinge","parent":"bridge","child":"right_jaw","pivot":[0.028299,0.729796,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":2.979381},{"name":"right_handle_pivot","type":"hinge","parent":"right_jaw","child":"right_handle","pivot":[0.035766,0.597028,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-25.210142,"upper":0.0}]}1{"joints":[{"name":"left_jaw_pivot","type":"hinge","parent":"bridge","child":"left_jaw","pivot":[-0.028299,0.729796,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-2.979381,"upper":0.0,"mimic":{"ref":"left_handle_pivot","gearing":0.118182,"offset":0.0,"one_way":true}},{"name":"left_handle_pivot","type":"hinge","parent":"left_jaw","child":"left_handle","pivot":[-0.035766,0.597028,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":25.210142},{"name":"right_jaw_pivot","type":"hinge","parent":"bridge","child":"right_jaw","pivot":[0.028299,0.729796,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":2.979381,"mimic":{"ref":"right_handle_pivot","gearing":0.118182,"offset":0.0,"one_way":true}},{"name":"right_handle_pivot","type":"hinge","parent":"right_jaw","child":"right_handle","pivot":[0.035766,0.597028,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-25.210142,"upper":0.0,"mimic":{"ref":"left_handle_pivot","gearing":1.0,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"seat_fold","type":"hinge","parent":"frame","child":"seat","pivot":[0.0,0.455,0.012],"axis":[1.0,0.0,-0.0],"lower":-72.76564,"upper":0.0},{"name":"rear_fold","type":"hinge","parent":"frame","child":"rear_legs","pivot":[0.0,0.555,-0.09],"axis":[1.0,0.0,-0.0],"lower":-37.242256,"upper":0.0}]}1{"joints":[{"name":"seat_fold","type":"hinge","parent":"frame","child":"seat","pivot":[0.0,0.455,0.012],"axis":[1.0,0.0,-0.0],"lower":-72.76564,"upper":0.0},{"name":"rear_fold","type":"hinge","parent":"frame","child":"rear_legs","pivot":[0.0,0.555,-0.09],"axis":[1.0,0.0,-0.0],"lower":-37.242256,"upper":0.0,"mimic":{"ref":"seat_fold","gearing":-0.511811,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"squeeze","type":"hinge","parent":"body","child":"trigger","pivot":[0.025,0.894,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-21.772396,"upper":0.0},{"name":"left_jaw_hinge","type":"hinge","parent":"body","child":"left_jaw","pivot":[-0.022,0.216,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-18.793016,"upper":0.0},{"name":"right_jaw_hinge","type":"hinge","parent":"body","child":"right_jaw","pivot":[0.022,0.216,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":18.793016}]}1{"joints":[{"name":"squeeze","type":"hinge","parent":"body","child":"trigger","pivot":[0.025,0.894,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-21.772396,"upper":0.0},{"name":"left_jaw_hinge","type":"hinge","parent":"body","child":"left_jaw","pivot":[-0.022,0.216,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-18.793016,"upper":0.0,"mimic":{"ref":"squeeze","gearing":-0.863158,"offset":0.0,"one_way":true}},{"name":"right_jaw_hinge","type":"hinge","parent":"body","child":"right_jaw","pivot":[0.022,0.216,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":18.793016,"mimic":{"ref":"squeeze","gearing":0.863158,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"crank_rotation","type":"hinge","parent":"frame","child":"drive","pivot":[0.0,0.193,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":null,"upper":null},{"name":"knob_rotation","type":"hinge","parent":"drive","child":"grip","pivot":[0.036,0.152,0.022],"axis":[-0.0,-0.0,-1.0],"lower":null,"upper":null},{"name":"left_rotation","type":"hinge","parent":"frame","child":"left_beater","pivot":[-0.02,0.19,-0.009],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"right_rotation","type":"hinge","parent":"frame","child":"right_beater","pivot":[0.02,0.19,-0.009],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null}]}1{"joints":[{"name":"crank_rotation","type":"hinge","parent":"frame","child":"drive","pivot":[0.0,0.193,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":null,"upper":null},{"name":"knob_rotation","type":"hinge","parent":"drive","child":"grip","pivot":[0.036,0.152,0.022],"axis":[-0.0,-0.0,-1.0],"lower":null,"upper":null},{"name":"left_rotation","type":"hinge","parent":"frame","child":"left_beater","pivot":[-0.02,0.19,-0.009],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null,"mimic":{"ref":"crank_rotation","gearing":-5.0,"offset":0.0,"one_way":true}},{"name":"right_rotation","type":"hinge","parent":"frame","child":"right_beater","pivot":[0.02,0.19,-0.009],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null,"mimic":{"ref":"crank_rotation","gearing":5.0,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"crank_rotation","type":"hinge","parent":"body","child":"crank","pivot":[0.207,0.414,-0.0],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"grip_rotation","type":"hinge","parent":"crank","child":"grip","pivot":[0.239,0.29,0.026],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"dasher_rotation","type":"hinge","parent":"body","child":"dasher","pivot":[0.0,0.356,-0.0],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null}]}1{"joints":[{"name":"crank_rotation","type":"hinge","parent":"body","child":"crank","pivot":[0.207,0.414,-0.0],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"grip_rotation","type":"hinge","parent":"crank","child":"grip","pivot":[0.239,0.29,0.026],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"dasher_rotation","type":"hinge","parent":"body","child":"dasher","pivot":[0.0,0.356,-0.0],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null,"mimic":{"ref":"crank_rotation","gearing":-1.0,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"press","type":"hinge","parent":"base","child":"handle","pivot":[0.0,0.062,-0.024],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":34.377468},{"name":"left_pin_stroke","type":"slider","parent":"base","child":"left_pin","pivot":[0.0,0.0,-0.0],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.009},{"name":"right_pin_stroke","type":"slider","parent":"base","child":"right_pin","pivot":[0.0,0.0,-0.0],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.009},{"name":"paper_width","type":"slider","parent":"base","child":"guide","pivot":[0.1,0.026,-0.029],"axis":[1.0,0.0,-0.0],"lower":-0.01,"upper":0.025}]}1{"joints":[{"name":"press","type":"hinge","parent":"base","child":"handle","pivot":[0.0,0.062,-0.024],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":34.377468},{"name":"left_pin_stroke","type":"slider","parent":"base","child":"left_pin","pivot":[0.0,0.0,-0.0],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.009,"mimic":{"ref":"press","gearing":-0.000261799,"offset":0.0,"one_way":true}},{"name":"right_pin_stroke","type":"slider","parent":"base","child":"right_pin","pivot":[0.0,0.0,-0.0],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.009,"mimic":{"ref":"press","gearing":-0.000261799,"offset":0.0,"one_way":true}},{"name":"paper_width","type":"slider","parent":"base","child":"guide","pivot":[0.1,0.026,-0.029],"axis":[1.0,0.0,-0.0],"lower":-0.01,"upper":0.025}]}
1{"joints":[{"name":"jaw_open","type":"hinge","parent":"frame","child":"jaw","pivot":[0.01173,0.19182,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-16.042818,"upper":0.0},{"name":"squeeze","type":"hinge","parent":"jaw","child":"handle","pivot":[-0.0299,0.16905,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":33.231552},{"name":"unlock","type":"hinge","parent":"handle","child":"release","pivot":[-0.01587,0.08303,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-9.167325,"upper":0.0},{"name":"adjust","type":"hinge","parent":"frame","child":"screw","pivot":[0.03013,0.02162,-0.0],"axis":[0.140021,-0.990149,0.0],"lower":-179.908752,"upper":179.908752}]}1{"joints":[{"name":"jaw_open","type":"hinge","parent":"frame","child":"jaw","pivot":[0.01173,0.19182,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-16.042818,"upper":0.0,"mimic":{"ref":"squeeze","gearing":0.482759,"offset":0.0,"one_way":true}},{"name":"squeeze","type":"hinge","parent":"jaw","child":"handle","pivot":[-0.0299,0.16905,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":33.231552},{"name":"unlock","type":"hinge","parent":"handle","child":"release","pivot":[-0.01587,0.08303,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-9.167325,"upper":0.0},{"name":"adjust","type":"hinge","parent":"frame","child":"screw","pivot":[0.03013,0.02162,-0.0],"axis":[0.140021,-0.990149,0.0],"lower":-179.908752,"upper":179.908752}]}
1{"joints":[{"name":"platen_travel","type":"slider","parent":"frame","child":"platen","pivot":[0.0,0.161,-0.0],"axis":[-0.0,1.0,-0.0],"lower":0.0,"upper":0.096},{"name":"screw_turn","type":"hinge","parent":"platen","child":"spindle","pivot":[0.0,0.233,-0.0],"axis":[-0.0,1.0,-0.0],"lower":0.0,"upper":4320.0}]}1{"joints":[{"name":"platen_travel","type":"slider","parent":"frame","child":"platen","pivot":[0.0,0.161,-0.0],"axis":[-0.0,1.0,-0.0],"lower":0.0,"upper":0.096,"mimic":{"ref":"screw_turn","gearing":-2.22222e-05,"offset":0.0,"one_way":true}},{"name":"screw_turn","type":"hinge","parent":"platen","child":"spindle","pivot":[0.0,0.233,-0.0],"axis":[-0.0,1.0,-0.0],"lower":0.0,"upper":4320.0}]}
1{"joints":[{"name":"lever","type":"hinge","parent":"frame","child":"handle","pivot":[0.0,0.316,0.041],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":94.538033},{"name":"platen_slide","type":"slider","parent":"frame","child":"ram","pivot":[0.0,0.296,0.047],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.25}]}1{"joints":[{"name":"lever","type":"hinge","parent":"frame","child":"handle","pivot":[0.0,0.316,0.041],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":94.538033},{"name":"platen_slide","type":"slider","parent":"frame","child":"ram","pivot":[0.0,0.296,0.047],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.25,"mimic":{"ref":"lever","gearing":-0.00264444,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"handle_stroke","type":"hinge","parent":"frame","child":"lever","pivot":[0.233,0.267,-0.044],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":65.890144},{"name":"press_travel","type":"slider","parent":"frame","child":"press","pivot":[0.0,0.222,-0.024],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.047}]}1{"joints":[{"name":"handle_stroke","type":"hinge","parent":"frame","child":"lever","pivot":[0.233,0.267,-0.044],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":65.890144},{"name":"press_travel","type":"slider","parent":"frame","child":"press","pivot":[0.0,0.222,-0.024],"axis":[-0.0,-1.0,0.0],"lower":0.0,"upper":0.047,"mimic":{"ref":"handle_stroke","gearing":-0.000713308,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"jaw_flex","type":"hinge","parent":"body","child":"upper_jaw","pivot":[0.0,0.00415,-0.023],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":1.403747},{"name":"press","type":"hinge","parent":"body","child":"lever","pivot":[0.0,0.009,0.023],"axis":[1.0,0.0,-0.0],"lower":-10.886198,"upper":0.0}]}1{"joints":[{"name":"jaw_flex","type":"hinge","parent":"body","child":"upper_jaw","pivot":[0.0,0.00415,-0.023],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":1.403747,"mimic":{"ref":"press","gearing":0.128947,"offset":0.0,"one_way":true}},{"name":"press","type":"hinge","parent":"body","child":"lever","pivot":[0.0,0.009,0.023],"axis":[1.0,0.0,-0.0],"lower":-10.886198,"upper":0.0}]}
1{"joints":[{"name":"lid_hinge","type":"hinge","parent":"body","child":"lid","pivot":[0.0,0.638,-0.18],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":80.214088},{"name":"pedal_hinge","type":"hinge","parent":"body","child":"pedal","pivot":[0.0,0.056,0.167],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":14.323945}]}1{"joints":[{"name":"lid_hinge","type":"hinge","parent":"body","child":"lid","pivot":[0.0,0.638,-0.18],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":80.214088,"mimic":{"ref":"pedal_hinge","gearing":-5.6,"offset":0.0,"one_way":true}},{"name":"pedal_hinge","type":"hinge","parent":"body","child":"pedal","pivot":[0.0,0.056,0.167],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":14.323945}]}
1{"joints":[{"name":"adjust","type":"hinge","parent":"body","child":"nut","pivot":[0.155,0.069,-0.0],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":1439.842896},{"name":"opening","type":"slider","parent":"body","child":"hook","pivot":[0.1,0.069,-0.0],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":0.035}]}1{"joints":[{"name":"adjust","type":"hinge","parent":"body","child":"nut","pivot":[0.155,0.069,-0.0],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":1439.842896},{"name":"opening","type":"slider","parent":"body","child":"hook","pivot":[0.1,0.069,-0.0],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":0.035,"mimic":{"ref":"adjust","gearing":-2.43082e-05,"offset":0.0,"one_way":true}}]}
1{"joints":[{"name":"magazine_press","type":"hinge","parent":"base","child":"magazine","pivot":[0.0,0.04,-0.06],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":4.125296},{"name":"handle_press","type":"hinge","parent":"magazine","child":"handle","pivot":[0.0,0.04,-0.06],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":3.151268}]}1{"joints":[{"name":"magazine_press","type":"hinge","parent":"base","child":"magazine","pivot":[0.0,0.04,-0.06],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":4.125296,"mimic":{"ref":"handle_press","gearing":-1.30909,"offset":0.0,"one_way":true}},{"name":"handle_press","type":"hinge","parent":"magazine","child":"handle","pivot":[0.0,0.04,-0.06],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":3.151268}]}
1{"joints":[{"name":"left_flip","type":"hinge","parent":"cabinet","child":"left_flipper","pivot":[-0.116,0.85988,0.396],"axis":[-0.0,0.992877,0.119145],"lower":0.0,"upper":45.836624},{"name":"left_press","type":"slider","parent":"cabinet","child":"left_button","pivot":[-0.324,0.8204,0.35],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":0.006},{"name":"right_flip","type":"hinge","parent":"cabinet","child":"right_flipper","pivot":[0.116,0.85988,0.396],"axis":[-0.0,0.992877,0.119145],"lower":-45.836624,"upper":0.0},{"name":"right_press","type":"slider","parent":"cabinet","child":"right_button","pivot":[0.324,0.8204,0.35],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":0.006},{"name":"launcher_pull","type":"slider","parent":"cabinet","child":"launcher","pivot":[0.245,0.785,0.59],"axis":[-0.0,0.0,1.0],"lower":0.0,"upper":0.065}]}1{"joints":[{"name":"left_flip","type":"hinge","parent":"cabinet","child":"left_flipper","pivot":[-0.116,0.85988,0.396],"axis":[-0.0,0.992877,0.119145],"lower":0.0,"upper":45.836624,"mimic":{"ref":"left_press","gearing":-7639.44,"offset":0.0,"one_way":true}},{"name":"left_press","type":"slider","parent":"cabinet","child":"left_button","pivot":[-0.324,0.8204,0.35],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":0.006},{"name":"right_flip","type":"hinge","parent":"cabinet","child":"right_flipper","pivot":[0.116,0.85988,0.396],"axis":[-0.0,0.992877,0.119145],"lower":-45.836624,"upper":0.0,"mimic":{"ref":"right_press","gearing":7639.44,"offset":0.0,"one_way":true}},{"name":"right_press","type":"slider","parent":"cabinet","child":"right_button","pivot":[0.324,0.8204,0.35],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":0.006},{"name":"launcher_pull","type":"slider","parent":"cabinet","child":"launcher","pivot":[0.245,0.785,0.59],"axis":[-0.0,0.0,1.0],"lower":0.0,"upper":0.065}]}
1{"joints":[{"name":"lid_hinge","type":"hinge","parent":"body","child":"lid","pivot":[0.0,0.63,-0.166],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":80.214088},{"name":"pedal_hinge","type":"hinge","parent":"body","child":"pedal","pivot":[0.0,0.06,0.16],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":17.188734}]}1{"joints":[{"name":"lid_hinge","type":"hinge","parent":"body","child":"lid","pivot":[0.0,0.63,-0.166],"axis":[-1.0,-0.0,-0.0],"lower":0.0,"upper":80.214088,"mimic":{"ref":"pedal_hinge","gearing":-4.66667,"offset":0.0,"one_way":true}},{"name":"pedal_hinge","type":"hinge","parent":"body","child":"pedal","pivot":[0.0,0.06,0.16],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":17.188734}]}
1{"joints":[{"name":"left_hinge","type":"hinge","parent":"frame","child":"left_wing","pivot":[-0.025,0.111,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":77.349304},{"name":"right_hinge","type":"hinge","parent":"frame","child":"right_wing","pivot":[0.025,0.111,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-77.349304,"upper":0.0},{"name":"rack_slide","type":"slider","parent":"frame","child":"rack","pivot":[0.0,0.12,-0.0],"axis":[-0.0,1.0,-0.0],"lower":-0.027,"upper":0.0},{"name":"screw_turn","type":"hinge","parent":"rack","child":"screw","pivot":[0.0,0.12,-0.0],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null}]}1{"joints":[{"name":"left_hinge","type":"hinge","parent":"frame","child":"left_wing","pivot":[-0.025,0.111,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":0.0,"upper":77.349304},{"name":"right_hinge","type":"hinge","parent":"frame","child":"right_wing","pivot":[0.025,0.111,-0.0],"axis":[-0.0,-0.0,-1.0],"lower":-77.349304,"upper":0.0,"mimic":{"ref":"left_hinge","gearing":1.0,"offset":0.0,"one_way":true}},{"name":"rack_slide","type":"slider","parent":"frame","child":"rack","pivot":[0.0,0.12,-0.0],"axis":[-0.0,1.0,-0.0],"lower":-0.027,"upper":0.0,"mimic":{"ref":"left_hinge","gearing":0.000349066,"offset":0.0,"one_way":true}},{"name":"screw_turn","type":"hinge","parent":"rack","child":"screw","pivot":[0.0,0.12,-0.0],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null}]}
1{"joints":[{"name":"compression","type":"slider","parent":"bucket","child":"press","pivot":[0.0,0.636,-0.18],"axis":[-0.0,-0.0,-1.0],"lower":-0.15,"upper":0.0},{"name":"wring_lever","type":"hinge","parent":"bucket","child":"lever","pivot":[0.213,0.631,-0.16],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":57.29578},{"name":"carry_handle","type":"hinge","parent":"bucket","child":"handle","pivot":[0.0,0.49,-0.0],"axis":[1.0,0.0,-0.0],"lower":-103.132401,"upper":0.0},{"name":"swivel_0","type":"hinge","parent":"bucket","child":"caster_0","pivot":[-0.19,0.119,0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_0","type":"hinge","parent":"caster_0","child":"wheel_0","pivot":[-0.19,0.047,0.158],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_1","type":"hinge","parent":"bucket","child":"caster_1","pivot":[0.19,0.119,0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_1","type":"hinge","parent":"caster_1","child":"wheel_1","pivot":[0.19,0.047,0.158],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_2","type":"hinge","parent":"bucket","child":"caster_2","pivot":[-0.19,0.119,-0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_2","type":"hinge","parent":"caster_2","child":"wheel_2","pivot":[-0.19,0.047,-0.122],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_3","type":"hinge","parent":"bucket","child":"caster_3","pivot":[0.19,0.119,-0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_3","type":"hinge","parent":"caster_3","child":"wheel_3","pivot":[0.19,0.047,-0.122],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null}]}1{"joints":[{"name":"compression","type":"slider","parent":"bucket","child":"press","pivot":[0.0,0.636,-0.18],"axis":[-0.0,-0.0,-1.0],"lower":-0.15,"upper":0.0,"mimic":{"ref":"wring_lever","gearing":0.00261799,"offset":0.0,"one_way":true}},{"name":"wring_lever","type":"hinge","parent":"bucket","child":"lever","pivot":[0.213,0.631,-0.16],"axis":[1.0,0.0,-0.0],"lower":0.0,"upper":57.29578},{"name":"carry_handle","type":"hinge","parent":"bucket","child":"handle","pivot":[0.0,0.49,-0.0],"axis":[1.0,0.0,-0.0],"lower":-103.132401,"upper":0.0},{"name":"swivel_0","type":"hinge","parent":"bucket","child":"caster_0","pivot":[-0.19,0.119,0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_0","type":"hinge","parent":"caster_0","child":"wheel_0","pivot":[-0.19,0.047,0.158],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_1","type":"hinge","parent":"bucket","child":"caster_1","pivot":[0.19,0.119,0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_1","type":"hinge","parent":"caster_1","child":"wheel_1","pivot":[0.19,0.047,0.158],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_2","type":"hinge","parent":"bucket","child":"caster_2","pivot":[-0.19,0.119,-0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_2","type":"hinge","parent":"caster_2","child":"wheel_2","pivot":[-0.19,0.047,-0.122],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null},{"name":"swivel_3","type":"hinge","parent":"bucket","child":"caster_3","pivot":[0.19,0.119,-0.14],"axis":[-0.0,1.0,-0.0],"lower":null,"upper":null},{"name":"roll_3","type":"hinge","parent":"caster_3","child":"wheel_3","pivot":[0.19,0.047,-0.122],"axis":[1.0,0.0,-0.0],"lower":null,"upper":null}]}
11 unmodified lines1213141516171819202122232476 unmodified lines1011021031041051067 unmodified lines11411511611711811939 unmodified lines15916016116216316416516616716816917011 unmodified linesA joint that follows another one in Isaac (a PhysX mimic joint, as on scissor andaccordion linkages) gets "mimic": {ref, gearing, offset} in the viewer's units(degrees, metres): its position is -(gearing * ref + offset), as PhysX defines it.Previews are cached in tools/preview_cache.json by package id, so a rerun only convertsnew or changed packages.Run from the Space folder: HF_TOKEN=$(hf auth token) uv run tools/make_previews.py [asset ...](the token only raises Hugging Face's download rate limit; nothing is uploaded)--rig-only rewrites just the .json files from each package's root USD layer (no Blender,the GLBs stay as they are), for when only the joint data changes."""76 unmodified linesif m and m["ref"] in kinds and m["ref"] != jt["name"]:kr, kf = native(kinds[m["ref"]]), native(jt["type"])jt["mimic"] = {"ref": m["ref"], "gearing": round(m["gearing"] * kr / kf, 6), "offset": round(m["offset"] / kf, 6)}# parents before children, so the viewer can chain joints in one passorder, placed = [], set()while len(order) < len(joints):7 unmodified linesreturn orderdef download(url, dest, tries=6):"""GET with an optional HF_TOKEN (higher rate limits) and backoff on 429/5xx."""headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"} if os.environ.get("HF_TOKEN") else {}39 unmodified linesdef rig_only(args, sha, assets):"""Rewrite previews/<asset>.json from the root USD layer alone; report linked (mimic) joints."""def work(a):try:with tempfile.TemporaryDirectory() as tmp:usd = os.path.join(tmp, f"{a}.usd")download(f"{HF}/datasets/{args.dataset}/resolve/{sha}/{a}/simready_usd/{a}.usd", usd)joints = rig(usd)json.dump({"joints": joints}, open(os.path.join(args.out, f"{a}.json"), "w"), separators=(",", ":"))return a, sum("mimic" in j for j in joints), None11 unmodified lines121314151617181920212223242526272876 unmodified lines1051061071081091101117 unmodified lines11912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415539 unmodified lines19519619719819920020120220320420520620720820921021111 unmodified linesA joint that follows another one in Isaac (a PhysX mimic joint, as on scissor andaccordion linkages) gets "mimic": {ref, gearing, offset} in the viewer's units(degrees, metres): its position is -(gearing * ref + offset), as PhysX defines it.A joint that another one drives through the package's OmniGraph coupling (the sidecarsimready_usd/<asset>.json, physics.articulation.joint_couplings: a linear map from thesource joint's range to the target's, e.g. a pedal bin's pedal opening its lid) gets thesame "mimic" with "one_way": true: in Isaac the driven joint can still be moved on its own.Previews are cached in tools/preview_cache.json by package id, so a rerun only convertsnew or changed packages.Run from the Space folder: HF_TOKEN=$(hf auth token) uv run tools/make_previews.py [asset ...](the token only raises Hugging Face's download rate limit; nothing is uploaded)--rig-only rewrites just the .json files from each package's root USD layer and sidecar (no Blender,the GLBs stay as they are), for when only the joint data changes."""76 unmodified linesif m and m["ref"] in kinds and m["ref"] != jt["name"]:kr, kf = native(kinds[m["ref"]]), native(jt["type"])jt["mimic"] = {"ref": m["ref"], "gearing": round(m["gearing"] * kr / kf, 6), "offset": round(m["offset"] / kf, 6)}couple(stage, os.path.splitext(usd_path)[0] + ".json", joints)# parents before children, so the viewer can chain joints in one passorder, placed = [], set()while len(order) < len(joints):7 unmodified linesreturn orderdef couple(stage, sidecar, joints):"""One-way links from the sidecar's joint_couplings, in the viewer's units.Each coupling maps source_range linearly onto target_range (radians for hinges, metresfor sliders). Couplings Isaac runs as PhysX mimic joints are already read from the USD."""if not os.path.exists(sidecar):returntry:couplings = json.load(open(sidecar))["physics"]["articulation"].get("joint_couplings") or []except (ValueError, KeyError, TypeError):returnby_name = {jt["name"]: jt for jt in joints}unit = lambda jt: 180 / math.pi if jt["type"] == "hinge" else 1.0 # PhysX position -> viewer valueroot = stage.GetDefaultPrim()for c in couplings:src, dst = by_name.get(c.get("source_joint")), by_name.get(c.get("target_joint"))if c.get("runtime") == "physx_mimic" or not src or not dst or src is dst or "mimic" in dst:continueenabled = root.GetAttribute(c["enabled_attribute"]) if root and c.get("enabled_attribute") else Noneif enabled and enabled.Get() is False:continue(s0, s1), (t0, t1) = ([x * unit(jt) for x in c[k]] for jt, k in ((src, "source_range"), (dst, "target_range")))if s1 == s0:continuek = (t1 - t0) / (s1 - s0) # target = t0 + k * (source - s0) = -(gearing * source + offset)# significant figures, not decimals: a screw's metres per degree is ~1e-5dst["mimic"] = {"ref": src["name"], "gearing": float(f"{-k:.6g}"), "offset": float(f"{k * s0 - t0:.6g}") + 0.0,"one_way": True}def download(url, dest, tries=6):"""GET with an optional HF_TOKEN (higher rate limits) and backoff on 429/5xx."""headers = {"Authorization": f"Bearer {os.environ['HF_TOKEN']}"} if os.environ.get("HF_TOKEN") else {}39 unmodified linesdef rig_only(args, sha, assets):"""Rewrite previews/<asset>.json from the root USD layer and sidecar alone; report linked joints."""def work(a):try:with tempfile.TemporaryDirectory() as tmp:usd = os.path.join(tmp, f"{a}.usd")download(f"{HF}/datasets/{args.dataset}/resolve/{sha}/{a}/simready_usd/{a}.usd", usd)try: # the sidecar, for one-way couplings (older packages may not have one)download(f"{HF}/datasets/{args.dataset}/resolve/{sha}/{a}/simready_usd/{a}.json", usd[:-4] + ".json")except urllib.error.HTTPError as e:if e.code != 404:raisejoints = rig(usd)json.dump({"joints": joints}, open(os.path.join(args.out, f"{a}.json"), "w"), separators=(",", ":"))return a, sum("mimic" in j for j in joints), None
309 unmodified lines31031131231331431531658 unmodified lines37537637737837938038138238338438538638738838939010 unmodified lines4014024034044054064072 unmodified lines410411412413414415416417418419420421108 unmodified lines530531532533534535536309 unmodified linesconst HIGHLIGHT = new THREE.Color(0xf29b38);let hot = null;function highlight(r, on) {for (const g of r.linked || [r]) highlightOne(g, on);}function highlightOne(r, on) {for (const mesh of r.meshes) for (const m of [].concat(mesh.material)) {58 unmodified linesfunction setLook(l) { look = l || null; applyLook(); }const clean = (s) => String(s || "").replace(/[\s.:/[\]]/g, "");// Linked joints (PhysX mimic joints, e.g. a scissor or accordion linkage) follow a// reference joint: follower = -(gearing * reference + offset), as Isaac Sim applies it.// Moving any of them moves the reference, which places every joint linked to it.function place(r, v, depth = 0) {r.val = v;if (r.type === "hinge") r.group.quaternion.setFromAxisAngle(r.axis, THREE.MathUtils.degToRad(v));else r.group.position.copy(r.base).addScaledVector(r.axis, v);onJoint(r.index, v);settleDirty = true;if (depth < 8) for (const f of r.followers || []) place(f, -(f.mimic.gearing * v + f.mimic.offset), depth + 1);}// Objects stand on the floor the way a free-standing one would: when a moving part swings// below the base the object lifts, and when a low part folds up it settles back down, so10 unmodified linesmodel.updateMatrixWorld(true);}function setJoint(r, v) {for (let n = 0; r.mimic && n < 8; n++) { v = -(v + r.mimic.offset) / r.mimic.gearing; r = r.mimic.ref; }place(r, Math.min(r.hi, Math.max(r.lo, v)));}const leaders = () => rig.filter((r) => !r.mimic);2 unmodified linesfor (const j of joints) {const r = byName[j.name], ref = j.mimic && byName[j.mimic.ref];if (!r || !ref || ref === r || !j.mimic.gearing) continue;r.mimic = { ref, gearing: j.mimic.gearing, offset: j.mimic.offset || 0 };(ref.followers = ref.followers || []).push(r);}const top = (r, n = 0) => (r.mimic && n < 8 ? top(r.mimic.ref, n + 1) : r);for (const r of rig) {if (!r.mimic) continue;const t = top(r);t.linked = t.linked || [t];t.linked.push(r);108 unmodified linesstatus.hidden = true;toggle.hidden = !rig.length;return rig.map((r) => ({ name: r.name, type: r.type, lo: r.lo, hi: r.hi, free: r.free, val: r.val,follows: r.mimic ? r.mimic.ref.name : null }));}// Drag a part or its dot: hinges swing around their axis (following the pointer around309 unmodified lines31031131231331431531658 unmodified lines37537637737837938038138238338438538638738838939039139239339439539639710 unmodified lines4084094104114124134142 unmodified lines417418419420421422423424425426427428429430431432433434108 unmodified lines543544545546547548549309 unmodified linesconst HIGHLIGHT = new THREE.Color(0xf29b38);let hot = null;function highlight(r, on) {for (const g of r.linked || [r]) for (const x of [g, ...(g.drives || [])]) highlightOne(x, on);}function highlightOne(r, on) {for (const mesh of r.meshes) for (const m of [].concat(mesh.material)) {58 unmodified linesfunction setLook(l) { look = l || null; applyLook(); }const clean = (s) => String(s || "").replace(/[\s.:/[\]]/g, "");// Linked joints follow a reference joint: follower = -(gearing * reference + offset), as// Isaac Sim applies it. Two kinds:// - two-way (PhysX mimic joints, e.g. a scissor or accordion linkage): moving any of them// moves the reference, which places every joint linked to it;// - one-way (oneWay, the package's OmniGraph coupling, e.g. a pedal bin's lid): the// reference drives the follower within the follower's limits, and the follower can// still be moved on its own, as its compliant drive allows in Isaac.function place(r, v, depth = 0) {r.val = v;if (r.type === "hinge") r.group.quaternion.setFromAxisAngle(r.axis, THREE.MathUtils.degToRad(v));else r.group.position.copy(r.base).addScaledVector(r.axis, v);onJoint(r.index, v);settleDirty = true;if (depth < 8) for (const f of r.followers || []) {const x = -(f.mimic.gearing * v + f.mimic.offset);place(f, f.mimic.oneWay && !f.free ? Math.min(f.hi, Math.max(f.lo, x)) : x, depth + 1);}}// Objects stand on the floor the way a free-standing one would: when a moving part swings// below the base the object lifts, and when a low part folds up it settles back down, so10 unmodified linesmodel.updateMatrixWorld(true);}function setJoint(r, v) {for (let n = 0; r.mimic && !r.mimic.oneWay && n < 8; n++) { v = -(v + r.mimic.offset) / r.mimic.gearing; r = r.mimic.ref; }place(r, Math.min(r.hi, Math.max(r.lo, v)));}const leaders = () => rig.filter((r) => !r.mimic);2 unmodified linesfor (const j of joints) {const r = byName[j.name], ref = j.mimic && byName[j.mimic.ref];if (!r || !ref || ref === r || !j.mimic.gearing) continue;r.mimic = { ref, gearing: j.mimic.gearing, offset: j.mimic.offset || 0, oneWay: !!j.mimic.one_way };(ref.followers = ref.followers || []).push(r);}// a driver lights up the parts it drives one-way (and the parts those drive)const drives = (r, out, n = 0) => {for (const f of r.followers || []) if (f.mimic.oneWay && n < 8 && !out.includes(f)) { out.push(f); drives(f, out, n + 1); }return out;};for (const r of rig) r.drives = drives(r, []);const top = (r, n = 0) => (r.mimic && !r.mimic.oneWay && n < 8 ? top(r.mimic.ref, n + 1) : r);for (const r of rig) {if (!r.mimic || r.mimic.oneWay) continue;const t = top(r);t.linked = t.linked || [t];t.linked.push(r);108 unmodified linesstatus.hidden = true;toggle.hidden = !rig.length;return rig.map((r) => ({ name: r.name, type: r.type, lo: r.lo, hi: r.hi, free: r.free, val: r.val,follows: r.mimic ? r.mimic.ref.name : null, oneWay: !!(r.mimic && r.mimic.oneWay) }));}// Drag a part or its dot: hinges swing around their axis (following the pointer around
app.js+2-2
index.html+1-1
previews/bath_lift.json+1-1
previews/bolt_cutter.json+1-1
previews/folding_chair.json+1-1
previews/grabber_tool.json+1-1
previews/hand_crank_egg_beater.json+1-1
previews/hand_crank_ice_cream_maker.json+1-1
previews/hole_punch.json+1-1
previews/locking_pliers.json+1-1
previews/manual_book_press.json+1-1
previews/manual_can_crusher.json+1-1
previews/manual_die_cutting_machine.json+1-1
previews/nail_clipper.json+1-1
previews/pedal_trash_can.json+1-1
previews/pipe_wrench.json+1-1
previews/stapler.json+1-1
previews/tabletop_pinball_machine.json+1-1
previews/trash_bin_pedal_metal.json+1-1
previews/winged_corkscrew.json+1-1
previews/wringer_bucket.json+1-1
tools/make_previews.py+43-2
viewer.js+23-10