Fix 3D model viewer to show when editing existing parts
- Add 3D model request when loading part from database - Add console logging for debugging model extraction - Request model for both manual footprint selection and auto-loaded parts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1288,6 +1288,7 @@
|
||||
});
|
||||
|
||||
// Request 3D model
|
||||
console.log('Requesting 3D model for:', footprintName, 'at', selectedFootprintLibraryPath);
|
||||
socket.emit('get_footprint_model', {
|
||||
library_path: selectedFootprintLibraryPath,
|
||||
footprint_name: footprintName
|
||||
@@ -1302,10 +1303,12 @@
|
||||
});
|
||||
|
||||
socket.on('model_result', (data) => {
|
||||
console.log('Received model_result:', data);
|
||||
const container = document.getElementById('modelViewerContainer');
|
||||
const messageEl = document.getElementById('modelViewerMessage');
|
||||
|
||||
if (data.has_model) {
|
||||
console.log('Model found, displaying viewer');
|
||||
container.style.display = 'block';
|
||||
messageEl.innerHTML = `<strong>3D Model Found:</strong> ${data.name}<br><br>` +
|
||||
`<em>Note: STEP file viewing in browser requires conversion to STL/OBJ format.<br>` +
|
||||
@@ -1313,6 +1316,7 @@
|
||||
`<a href="data:application/stp;base64,${data.data}" download="${data.name}" ` +
|
||||
`style="color: #007bff; text-decoration: underline; cursor: pointer;">Download ${data.name}</a>`;
|
||||
} else {
|
||||
console.log('No model found');
|
||||
container.style.display = 'none';
|
||||
}
|
||||
});
|
||||
@@ -1498,6 +1502,9 @@
|
||||
setTimeout(() => {
|
||||
footprintSelect.value = footprintName;
|
||||
socket.emit('render_footprint', { library_path: lib.path, footprint_name: footprintName });
|
||||
// Also request 3D model
|
||||
console.log('Requesting 3D model for loaded part:', footprintName, 'at', lib.path);
|
||||
socket.emit('get_footprint_model', { library_path: lib.path, footprint_name: footprintName });
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user