Vizard 8 » Command Index » Vizard objects » node3d » <node3d:canvas>.pick
8.1

<node3d:canvas>.pick

Perform a pick test on the canvas

<node3d:canvas>.pick(  
info = False  
pos = None # [x,y]
mode = viz.CANVAS_CURSOR_NORMALIZED  
all = False  
ignoreBackFace = False  
computePath = False  
ignoreClipped = False  
)  
info = False
If the value is True, it causes the pick command to return a viz.Intersect object, instead of a <node3d> object.
pos = None
The [x,y] position on the canvas to perform the pick test. If None, then the current canvas cursor position will be used.
mode = viz.CANVAS_CURSOR_NORMALIZED
Specifies the reference frame for the pick position.

Can be one of the following:

Mode

Description

viz.CANVAS_CURSOR_NORMALIZED

The position is specified in normalized (0-1) canvas coordinates.

viz.CANVAS_CURSOR_PIXELS

The position is specified in canvas pixel resolution coordinates.

all = False
If True, then all intersections will be returned, not just the first one.
ignoreBackFace = False
If True, back facing polygons will be ignored during the intersection test.
computePath = False
If True, the name_path and object_path attributes of the viz.Intersect object will be computed.
ignoreClipped = False
If True, intersections that are clipped by clip planes (<node3d>.clipPlane) will be ignored.

Remarks

This command will perform an intersection test on the canvas at the specified cursor position. The return value will depend on the info and all parameters.

Nodes that have viz.PICKING disabled will not appear in the results.

Intersection tests can be optimized for certain nodes by using the viz.OPTIMIZE_INTERSECT_HINT flag with the <node3d>.hint command. This hint can significantly increase memory usage though.

Return Value

The table below describes the return value based on the info and all parameters:

info

all

Return Value

False

False

<node3d> object

True

False

viz.Intersect object

False

True

List of <node3d> objects

True

True

List of viz.Intersect objects



The following is a list of fields of the viz.Intersect object:

Attribute

valid

True if an intersection occurred, False if it didn't.

point

The point of intersection with the object.

normal

The normal vector of the intersect point.

object

The node3d object that was intersected. This will be the lowest level node3d object within the scene hierarchy. You can prevent specific nodes from appearing as the intersect object by disabling viz.INTERSECT_INFO_OBJECT on them. In this case, the first parent node with this attribute enabled will be reported as the intersect object.

name

The name of the sub-node that was intersected.

object_path

A list of node3d objects representing the full path to the intersected object within the scene hierarchy. This value is only computed if the computePath option is True.

name_path

A list of sub-node names representing the full path to the intersected object within the scene hierarchy. This value is only computed if the computePath option is True.