meshcat-shapes

raw JSON →
1.0.0 verified Mon Apr 27 auth: no python

Useful shapes to decorate MeshCat scenes. Current version 1.0.0, stable. Release cadence is irregular.

pip install meshcat-shapes
error ModuleNotFoundError: No module named 'meshcat.shapes'
cause Incorrect import path; meshcat-shapes is a separate package.
fix
Install with 'pip install meshcat-shapes' and import as 'import meshcat_shapes'.
error AttributeError: module 'meshcat_shapes' has no attribute 'frame'
cause The 'frame' function might have been removed or renamed in an older version. Ensure you have the latest version (v1.0.0) installed.
fix
Upgrade: 'pip install --upgrade meshcat-shapes' and check 'from meshcat_shapes import frame'.
error TypeError: textarea() got an unexpected keyword argument 'fontsize'
cause The 'textarea' function does not accept a 'fontsize' parameter; only 'width' and 'height' control size.
fix
Remove 'fontsize'. Use 'width' and 'height' to adjust the text area dimensions.
error ValueError: Radius must be positive
cause Calling 'point()' with radius <= 0.
fix
Provide a positive radius value (e.g., radius=0.05).
breaking In v1.0.0, the minimum Python version was bumped to 3.9. Older Python versions (3.7, 3.8) are no longer supported.
fix Upgrade Python to 3.9 or later.
deprecated The package name was previously part of the meshcat namespace. Ensure you import 'meshcat_shapes', not 'meshcat.shapes'.
fix Use 'import meshcat_shapes' or 'from meshcat_shapes import ...'.
gotcha The 'textarea' shape requires the 'meshcat' visualizer to be open and supports only basic ASCII text (no Unicode).
fix Use ASCII characters only for text content.
gotcha All shapes must be added before the visualizer is closed or the scene is finalized. Adding after closing may not render.
fix Add all shapes before calling vis.close() or similar finalization.

Creates a MeshCat visualizer and adds a frame, a point, and a text area.

import meshcat
import meshcat_shapes

vis = meshcat.Visualizer()
vis.open()

# Draw a 3-axis frame at origin
meshcat_shapes.frame(vis, "world/frame", opacity=1.0)

# Draw a point
meshcat_shapes.point(vis, "world/point", radius=0.05, color=0xff0000)

# Draw a text area
meshcat_shapes.textarea(vis, "world/text", "Hello, MeshCat!", width=0.5, height=0.2)