Attach machine preview path to rotary cradle

This commit is contained in:
2026-09-11 15:17:03 +08:00
parent d7c8b514fc
commit 9232f29027
4 changed files with 14 additions and 5 deletions

View File

@@ -131,8 +131,11 @@ export function XyzacMachineView({ visual, toolpath, view = "p", zoom = 1, rotat
},
};
const pathGroup = new THREE.Group(); pathGroup.name = "xyzac-toolpath"; scene.add(pathGroup);
const liveGroup = new THREE.Group(); liveGroup.name = "xyzac-live-toolpath"; scene.add(liveGroup);
// The programmed path represents the part fixed on the rotary cradle.
// Keep it in the table's local frame so A/B tilt and C rotation carry the
// workpiece path together with the physical table.
const pathGroup = new THREE.Group(); pathGroup.name = "xyzac-toolpath"; assembly.joints.rotate.add(pathGroup);
const liveGroup = new THREE.Group(); liveGroup.name = "xyzac-live-toolpath"; assembly.joints.rotate.add(liveGroup);
const pathMaterials = [0xdce7e8, 0xff9a55, 0x5c9d9a].map((color) => new THREE.LineBasicMaterial({ color }));
const clearLines = (group: THREE.Group) => { group.children.forEach((child) => (child as THREE.Line).geometry.dispose()); group.clear(); };
const limits = new THREE.Box3Helper(new THREE.Box3(), 0xdd7566); scene.add(limits);
@@ -166,6 +169,8 @@ export function XyzacMachineView({ visual, toolpath, view = "p", zoom = 1, rotat
if (preset !== lastPreset) { presetCamera(); lastPreset = preset; }
controls.update(); renderer.render(scene, camera);
element.dataset.xyzacRenderedTick = String(state.tick);
element.dataset.xyzacToolpathFrame = assembly.joints.rotate.name;
element.dataset.xyzacToolpathAttached = String(pathGroup.parent === assembly.joints.rotate && liveGroup.parent === assembly.joints.rotate);
element.dataset.xyzacToolTip = JSON.stringify(assembly.toolTip.getWorldPosition(new THREE.Vector3()).toArray());
frame = requestAnimationFrame(render);
};