question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Looking for a simple example of a viewer with flags, e.g. 'wireframe'

See original GitHub issue

I’m a Python beginner and I run into problems understanding deep nestled import tree in trimesh. I’m trying to add some flags to the basic show() call. I would like to have wireframe, axis, etc., but I’m stuck at not finding proper names for classes and functions, e.g. trimesh.viewer.windowed.SceneViewer. This code snippet:

import trimesh, pyglet

mesh = trimesh.creation.cylinder(1, height=1)
scene = trimesh.Scene([mesh])
viewer = trimesh.viewer.windowed.SceneViewer(scene, flags='wireframe')
viewer.show()

fails with:

  File "/home/paul/upwork/pick/code/test-trimesh.py", line 5, in <module>
    viewer = trimesh.viewer.windowed.SceneViewer(scene, flags='wireframe')
AttributeError: module 'trimesh' has no attribute 'viewer'

How do I import trimesh.viewer.windowed.SceneViewer? Are there any examples? Is there an axis display flag?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mikedhcommented, Oct 1, 2021

Hey, the easiest way to do that is probably to pass the kwargs to the mesh.show or scene.show call, as the kwargs to those calls get passed through to SceneViewer.__init__:

In [1]: import trimesh

In [2]: from trimesh.viewer.windowed import SceneViewer

In [3]: m = trimesh.creation.box()

In [4]: m
Out[4]: <trimesh.Trimesh(vertices.shape=(8, 3), faces.shape=(12, 3))>

In [5]: m.show(flags={'wireframe': True})
Out[5]: SceneViewer(width=1800, height=1350)

In [6]: s = trimesh.Scene([m])

In [7]: s.show(flags={'wireframe': True})
Out[7]: SceneViewer(width=1800, height=1350)

0reactions
pauljurczakcommented, Oct 1, 2021

Thanks, it works. I found that show(flags={'wireframe': True, 'axis': True}) works too. I can’t find it in the documentation, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

15 Wireframe Examples and How to Make Your Own - Looka
Take a look at the examples below for inspiration! 1. Website wireframe sketch. hand drawn website wireframe example. Source: Earth Tribe ...
Read more >
Wireframes: A Great Way to Start Development Projects - InfoQ
Wireframes are simple block diagrams that show the placement of elements in a user interface and demonstrate the intended layout and ...
Read more >
001 View wireframe over a clip - Nuke Video Tutorial - LinkedIn
The procedure for viewing wireframe geometry over 2D images is demonstrated. This NUKE technique is important for checking the geometry lines up with...
Read more >
trimesh.viewer — trimesh 3.17.1 documentation
View meshes and scenes via pyglet or inline HTML. Create a window that will display a trimesh. Scene object in an OpenGL context...
Read more >
OpenGL Examples
Uses only the GL_POLYGON drawing mode. Illustrates glClear and glFlush . triangle.cpp. // A simple introductory program; its main ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found