diff --git a/README.md b/README.md
index 95532fb..c9e8c22 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,8 @@ display(HTML('index.html'))
- [x] guide for notebook
- [x] pypi doc add image
- [x] edit html positions and other 3D params
+- [x] add param for streamlit
+- [ ] document param for streamlit
- [ ] dist wheel
- [ ] load three.js as static file
- [ ] .mat files support
diff --git a/obj2html/elements.html b/obj2html/elements.html
new file mode 100644
index 0000000..a2794bc
--- /dev/null
+++ b/obj2html/elements.html
@@ -0,0 +1,79 @@
+
+
\ No newline at end of file
diff --git a/obj2html/obj2html.py b/obj2html/obj2html.py
index 2125931..696786d 100644
--- a/obj2html/obj2html.py
+++ b/obj2html/obj2html.py
@@ -4,13 +4,15 @@ import re
import copy
TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'index.html')
+TEMPLATE_ELEMENTS_ONLYT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'elements.html')
+
def simple_mustache(input_string, value_dict):
output_string = copy.deepcopy(input_string)
mustache_variables = re.findall(r"{{.*?}}",output_string)
for v_text in mustache_variables:
- v_name = v_text[2:-2]
+ v_name = v_text[2:-2].strip()
if '.' in v_name:
dict_name, dict_subname = v_name.split(".")
v = value_dict[dict_name][dict_subname]
@@ -47,7 +49,8 @@ def obj2html(
"scale_x": 30,
"scale_y": 30,
"scale_z": 30,
- }
+ },
+ html_elements_only=False
):
with open(obj_path, "r") as f:
content = f.readlines()
@@ -55,7 +58,10 @@ def obj2html(
js_cont = {'obj': content}
js_string = json.dumps(js_cont)
- with open(TEMPLATE_PATH, "r") as f:
+ template_path = TEMPLATE_PATH
+ if html_elements_only:
+ template_path = TEMPLATE_ELEMENTS_ONLYT_PATH
+ with open(template_path, "r") as f:
html_template = f.read()
data_dict = {
@@ -74,4 +80,4 @@ def obj2html(
return html_string
if __name__ == '__main__':
- obj2html('test/assets/model.obj', 'tmp.html')
\ No newline at end of file
+ obj2html('model.obj', 'tmp.html', html_elements_only=True)
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 13e50a7..4360ba4 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pipy_readme.
setup(
name = 'obj2html',
packages = ['obj2html'],
- version = '0.12',
+ version = '0.13',
license='MIT',
description = 'Create an html with three.js that contains the given .obj file.',
long_description = long_des,