Pushpak21 commited on
Commit
d73306a
·
verified ·
1 Parent(s): 84f8cf1

Delete static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +0 -83
static/index.html DELETED
@@ -1,83 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>DCM Assembly Visualizer</title>
6
- <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
7
- <style>
8
- body { font-family: sans-serif; padding: 20px; }
9
- #plot { width: 100%; height: 700px; }
10
- </style>
11
- </head>
12
- <body>
13
- <h1>DCM Assembly Visualizer</h1>
14
- <input type="file" id="file1" accept=".txt"> File A<br><br>
15
- <button onclick="uploadAndDraw()">Visualize</button>
16
- <div id="plot"></div>
17
-
18
- <script>
19
- async function uploadAndDraw() {
20
- const file = document.getElementById("file1").files[0];
21
- if (!file) {
22
- alert("Please upload a file.");
23
- return;
24
- }
25
-
26
- const formData = new FormData();
27
- formData.append("file", file);
28
-
29
- const res = await fetch("/parse", {
30
- method: "POST",
31
- body: formData
32
- });
33
-
34
- const data = await res.json();
35
- const traces = [];
36
-
37
- for (const [tag, g] of Object.entries(data.geometry)) {
38
- const [x, y, z] = g.base_point;
39
- const [nx, ny, nz] = g.normal;
40
-
41
- traces.push({
42
- type: 'scatter3d',
43
- mode: 'markers+text',
44
- x: [x], y: [y], z: [z],
45
- marker: { color: 'red', size: 5 },
46
- text: [g.label || tag],
47
- textposition: 'top center'
48
- });
49
-
50
- traces.push({
51
- type: 'scatter3d',
52
- mode: 'lines',
53
- x: [x, x + nx],
54
- y: [y, y + ny],
55
- z: [z, z + nz],
56
- line: { color: 'blue', width: 3 }
57
- });
58
- }
59
-
60
- for (const c of data.constraints) {
61
- const g1 = data.geometry[c.from];
62
- const g2 = data.geometry[c.to];
63
- if (g1 && g2) {
64
- const [x1, y1, z1] = g1.base_point;
65
- const [x2, y2, z2] = g2.base_point;
66
- traces.push({
67
- type: 'scatter3d',
68
- mode: 'lines',
69
- x: [x1, x2], y: [y1, y2], z: [z1, z2],
70
- line: { color: 'green', dash: 'dot', width: 2 }
71
- });
72
- }
73
- }
74
-
75
- Plotly.newPlot('plot', traces, {
76
- margin: { t: 30 },
77
- scene: { aspectmode: 'data' },
78
- title: '3D Assembly Viewer'
79
- });
80
- }
81
- </script>
82
- </body>
83
- </html>