Skip to main content

Wavefront OBJ importer for the plotly Dash framework

Dash is a Python framework for building analytical web applications. This library helps you to get 3D ObJ into the framework's 3dmesh graph type

Source is here:

https://github.com/aegis1980/dash-obj-in-3dmesh.git

Also on pypi, installed using:

pip install dash-obj-in-3dmesh

Some notes:

File locations

Put your wavefront obj & mtl file in 'data/obj' directory in the root directory of your Dash app. Alternatively pass a path to:

import_geometry(obj_names : List[str], path = _config.GEOMETRY_DIR)

Geometry

  • v4.0 Added support importing OBJ files with quads. Dash graph.Mesh3d can only display triangulated meshes. Imported quad are split in mesh_tools.split_quad() into two tris with the fold line on the quad diagonal which produces the least curvature (i.e. the widest angle between the tri normals)
  • Textures, normals and everything else are ignored - only vertices, faces, materials, groups and object names are parsed and passed to Dash graph as mesh data.
  • ...so to speeden things up strip all that data out of your files pre-deployment

Materials

obj file can have an accompanying materials file, but only basic materials supported in mtl file: e.g:

newmtl diffuse_Green
Ka 0.0000 0.0000 0.0000
Kd 0.0000 1.0000 0.0000
Ks 1.0000 1.0000 1.0000
Tf 0.0000 0.0000 0.0000
d 1.0000
Ns 0.0000

Only the value for Kd is used - so set this as your colour (in modelling software).

Code example

import dash
import dash_obj_in_3dmesh


model_name = "test" #.obj & .mtl files in data/obj

axis_template = {
    "showbackground": False,
    "visible" : False
}

plot_layout = {
    "title": "",
    "margin": {"t": 0, "b": 0, "l": 0, "r": 0},
    "font": {"size": 12, "color": "white"},
    "showlegend": False,
    'uirevision':'same_all_the_time', #this keeps camera position etc the same when data changes.
    "scene": {
        "xaxis": axis_template,
        "yaxis": axis_template,
        "zaxis": axis_template,
        "aspectmode" : "data",
        "camera": {"eye": {"x": 1.25, "y": 1.25, "z": 1.25}},
        "annotations": [],
    },
}

def layout():
 return html.Div([dcc.Graph(
          id="graph",
          figure={
              "data": geometry_tools.import_geometry([model_name]),
              "layout": plot_layout,
          },
          config={"scrollZoom": True}, # activates wheel thingy on mouse to zoom and wotnot
      )])

app = Dash()
app.layout = layout

app.run_server()

Metadata

Release files for dash-obj-in-3dmesh 0.4.0

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

Source distribution (sdist)

Source distribution for dash-obj-in-3dmesh 0.4.0
File Size Uploaded Provenance Actions
dash-obj-in-3dmesh-0.4.0.tar.gz 13.5 kB Without provenance Details for dash-obj-in-3dmesh-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dash-obj-in-3dmesh 0.4.0
File Interpreter ABI Platform Actions
dash_obj_in_3dmesh-0.4.0-py3-none-any.whl Python 3 none any Details for dash_obj_in_3dmesh-0.4.0-py3-none-any.whl

Total release size: 27.5 kB

Release files / dash-obj-in-3dmesh-0.4.0.tar.gz

Download URL dash-obj-in-3dmesh-0.4.0.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6343e490c2ec08220d194347784a1eed01539318c94ce91373cebde9bc97506e
BLAKE2b-256 checksum
How to use checksums
725bd822ff4d74d467815c95ce37e5974860071e145d5a03279d200a3ca3bf06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release files / dash_obj_in_3dmesh-0.4.0-py3-none-any.whl

Download URL dash_obj_in_3dmesh-0.4.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d9db77ee549f08b951d9eb92f96b25ef80ecc38387aa34f093125bf0289358b
BLAKE2b-256 checksum
How to use checksums
7037f060ef22bd43ce27b6296dc20c51b84b77c3d95ece5a2a302a13853704f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Security for dash-obj-in-3dmesh 0.4.0

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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files No provenance

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