Before you run any of these programs, always make sure you have the
right environment variables:
cd <viz directory>/src
source vizsource
Base Application
Viz shell
Viz relay
In addition to these clients, you can develop your own clients using the Viz Python or C++ API.
The following classes are available:
Class | Function |
Load model | Load a file, a series of selected files, or directories recursively. |
Add object | Add/remove simple geometries |
Change viewer | Change the viewers number or type. |
Example: Add an object and change its color to red:
Python Viz> add('myNewObject','Parent','shape:cube',(0,0,0),(0,0,0),1)
Python Viz> changeColot('myNewObject',(1,0,0))
The complete list of messages and their parameters can be found in the Viz-python API.
The Viz Relay is a small server that can connect to multiple instances of Viz. Your client can connect to the relay the same way it connects to Viz, except that all messages sent from the client to the relay will be forwarded to all connected Viz. Similarly, all messages sent from any Viz will be forwarded to the client. The relay also allows multiple clients to connect.
Since all connections and forwarded connections are separate, this architecture will not break the subscription paradigm: in other words, a client connected to a particular Viz through a relay will still receive messages it has subscribed to from that instance of Viz.
In the case of two-way communication between the Viz's and the clients through the relay, it is the responsibility of the user who develop the clients to make sure any possible synchronous communication is properly handled.
Also, while it is possible to imagine a network of relays with multiple Viz's and multiple clients, we recommend to keep the number of relays as close to 1 as possible, as the number of connections can increase rapidly with the number of clients of Viz.
For 1 relay: number of connections = number of connections from clients * (number of Viz + 1)
FIGURE:
The relay is implemented in Python. To run the relay:
<viz directory>/src/PyCom/relay.py <service
port number>
The relay will listen to a specific service port, to which clients can
connect. Through this port, the relay will also accept the following string
control commands (you can use telnet to connect and type the following
commands):
~shutdown : shuts down the relay
~verbose : toggles verbosity on/off
~list : list all relay connections
~newviz <hostname> <port> : makes the relay
connect to new viz at <hostname> on <port>
~outviz : toggles output into following modes:
- relay forwards outputs
from all connected viz to clients
- relay forwards ouptus
from only primary viz to clients (default)
- this mode is useful, because
some communication logics on the clients depend on having only one viz
on the other end.