new dist
This commit is contained in:
parent
e7b2cde1fe
commit
e3630f8e4d
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@ MANIFEST
|
|||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
tmp.html
|
tmp.html
|
||||||
|
.vscode
|
@ -5,6 +5,8 @@
|
|||||||
This lib is able to transform an .obj file to HTML that use three.js.
|
This lib is able to transform an .obj file to HTML that use three.js.
|
||||||
In this way it is possible to have an interactive 3D view that can be used on the browser or into a jupyter notebook.
|
In this way it is possible to have an interactive 3D view that can be used on the browser or into a jupyter notebook.
|
||||||
|
|
||||||
|
Install with `pip install obj2html` and use with `obj2html('model.obj', 'index.html')`
|
||||||
|
|
||||||
![](imgs/colab_sample.png)
|
![](imgs/colab_sample.png)
|
||||||
|
|
||||||
* run into jupyter notebook
|
* run into jupyter notebook
|
||||||
@ -14,8 +16,7 @@ In this way it is possible to have an interactive 3D view that can be used on th
|
|||||||
from obj2html import obj2html
|
from obj2html import obj2html
|
||||||
from IPython.display import display, HTML
|
from IPython.display import display, HTML
|
||||||
|
|
||||||
obj_path = 'model.obj'
|
obj2html('model.obj', 'index.html')
|
||||||
obj2html(obj_path, 'index.html')
|
|
||||||
|
|
||||||
display(HTML('index.html'))
|
display(HTML('index.html'))
|
||||||
```
|
```
|
||||||
@ -26,8 +27,8 @@ display(HTML('index.html'))
|
|||||||
- [x] pipy delivery
|
- [x] pipy delivery
|
||||||
- [x] guide for notebook
|
- [x] guide for notebook
|
||||||
- [x] pypi doc add image
|
- [x] pypi doc add image
|
||||||
|
- [x] edit html positions and other 3D params
|
||||||
- [ ] dist wheel
|
- [ ] dist wheel
|
||||||
- [ ] edit html positions and other 3D params
|
|
||||||
- [ ] load three.js as static file
|
- [ ] load three.js as static file
|
||||||
- [ ] .mat files support
|
- [ ] .mat files support
|
||||||
|
|
||||||
|
58
pipy_readme.rst
Normal file
58
pipy_readme.rst
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
obj2html lib
|
||||||
|
=============================
|
||||||
|
|
||||||
|
You can use that lib to create html file from a .obj path:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from obj2html import obj2html
|
||||||
|
obj2html('model.obj', 'index.html')
|
||||||
|
# firefox index.html
|
||||||
|
|
||||||
|
|
||||||
|
.. image:: https://gitlab.com/nicolalandro/obj2html/-/raw/main/imgs/colab_sample.png
|
||||||
|
:alt: Colab example
|
||||||
|
|
||||||
|
Use in a Jupyter notebook to display a .obj 3D file:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
! pip install obj2html
|
||||||
|
! wget https://gitlab.com/nicolalandro/obj2html/-/raw/main/test/assets/model.obj
|
||||||
|
from obj2html import obj2html
|
||||||
|
from IPython.display import display, HTML
|
||||||
|
obj2html('model.obj', 'index.html')
|
||||||
|
display(HTML('index.html'))
|
||||||
|
|
||||||
|
It is also possible to set the scale factor, light and camera options:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
camera={
|
||||||
|
"fov": 45,
|
||||||
|
"aspect": 2,
|
||||||
|
"near": 0.1,
|
||||||
|
"far": 100,
|
||||||
|
"pos_x": 0,
|
||||||
|
"pos_y": 10,
|
||||||
|
"pos_z": 20,
|
||||||
|
"orbit_x": 0,
|
||||||
|
"orbit_y": 5,
|
||||||
|
"orbit_z": 0,
|
||||||
|
},
|
||||||
|
light={
|
||||||
|
"color": "0xFFFFFF",
|
||||||
|
"intensity": 1,
|
||||||
|
"pos_x": 0,
|
||||||
|
"pos_y": 10,
|
||||||
|
"pos_z": 0,
|
||||||
|
"target_x": -5,
|
||||||
|
"target_y": 0,
|
||||||
|
"target_z": 0,
|
||||||
|
},
|
||||||
|
obj_options={
|
||||||
|
"scale_x": 30,
|
||||||
|
"scale_y": 30,
|
||||||
|
"scale_z": 30,
|
||||||
|
}
|
||||||
|
obj2html('model.obj', 'index.html', camera, light, obj_options)
|
37
setup.py
37
setup.py
@ -1,43 +1,12 @@
|
|||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
long_des = """obj2html lib
|
with open('pipy_readme.rst', 'r') as f:
|
||||||
=============================
|
long_des = f.read()
|
||||||
|
|
||||||
You can use that lib to create html file from a .obj path:
|
|
||||||
|
|
||||||
from obj2html import obj2html
|
|
||||||
|
|
||||||
html_string = obj2html(obj_path)
|
|
||||||
|
|
||||||
obj2html(obj_path, 'index.html')
|
|
||||||
|
|
||||||
# firefox index.html
|
|
||||||
|
|
||||||
.. image:: https://gitlab.com/nicolalandro/obj2html/-/raw/main/imgs/colab_sample.png
|
|
||||||
:alt: Colab example
|
|
||||||
|
|
||||||
Use in a Jupyter notebook to display a .obj 3D file:
|
|
||||||
|
|
||||||
! pip install obj2html
|
|
||||||
|
|
||||||
! wget https://gitlab.com/nicolalandro/obj2html/-/raw/main/test/assets/model.obj
|
|
||||||
|
|
||||||
from obj2html import obj2html
|
|
||||||
|
|
||||||
from IPython.display import display, HTML
|
|
||||||
|
|
||||||
obj_path = 'model.obj'
|
|
||||||
|
|
||||||
obj2html(obj_path, 'index.html')
|
|
||||||
|
|
||||||
display(HTML('index.html'))
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'obj2html',
|
name = 'obj2html',
|
||||||
packages = ['obj2html'],
|
packages = ['obj2html'],
|
||||||
version = '0.5',
|
version = '0.6',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
description = 'Create an html with three.js that contains the given .obj file.',
|
description = 'Create an html with three.js that contains the given .obj file.',
|
||||||
long_description = long_des,
|
long_description = long_des,
|
||||||
|
Loading…
Reference in New Issue
Block a user