2021-11-13 15:18:04 +01:00
|
|
|
[](https://gitlab.com/nicolalandro/obj2html/-/commits/main)
|
2021-11-13 15:04:00 +01:00
|
|
|
[](https://gitlab.com/nicolalandro/obj2html/-/commits/main)
|
|
|
|
|
2021-11-13 14:26:55 +01:00
|
|
|
# Obj2Html
|
|
|
|
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.
|
|
|
|
|
2021-11-14 15:41:53 +01:00
|
|
|
Install with `pip install obj2html` and use with `obj2html('model.obj', 'index.html')`
|
|
|
|
|
2021-11-13 16:15:35 +01:00
|
|
|

|
|
|
|
|
2021-11-13 14:55:57 +01:00
|
|
|
* run into jupyter notebook
|
|
|
|
```
|
2021-11-13 16:15:35 +01:00
|
|
|
! pip install obj2html
|
|
|
|
! wget https://gitlab.com/nicolalandro/obj2html/-/raw/main/test/assets/model.obj
|
2021-11-13 14:55:57 +01:00
|
|
|
from obj2html import obj2html
|
|
|
|
from IPython.display import display, HTML
|
|
|
|
|
2021-11-14 15:41:53 +01:00
|
|
|
obj2html('model.obj', 'index.html')
|
2021-11-13 14:55:57 +01:00
|
|
|
|
|
|
|
display(HTML('index.html'))
|
|
|
|
```
|
|
|
|
|
2021-11-13 14:26:55 +01:00
|
|
|
## Features
|
2021-11-13 14:57:56 +01:00
|
|
|
|
2021-11-13 15:00:47 +01:00
|
|
|
- [x] .obj files support
|
2021-11-13 16:28:57 +01:00
|
|
|
- [x] pipy delivery
|
|
|
|
- [x] guide for notebook
|
|
|
|
- [x] pypi doc add image
|
2021-11-14 15:41:53 +01:00
|
|
|
- [x] edit html positions and other 3D params
|
2021-11-13 16:28:57 +01:00
|
|
|
- [ ] dist wheel
|
2021-11-13 14:57:56 +01:00
|
|
|
- [ ] load three.js as static file
|
|
|
|
- [ ] .mat files support
|
2021-11-13 14:26:55 +01:00
|
|
|
|
2021-11-13 14:55:57 +01:00
|
|
|
# Dev
|
2021-11-13 15:33:54 +01:00
|
|
|
|
|
|
|
* run test
|
2021-11-13 14:55:57 +01:00
|
|
|
```
|
|
|
|
python3.8 -m unittest discover
|
2021-11-13 15:33:54 +01:00
|
|
|
```
|
|
|
|
* run test with coverage
|
|
|
|
```
|
2021-11-13 14:55:57 +01:00
|
|
|
pip install coverage
|
|
|
|
python3.8 -m coverage run --source=src -m unittest discover
|
|
|
|
python3.8 -m coverage report -m
|
|
|
|
```
|
2021-11-13 15:33:54 +01:00
|
|
|
* deploy pipy
|
|
|
|
```
|
2021-11-13 16:28:57 +01:00
|
|
|
pip install twine
|
2021-11-13 16:04:16 +01:00
|
|
|
|
|
|
|
rm -rf dist
|
|
|
|
|
2021-11-13 15:33:54 +01:00
|
|
|
python setup.py sdist
|
2021-11-13 16:04:16 +01:00
|
|
|
twine check dist/*
|
|
|
|
|
2021-11-13 15:33:54 +01:00
|
|
|
twine upload dist/*
|
2021-11-13 16:28:57 +01:00
|
|
|
|
|
|
|
# in one line
|
2021-11-13 15:33:54 +01:00
|
|
|
```
|
2021-11-13 14:55:57 +01:00
|
|
|
|
2021-11-13 14:26:55 +01:00
|
|
|
# References
|
|
|
|
In this chapter I add at least a link for each of the knowledge needed for develop this project.
|
|
|
|
* python
|
|
|
|
* git
|
2021-11-13 15:18:04 +01:00
|
|
|
* [how to write a setup.py](https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56)
|
2021-11-13 14:26:55 +01:00
|
|
|
* python test
|
|
|
|
* coverage
|
|
|
|
* gitlab ci/cd
|
|
|
|
* three.js
|
2021-11-14 09:12:37 +01:00
|
|
|
* [pymustache](https://github.com/lotabout/pymustache): for using html template, but in the end I use replace with similar sintax
|