Display

Scene

Scene is a container that stores models and their associated colors.

scene = Scene()
scene.add(model)
scene.add(model, color)

scene.add returns an interactiveobject with which you can change the state of the displayed object (see interactiveobject)

zencad.default_scene - scene object used by display-related operations, unless otherwise specified.


zencad.display

A tool for adding geometry to a scene.

zencad.display(shape, color=zencad.default_color, scene=zencad.default_scene)
zencad.display(unit, color=zencad.default_color, scene=zencad.default_scene, deep=True)
zencad.display(lst, color=zencad.default_color, scene=zencad.default_scene)

zencad.disp(model) # alternate

Depending on the type of the parameter, display can behave as follows: For shape - adds to the scene, returns interactiveobject For assemble.unit - calls the bindto_scene procedure, returns None For list / tuple, it calls display iteratively on the list items, returns a list of results.


zencad.highlight

A special variant of the display function used to debug the constructed geometry.

zencad.highlight(model, color=zencad.color(0.5, 0, 0, 0.5))
zencad.hl(model) # alternate naming

Unlike display, the function returns the object passed to it. Usage example (highlight the subtracted form):

c = a - hl(b.up(100500))

color

An object containing color information in rgba format. The range of parameter values is [0,1].

color(r,g,b,a)

ZenCad defines a standard set of colors:

zencad.color.white =     zencad.color(1,1,1)
zencad.color.black =     zencad.color(0,0,0)
zencad.color.red =       zencad.color(1,0,0)
zencad.color.green =     zencad.color(0,1,0)
zencad.color.blue =      zencad.color(0,0,1)
zencad.color.yellow =    zencad.color(1,1,0)
zencad.color.magenta =   zencad.color(0,1,1)
zencad.color.cian =      zencad.color(1,0,1)
zencad.color.mech =      zencad.color(0.6, 0.6, 0.8)
zencad.color.transmech = zencad.color(0.6, 0.6, 0.8, 0.8)

show

zencad.show(scene=zencad.default_scene,
animate=None, preanimate=None, close_handle=None)

The show function initiates the display of the renderer program. If the function is called with no arguments, the default scene (zencad.default_scene) is displayed.

show also has a set of parameters to support animation functions for the model (see Animation).

The show behavior is covered in more detail in (Internal Kitchen)