cloudViewer.visualization.ExternalVisualizer#
- class cloudViewer.visualization.ExternalVisualizer(address='tcp://127.0.0.1:51454', timeout=10000)[source]#
This class allows to send data to an external Visualizer
Example
This example sends a point cloud to the visualizer:
import cloudViewer as cv3d import numpy as np ev = cv3d.visualization.ExternalVisualizer() pcd = cv3d.geometry.ccPointCloud(cv3d.utility.Vector3dVector(np.random.rand(100,3))) ev.set(pcd)
- Parameters:
address – The address where the visualizer is running. The default is localhost.
timeout – The timeout for sending data in milliseconds.
- draw(geometry=None, *args, **kwargs)[source]#
This function has the same functionality as ‘set’.
This function is compatible with the standalone ‘draw’ function and can be used to redirect calls to the external visualizer. Note that only the geometry argument is supported, all other arguments will be ignored.
Example
Here we use draw with the default external visualizer:
import cloudViewer as cv3d torus = cv3d.geometry.ccMesh.create_torus() sphere = cv3d.geometry.ccMesh.create_sphere() draw = cv3d.visualization.EV.draw draw([ {'geometry': sphere, 'name': 'sphere'}, {'geometry': torus, 'name': 'torus', 'time': 1} ]) # now use the standard draw function as comparison draw = cv3d.visualization.draw draw([ {'geometry': sphere, 'name': 'sphere'}, {'geometry': torus, 'name': 'torus', 'time': 1} ])
- Parameters:
geometry – The geometry to draw. This can be a geometry object, a
the (list of geometries. To pass additional information along with) –
dictionary (geometry we can use a dictionary. Supported keys for the) –
'geometry' (are) –
'name' –
'time'. (and) –
- set(obj=None, path='', time=0, layer='', connection=None)[source]#
Send CloudViewer objects for visualization to the visualizer.
Example
To quickly send a single object just write:
ev.set(point_cloud)
To place the object at a specific location in the scene tree do:
ev.set(point_cloud, path='group/mypoints', time=42, layer='')
Note that depending on the visualizer some arguments like time or layer may not be supported and will be ignored.
To set multiple objects use a list to pass multiple objects:
ev.set([point_cloud, mesh, camera])
Each entry in the list can be a tuple specifying all or some of the location parameters:
ev.set(objs=[(point_cloud,'group/mypoints', 1, 'layer1'), (mesh, 'group/mymesh'), camera ]
- Parameters:
obj – A geometry or camera object or a list of objects. See the
instructions. (example seection for usage) –
path – A path describing a location in the scene tree.
time – An integer time value associated with the object.
layer – The layer associated with the object.
connection – A connection object to use for sending data. This parameter can be used to override the default object.