Skip to content

Instantly share code, notes, and snippets.

@mikedh
Created March 6, 2026 20:34
Show Gist options
  • Select an option

  • Save mikedh/5556f79dec9ca0d01b6216cf198c96a7 to your computer and use it in GitHub Desktop.

Select an option

Save mikedh/5556f79dec9ca0d01b6216cf198c96a7 to your computer and use it in GitHub Desktop.
mikedh@europa:example$ uv add trimesh "pyglet<2" "cascadio>=0.0.18rc5"
Resolved 5 packages in 0.51ms
Audited 4 packages in 0.04ms
mikedh@europa:example$ uv run python
Python 3.14.0 (main, Nov 19 2025, 22:48:15) [Clang 21.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import trimesh, cascadio
>>> with open('featuretype.STEP', 'rb') as f: glb = cascadio.to_glb_bytes(f.read(), include_brep=True)
>>> mesh = trimesh.load_mesh(trimesh.util.wrap_as_stream(glb), file_type='glb')
>>> mesh.visual = trimesh.visual.ColorVisuals()
>>> mesh.face_attributes
{'brep_index': array([ 0, 0, 0, ..., 94, 95, 95], shape=(8326,), dtype=uint32)}
>>> for i in range(mesh.face_attributes['brep_index'].max()):
mesh.visual.face_colors[mesh.face_attributes['brep_index'] == i] = trimesh.visual.random_color()
>>> mesh.show(smooth=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment