View

class cee.View()

A View represents a viewport where you can show models and overlay items.

A view has a collection of models that are shown in the view. You add a model to a view with the addModel function and remove it with the removeModel function.

You can access the Camera from the View with the camera property. The camera can be used to manually control the view point, projection and other view related settings.

A viewer can have one or more views. The views can operate independently or be set up for synchronized viewing. Changes to a model object shared between multiple views will be reflected in all views. The MultipleViews example project shows how you can create, manage, and synchronize multiple views.

You can manage overlay items (legends, text boxes, navigation cube, etc) with the overlay object.

Accessors

  • ambientOcclusion

  • background

  • camera

  • clipping

  • haloHighlightColor

  • modelCount

  • name

  • navigation

  • nonHighlightedDimFactor

  • overlay

  • ownerViewer


Accessors

cee.ambientOcclusion()

The ambient occlusion configuration object for the view

Return type:

AmbientOcclusion

cee.background()

The background config of the view

Return type:

Background

cee.camera()

The Camera used in the View.

The camera can be used to specify the View’s viewpoint, orientation, direction, projection, clipping, and other viewport related properties.

Note:

This returns a reference to the real object, not a copy, so any changes to the returned object will be applied to the 3D view.

Return type:

Camera

cee.clipping()

The clipping controller for the view

Return type:

Clipping

cee.haloHighlightColor()

The color used to draw the halo around highlighted parts in the view.

Return type:

Color3Like

cee.haloHighlightColor(highlightColor)
Arguments:
Return type:

void

cee.modelCount()

The number of models in the view.

Return type:

number

cee.name()

The name of the view (used for debugging)

Return type:

string

cee.name(name)
Arguments:
  • name (string) – None

Return type:

void

cee.navigation()

The navigation controller for the view.

Return type:

Navigation

cee.nonHighlightedDimFactor()

The amount to dim the areas of the screen that does not contain highlighted parts. Default value is 0.5. Setting a value of 0 disables dimming.

Return type:

number

cee.nonHighlightedDimFactor(factor)
Arguments:
  • factor (number) – None

Return type:

void

cee.overlay()

The 2d overlay controller for the view.

Return type:

Overlay

cee.ownerViewer()

The owner Viewer.

A View can only be in one Viewer. The Viewer creates and manages the View.

Return type:

Viewer

Methods

addModel

View.addModel(model)
Arguments:

Adds a model to the view.

While a model can be shown in any number of views, it can only be added to a particular view once.

Return type:

void

getBoundingBox

View.getBoundingBox([modelBoundingBoxOptions])
Arguments:

Returns the combined bounding box of all models in the view

See Model.getBoundingBox and ModelBoundingBoxOptions for more information on how the bounding box is calculated and what options are available.

Return type:

BoundingBox

getIndexOfModel

View.getIndexOfModel(model)
Arguments:

Returns the zero-based index of the given model

Return type:

number

getModelArray

View.getModelArray()

Returns a read only array with all models in the view

Return type:

unknown

getModelAt

View.getModelAt(index)
Arguments:
  • index (number) – None

Returns the model at the given zero-based index

Return type:

Model

getRayThroughPoint

View.getRayThroughPoint(point)
Arguments:
  • point (Vec3) – None

Returns a ray that intersects the given point (in world coordinates) and starts at the point’s projection onto the screen.

Return type:

Ray

rayIntersect

View.rayIntersect(ray, ignoreLabels)
Arguments:
  • ray (Ray) – None

  • ignoreLabels (boolean) – None

Do a ray intersect with all the models in the view.

Returns the intersection point if there was a hit, and null if there was not a hit.

Labels have a “special treatment” ray intersect where hitting the label will cause a hit on the label attachment point. This is not always what is intended, e.g. when doing zoom to cursor. Set ignoreLabels to true to skip labels when doing ray intersect. This only applies to PartLabels in the MarkupModel

Return type:

Vec3

removeAllModels

View.removeAllModels()

Removes all models from the view.

Return type:

void

removeModel

View.removeModel(model)
Arguments:

Removes the given model from the view.

Return type:

void

removeModelAt

View.removeModelAt(modelIndex)
Arguments:
  • modelIndex (number) – None

Removes the model at the given index from the view.

The index must be zero-based and between 0 and modelCount - 1

Return type:

void

requestRedraw

View.requestRedraw()

Requests a redraw of the viewer. This will force a redraw on the next CloudSession.handleAnimationFrameCallback event.

Return type:

void

setViewport

View.setViewport(x, y, width, height)
Arguments:
  • x (number) – None

  • y (number) – None

  • width (number) – None

  • height (number) – None

Sets the viewport to the given position and size in OpenGL window coordinates.

This method cannot be called when ownerViewer.``viewLayoutMode`` is set to ViewLayoutMode.Auto.

Return type:

void