Skip to main content

obj2html lib

You can use that lib to create html file from a .obj path:

from obj2html import obj2html
obj2html('model.obj', 'index.html')
# firefox index.html
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
obj2html('model.obj', 'index.html')
display(HTML('index.html'))

Use in streamlit app to display a .obj 3D file and create download button:

import streamlit as st
import streamlit.components.v1 as components
from obj2html import obj2html

html_string = obj2html("model.obj", html_elements_only=True)
components.html(html_string)
with open("model.obj") as f:
  st.download_button('Download model.obj', f, file_name="download_name.obj")
Streamlit example

It is also possible to set the scale factor, light and camera options:

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)

Metadata

Release files for obj2html 0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obj2html 0.14
File Size Uploaded Provenance Actions
obj2html-0.14.tar.gz 3.7 kB Without provenance Details for obj2html-0.14.tar.gz

Release files / obj2html-0.14.tar.gz

Download URL obj2html-0.14.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3a675e1c3e14025147425322d7a90758304c549bfd302dae05bde799c42d77a2
BLAKE2b-256 checksum
How to use checksums
96df1000cca188cd81bc00186f1b89b89791d8a36120e23eb006247a377d99bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Security for obj2html 0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page