Skip to content

Commit 5d3113e

Browse files
[python] support opening stl files
1 parent c0a9f38 commit 5d3113e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.8.11
4+
5+
- Support opening stl, obj, gltf and step files
6+
37
## 2.8.10
48

59
- Support downloading stl, obj, gltf and step files

python/hal9/runtimes/threed.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,24 @@
55

66
def run(source_path: Path, port :str, params :str):
77
image_directory = source_path.parent
8-
image_name = source_path.name
8+
model_name = source_path.name
99

1010
html_content = f"""
1111
<html>
1212
<head>
1313
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/online-3d-viewer@0.15.0/build/engine/o3dv.min.js"></script>
1414
</head>
1515
<body>
16-
<a href="{image_name}">{image_name}</a>
17-
<div class="online_3d_viewer" style="width: 100%; height: 100%;" model="{image_name}"></div>
16+
<a id="open-link" href="{model_name}" target="_blank" rel="noopener noreferrer">Open {image_name}</a>
17+
<div class="online_3d_viewer" style="width: 100%; height: 100%;" model="{model_name}"></div>
1818
<script>window.addEventListener ('load', () => {{ OV.Init3DViewerElements (); }});</script>
19+
<script>
20+
document.addEventListener("DOMContentLoaded", function () {{
21+
const link = document.getElementById("open-link");
22+
const currentPageUrl = window.location.href + '/{model_name}';
23+
link.href = `https://3dviewer.net/#model=${{encodeURIComponent(currentPageUrl)}}`;
24+
}});
25+
</script>
1926
</body>
2027
</html>
2128
"""

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "hal9"
3-
version = "2.8.10"
3+
version = "2.8.11"
44
description = ""
55
authors = ["Javier Luraschi <javier@hal9.ai>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)