Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>Autonomous ZTR Retrofit — 3D Viewer</title>
<style>
:root{--bg:#0e1116;--panel:#161b22;--line:#283139;--ink:#e8edf2;--mut:#94a3b1;--acc:#36c08a}
*{box-sizing:border-box} html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);
font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;overflow:hidden}
#app{display:flex;height:100%}
#side{width:280px;flex:0 0 280px;background:var(--panel);border-right:1px solid var(--line);
padding:16px;overflow:auto}
#stage{flex:1;position:relative}
h1{font-size:15px;margin:0 0 2px} .sub{color:var(--mut);font-size:12px;margin-bottom:14px}
.grp{font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--mut);margin:16px 0 6px}
button.part{display:block;width:100%;text-align:left;background:#1c232c;color:var(--ink);
border:1px solid var(--line);border-radius:8px;padding:8px 10px;margin:4px 0;cursor:pointer;font-size:12.5px}
button.part:hover{border-color:var(--acc)} button.part.active{border-color:var(--acc);background:#13241d}
#hud{position:absolute;left:14px;bottom:12px;color:var(--mut);font-size:12px;
background:#0e1116cc;border:1px solid var(--line);border-radius:8px;padding:8px 12px}
#dim{position:absolute;right:14px;top:12px;color:var(--ink);font-size:12px;
background:#0e1116cc;border:1px solid var(--line);border-radius:8px;padding:8px 12px}
.err{color:#f0b9b1;font-size:12px;margin-top:10px}
a{color:var(--acc)}
</style>
</head>
<body>
<div id="app">
<div id="side">
<h1>Autonomous ZTR Retrofit</h1>
<div class="sub">drag to orbit · scroll to zoom · right-drag to pan</div>
<button class="part active" data-f="../cad/stl/assembly.stl" data-s="1">▣ Full machine assembly</button>
<div class="grp">Printed parts</div>
<div id="parts"></div>
<div class="err" id="err"></div>
<div class="sub" style="margin-top:16px">Served from a local web server. Colour is uniform in STL — see <code>cad/renders/</code> for coloured shots.</div>
</div>
<div id="stage">
<div id="dim">—</div>
<div id="hud">loading…</div>
</div>
</div>
<script type="importmap">
{ "imports": {
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
}}
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { STLLoader } from 'three/addons/loaders/STLLoader.js';
const PARTS = [
["enclosure", ["PRINT_equipment_plate","PRINT_upper_shelf","PRINT_box_foot"]],
["actuator brackets", ["PRINT_lapbar_yoke_bottom","PRINT_lapbar_yoke_top","PRINT_rail_anchor_bottom","PRINT_rail_anchor_top"]],
["gps mast", ["PRINT_gps_clamp_a","PRINT_gps_clamp_b","PRINT_gps_top_plate"]],
["lidar mount", ["PRINT_lidar_base_a","PRINT_lidar_base_b","PRINT_lidar_mast_lower","PRINT_lidar_mast_upper","PRINT_lidar_top_plate"]],
["camera mount", ["PRINT_camera_cradle","PRINT_camera_base"]],
["controls / safety", ["PRINT_estop_pedestal_a","PRINT_estop_pedestal_b","PRINT_estop_face","PRINT_relay_box","PRINT_relay_lid","PRINT_throttle_servo_bracket","PRINT_badge"]],
["attachments", ["PRINT_boom_base_plate","PRINT_blower_cradle_top","PRINT_blower_cradle_bottom","PRINT_trimmer_motor_plate","PRINT_duct_adapter","PRINT_dump_clevis","PRINT_tpms_cradle","PRINT_sprayer_ctrl_mount"]],
["overhead sonar", ["PRINT_sonar_collar_a","PRINT_sonar_collar_b"]],
["touchscreen hood", ["PRINT_display_hood_l","PRINT_display_hood_r","PRINT_display_brace","PRINT_display_yoke"]],
["dual-RTK baseline", ["PRINT_baseline_tee","PRINT_baseline_ant_plate"]],
];
const stage=document.getElementById('stage'), hud=document.getElementById('hud'), dim=document.getElementById('dim');
const renderer=new THREE.WebGLRenderer({antialias:true});
renderer.setPixelRatio(devicePixelRatio); renderer.setSize(stage.clientWidth,stage.clientHeight);
stage.appendChild(renderer.domElement);
const scene=new THREE.Scene(); scene.background=new THREE.Color(0x0e1116);
const cam=new THREE.PerspectiveCamera(45,stage.clientWidth/stage.clientHeight,0.1,100000);
const ctrl=new OrbitControls(cam,renderer.domElement); ctrl.enableDamping=true;
scene.add(new THREE.HemisphereLight(0xbfd4ff,0x202020,1.1));
const key=new THREE.DirectionalLight(0xffffff,1.4); key.position.set(1,2,1.5); scene.add(key);
const fill=new THREE.DirectionalLight(0xffffff,.5); fill.position.set(-1.5,1,-1); scene.add(fill);
const grid=new THREE.GridHelper(2000,40,0x2a3440,0x1b2026); scene.add(grid);
const loader=new STLLoader(); const mat=new THREE.MeshStandardMaterial({color:0x3a8ddb,metalness:.15,roughness:.6});
let mesh=null;
function frame(geo){
geo.computeBoundingBox(); const b=geo.boundingBox, sz=new THREE.Vector3(); b.getSize(sz);
const c=new THREE.Vector3(); b.getCenter(c);
dim.textContent=`${sz.x.toFixed(1)} × ${sz.y.toFixed(1)} × ${sz.z.toFixed(1)} mm`;
const r=Math.max(sz.x,sz.y,sz.z); cam.position.set(c.x+r*1.3,c.y-r*1.6,c.z+r*1.1);
ctrl.target.copy(c); grid.position.set(c.x,c.y,b.min.z); cam.near=r/100; cam.far=r*100; cam.updateProjectionMatrix();
}
function load(file){
hud.textContent='loading '+file.split('/').pop()+' …'; document.getElementById('err').textContent='';
loader.load(file,(geo)=>{
if(mesh) scene.remove(mesh);
mesh=new THREE.Mesh(geo,mat); scene.add(mesh); frame(geo);
hud.textContent=file.split('/').pop();
},undefined,(e)=>{ hud.textContent='—';
document.getElementById('err').innerHTML='Could not load <code>'+file+'</code>.<br>Run a local server in the project root:<br><code>python3 -m http.server 8765</code><br>then open <a href="http://localhost:8765/viewer/">localhost:8765/viewer/</a>';
});
}
// build sidebar
const pc=document.getElementById('parts');
for(const [grp,mods] of PARTS){
const h=document.createElement('div'); h.className='grp'; h.textContent=grp; pc.appendChild(h);
for(const m of mods){ const b=document.createElement('button'); b.className='part';
b.textContent=m.replace(/^PRINT_/,''); b.dataset.f=`../cad/stl/${m}.stl`; pc.appendChild(b); }
}
document.querySelectorAll('button.part, button[data-f]').forEach(b=>b.addEventListener('click',()=>{
document.querySelectorAll('[data-f]').forEach(x=>x.classList.remove('active'));
b.classList.add('active'); load(b.dataset.f);
}));
addEventListener('resize',()=>{cam.aspect=stage.clientWidth/stage.clientHeight;cam.updateProjectionMatrix();
renderer.setSize(stage.clientWidth,stage.clientHeight);});
(function loop(){requestAnimationFrame(loop);ctrl.update();renderer.render(scene,cam);})();
load('../cad/stl/assembly.stl');
</script>
</body>
</html>
b1b1ea139This file is pinned to the selected release. Download the original to open it in your design tool.