    

 ## On this page

  

 

 # Scene classes

 Last update: 20.02.2025 

## [`Scene`](#compolyx.Scene)

### *class* compolyx.Scene(graph, model=None, name='', id=None, title='', view=None, parent=None, active\_set=None)

Class to represent Scene.

#### *property* active\_set

Set of active entities.

#### *property* background

Background color.

#### *property* background2

Background color 2.

#### *property* camera

Camera settings.

#### *property* changed

Status boolean. Set to true if the underlying data has been changed. Write only property.

#### *property* descriptions\_changed

Set to True if descriptions should be updated.

#### *property* fit\_to\_window

Reset the zoom of the window.

#### *property* foreground

Foreground color.

#### *property* logo\_type

Logo type: default or black.

#### *property* mode

Current ACP mode (pre or post).

#### *property* projection

Projection method: ‘parallel’ or ‘perspective’.

#### save\_snapshot(path, width=None, height=None, draw\_background=False)

Create a snapshot of the scene.

- **Parameters:**
    - path: File path.
    - width: Width in pixels of the snapshot.
    - height: Height in pixels of the snapshot.
    - draw\_background: Boolean whether to draw the background or not. If false, the background is white.

#### *property* scale\_factor

Scale factor of the deformed mesh.

#### serialize()

Serialize to Python string.

#### *property* show\_element\_type

Highlight `shell` or `solid` elements, or use `automatic` to select solid elements if the object belongs to a solid model. Note: Only analysis plies have solid elements. Shell elements are highlighted for modeling and production plies.

#### *property* show\_global\_coordinate\_system

Toggle visibility of global coordinate system marker.

#### *property* show\_labeled\_bounding\_box

Toggle visibility of labeled bounding box.

#### *property* show\_selected\_mesh

Specify whether to show/highlight currently selected Elements.

#### *property* show\_silhouette

Whether to show the silhouette of currently selected elements.

#### *property* status

Status of the object.

#### *property* title

Scene title.

#### update\_direction\_display\_data(entities)

Function syncronizes the following direction plots with the added/removed entities given:

- `orientations`.
- `ref_directions`.
- `fiber_directions`.
- `draped_fiber_directions`.

#### *property* uptodate

Apply a view to the scene. Write only.

#### *property* view

Apply a view to the scene.

## [`View`](#compolyx.View)

### *class* compolyx.View(name, position=(0.0, 0.0, 0.0), orientation=(0.0, 0.0, 0.0), rotation\_point=(0.0, 0.0, 0.0), parallel\_scale=1.0, projection='perspective', locked=False, parent=None)

ComPoLyX class to capture view properties.

Access:

```pycon
>>> import compolyx
>>> db = compolyx.DB()
>>> view1 = db.create_view(name='View.1', position=[1.5, 5.75, 7.], orientation=[-0.4, -0.4, 0.8], rotation_point=[-6.0, 0.6, 0.75], projection='perspective')

```

#### *property* locked

A View which is imported from an other source can not be modified.

#### *property* orientation

Get/set the view orientation.

#### *property* parallel\_scale

Get/set the view parallel perspective scale factor.

#### *property* position

Get/set the view position.

#### *property* projection

Get/set the projection method parallel or perspective.

#### *property* rotation\_point

Get/set the view rotation point.

#### serialize()

Serialize to Python string.