Package Scientific :: Package Visualization :: Module VRML :: Class Scene

[frames] | no frames]

# Class Scene

VRML scene

A VRML scene is a collection of graphics objects that can be written to a VRML file or fed directly to a VRML browser.

Instance Methods

VRMLObject

__getitem__(self, item) Returns: the graphics object at the index position |

__init__(self, objects=None, cameras=None, **options) |

`int`

__len__(self) Returns: the number of graphics objects in the scene |

addCamera(self, camera) Add a camera to the list of cameras |

addObject(self, object) |

view(self, *args) Start a VRML browser and load the scene |

writeToFile(self, filename) Write the scene to a VRML file |

Method Details

### __getitem__(self, item)
(Indexing operator)

Parameters:
  - `item` (`int`) - an index
Returns: VRMLObject
  the graphics object at the index position

### __init__(self, objects=None, cameras=None, **options)
(Constructor)

Parameters:
  - `objects` (`list` or `NoneType`) - a list of graphics objects, or `None` for an empty scene
  - `cameras` - a list of cameras, or `None` for no cameras (not yet implemented)
  - `options` - options as keyword arguments (none defined)

### __len__(self)
(Length operator)

Returns: `int`
  the number of graphics objects in the scene

### addCamera(self, camera)

Add a camera to the list of cameras

Parameters:
  - `camera` - the camera to be adde

### addObject(self, object)

Parameters:
  - `object` (VRMLObject) - a graphics object to be added to the scene

### view(self, *args)

Start a VRML browser and load the scene

Parameters:
  - `args` - not used, for compatibility only

### writeToFile(self, filename)

Write the scene to a VRML file

Parameters:
  - `filename` (`str`) - the name of the script