Inspection Tool
The inspection tool in Panopti allows you to interactively inspect the geometric data structures. For meshes-like objects this tool displays the selected face index and corresponding vertex indices around the face, for point clouds the selected point index is displayed.
Example: Using Inspection Events
You can react to inspection events in your Python code using the @viewer.events.inspect()
decorator. This allows you to trigger custom logic whenever a user inspects an object in the viewer.
import panopti
viewer = panopti.connect(...)
# ... your scene ...
@viewer.events.inspect()
def inspect_event(viewer, inspect_info):
print(f"User clicked on a {inspect_info.object_type} object.")
if inspect_info.object_type in ['mesh', 'animated_mesh']:
# inspect_result is MeshInspectResult
print('Selected face index:', inspect_info.inspect_result.face_index)
print('Selected vertex indices:', inspect_info.inspect_result.vertex_indices)
elif inspect_info.object_type == 'points':
# inspect_result is PointCloudInspectResult
print('Selected point index:', inspect_info.inspect_result.point_index)
viewer.hold()
Inspect - @viewer.events.inspect()
Inspection Event
The inspect
event is triggered when the inspection tool is used in the viewer (e.g. when clicking on a mesh to inspect its local vertex indices).
Example usage:
@viewer.events.inspect()
def inspect_event(viewer, inspect_info):
print(f"User clicked on a {inspect_info.object_type} object.")
if inspect_info.object_type == 'mesh':
print('Selected face index: ', inspect_info.inspect_result.face_index)
inspect_info
is an InspectInfo
object with the following attributes:
attribute | meaning | type |
---|---|---|
object_name | name attribute of selected object |
str |
object_type | type of Panopti object selected (e.g., 'mesh' , 'points' ) |
str |
world_coords | XYZ world coordinates of the pick point | ndarray |
screen_coords | integer pixel coordinates of the pick point | ndarray |
inspect_result | geometry-specific data at the pick point: Mesh / AnimatedMesh: MeshInspectResult holding face_index and vertex_indices PointCloud: PointCloudInspectResult holding point_index |
Union[MeshInspectResult, PointCloudInspectResult] |