Vizard 7 » Command Index » Vizard objects » node3d » <node3d>.clipPlane
7.6

<node3d>.clipPlane

Apply a clip plane to the node

<node3d>.clipPlane(  
plane  
num = 0  
mode = viz.CLIP_GLOBAL  
node = ''  
op = viz.OP_DEFAULT  
)  
plane
The [a,b,c,d] plane values
num = 0
The clip plane number
mode = viz.CLIP_GLOBAL
Specifies the reference frame for the clip plane. Can be one of the following values:

Mode

Description

viz.CLIP_GLOBAL

The clip plane is applied in the global coordinate system.

viz.CLIP_LOCAL

The clip plane is applied in the local coordinate system of the node it is applied to.

viz.CLIP_VIEW

The clip plane is relative to the view, before any stereo/view offsets are applied.

viz.CLIP_EYE

The clip plane relative to the eye, after all stereo/view offsets are applied.

node = ''
Name of sub-node to apply changes to
op = viz.OP_DEFAULT
Can be viz.OP_DEFAULT to use the nodes default op mode or a combination of the following values:

Op modes

viz.OP_TRAVERSE

When performing an operation on a node, traverse the entire subgraph and process all subnodes as well. This is the default value.

viz.OP_OVERRIDE

When applying attributes, have them override attributes of subnodes.

viz.OP_ROOT

When performing an operation on the node, start at the root transform of the node, instead of the model. Processing the root will include all child Vizard nodes.

Remarks

This command applies a user defined clip plane to the node. All parts of the node below the specified plane will be clipped. Multiple clip planes can be applied by specifying different clip plane numbers. The number of clip planes that can be applied is dependent on the graphics driver, however most graphics drivers have a limit of 6 clip planes per object.

Return Value

None

Example

import viz
import vizact
viz.go()

PLANE = viz.Plane(euler=(0,0,-90))

def addModel(pos,mode):
    model = viz.add('mini.osgx',pos=pos,cache=viz.CACHE_CLONE)
    model.addAction(vizact.spin(0,1,0,45))
    model.clipPlane(PLANE,mode=mode,op=viz.OP_ROOT)
    return model

addModel((-5,0,0),viz.CLIP_LOCAL)
addModel((0,0,0),viz.CLIP_GLOBAL)
addModel((5,0,0),viz.CLIP_VIEW)

#Setup camera
import vizcam
vizcam.PivotNavigate(distance=20)

#Add environment
import vizshape
grid = vizshape.addGrid(color=[0.2]*3)
viz.clearcolor(viz.GRAY)