8000 GitHub - meshcat-dev/meshcat-python: WebGL-based 3D visualizer for Python
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

meshcat-dev/meshcat-python

Repository files navigation

meshcat-python: Python Bindings to the MeshCat WebGL viewer

https://github.com/meshcat-dev/meshcat-python/workflows/CI/badge.svg?branch=master

MeshCat is a remotely-controllable 3D viewer, built on top of three.js. The viewer contains a tree of objects and transformations (i.e. a scene graph) and allows those objects and transformations to be added and manipulated with simple commands. This makes it easy to create 3D visualizations of geometries, mechanisms, and robots.

The MeshCat architecture is based on the model used by Jupyter:

  • The viewer itself runs entirely in the browser, with no external dependencies
  • The MeshCat server communicates with the viewer via WebSockets
  • Your code can use the meshcat python libraries or communicate directly with the server through its ZeroMQ socket.

Installation

The latest version of MeshCat requires Python 3.6 or above.

Using pip:

pip install meshcat

From source:

git clone https://github.com/meshcat-dev/meshcat-python
git submodule update --init --recursive
cd meshcat-python
python setup.py install

You will need the ZeroMQ libraries installed on your system:

Ubuntu/Debian:

apt install libzmq3-dev

Homebrew:

brew install zmq

Windows:

Download the official installer from zeromq.org.

Usage

For examples of interactive usage, see demo.ipynb

Under the Hood

Starting a Server

If you want to run your own meshcat server (for example, to communicate with the viewer over ZeroMQ from another language), all you need to do is run:

meshcat-server

The server will choose an available ZeroMQ URL and print that URL over stdout. If you want to specify a URL, just do:

meshcat-server --zmq-url=<your URL>

You can also instruct the server to open a browser window with:

meshcat-server --open

Protocol