Layout script interface

The ILayout script interface represents a layout in the project.

Getting an ILayout

The ILayout interface is typically accessed via the IRuntime layout property, e.g. runtime.layout. This represents the current running layout. Other layouts can be accessed via the IRuntime methods getLayout() and getAllLayouts().

Layout events

The following events can be listened for using the addEventListener method.

Fired when the layout starts. "beforelayoutstart" fires just before On start of layout, and "afterlayoutstart" first just after. In both events, all instances on the layout are created and available to modify.

Layout APIs

A read-only string of the layout name.
A read-only number of the zero-based index of the layout in the order it appears in the Project Bar.
addEventListener(eventName, callback)
removeEventListener(eventName, callback)
Add or remove a callback function for an event. See Layout events above for the available events.
Get an ILayer interface for a layer on the layout, by a case-insensitive string of its name or its zero-based index. When passing a number, an out-of-range number is clamped to the valid range and the nearest layer returned. When passing a string, if no layer with the given name is found, the method returns null.
Iterates ILayer interfaces representing all the layers on the layout, in increasing Z order.
Return an array of ILayer interfaces representing all the layers on the layout, in increasing Z order.
Set or get the size of the layout. Note a layout cannot have a zero or negative size.
scrollTo(x, y)
Set or get the scroll position in layout co-ordinates. scrollTo() is a shorthand for setting both scrollX and scrollY.
Set or get the layout scale, with 1 being the default scale, 2 being 2x scale, etc. This scales all the layers in the layout, taking in to account their scale rate property.
Set the layout angle in radians. This rotates all the layers in the layout.
Set or get a string specifying the current layout projection, which must be one of "perspective" or "orthographic". For more details see Projection in Layout Properties.
setVanishingPoint(vpX, vpY)
Set or get the Vanishing point layout property, with each component in the range 0-1. The getter returns an array with two elements in the form [vpX, vpY].
An array of IEffectInstance representing the effect parameters of the effects on this layout.
Construct 3 Manual 2022-02-28