-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscale_test.html
More file actions
63 lines (52 loc) · 2.35 KB
/
scale_test.html
File metadata and controls
63 lines (52 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Simple Scale Test</title>
</head>
<body>
<pre id="log">Starting...</pre>
<script type="module">
const stlOptions = { tolerance: 0.001, angularTolerance: 0.1, binary: true };
function log(msg) {
document.getElementById('log').textContent += '\n' + msg;
console.log(msg);
}
async function runTest() {
try {
const replicad = await import('/node_modules/replicad/dist/replicad.js');
const opencascade = await import('/node_modules/replicad-opencascadejs/src/replicad_single.js');
const oc = await opencascade.default({
locateFile: (file) => `/node_modules/replicad-opencascadejs/src/${file}`
});
replicad.setOC(oc);
log('OpenCASCADE loaded');
const { ReplicadBuilder } = await import('/src/index.js');
log('Builder loaded');
const builder = new ReplicadBuilder(replicad);
// Load simple test data
const response = await fetch('/testData/concentric_rectangular_column_one_turn.json');
const masData = await response.json();
log('Building geometry...');
const shape = builder.getMagnetic(masData.magnetic, 'test');
log('Shape built');
// Geometry is now returned in mm (no scaling needed)
log('Generating STL...');
const stl = shape.blobSTL(stlOptions);
log('STL size: ' + stl.size + ' bytes');
// Store for puppeteer to collect
window.stlFiles = [{ filename: 'scale_test.stl', blob: stl }];
window.testsDone = true;
window.allTestsPassed = true;
log('✓ Test complete!');
} catch (err) {
log('Error: ' + err.message);
log(err.stack);
window.testsDone = true;
window.allTestsPassed = false;
}
}
runTest();
</script>
</body>
</html>