comet.CLayer

class comet.CLayer

This section describes all functions for the comet.CLayer class.

Methods

CLayer.getDocument()

Get the document this layer belongs to.

Returns:

The document

Return type:

CDocument

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CLayer.getParent()

Get the parent layer of this layer.

Returns:

The next parent layer or None when the layer is a top level layer

Return type:

CLayer | None

Raises:

CometError – On internal error

Available:

Illustrator®

CLayer.setParent(parent)

Reparent this layer to a new parent.

The layer is moved so it is the topmost child of the new parent. To move the layer inside the same parent use setIndex()

Parameters:

parent

The new parent layer.

The parameter type can be:

  • CDocument

    A layer

  • None

    Move this layer to the top so it does not have any parent.

Return type:

None

Raises:
Available:

Illustrator®

CLayer.getChildren()

Get all child layers of this layer.

Returns:

All direct child layers of this layer

Return type:

list[CLayer]

Raises:

CometError – On internal error

Available:

Illustrator®

CLayer.getSiblings(includeSelf=False)

Get all sibling layers of this layer.

Parameters:

includeSelf (bool) – Should this layer be included in the result list?

Returns:

All direct siblings of this layer

Return type:

list[CLayer]

Raises:
Available:

Illustrator®

CLayer.getName()

Get the name of this layer.

Returns:

The layer name

Return type:

str

Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::name

CLayer.setName(name)

Rename this layer.

Parameters:

name (str) – The new name

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::rename

CLayer.getPath(delimiter=':')

Get the layer hierarchy of this layer as a string.

The delimiter string is used inbetween each layer.

InDesign® comet_pdf® This function is the same as getName()

Parameters:

delimiter (str) – The delimiter to put between two layers in the result

Returns:

The layer hierarchy from top to bottom of this layer as a string path.

Return type:

str

Raises:

TypeError – When parameter types are invalid

Available:

Illustrator®

CLayer.getIndex()

At which position is the layer at? Indices are counted beginning at 0 from the last layer.

Returns:

The 0-based layer index

Return type:

int

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::index

CLayer.setIndex(index)

Move a layer to another index in the layer order. The layer is placed before the layer at the target index, moving all other layers behind index.

Parameters:

index (int) –

The new index to place the layer at.

  • -1 or > layer count: Layer will be the new top layer

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::move

CLayer.getVisible()

Ascertain whether this layer is visible

Returns:

The visibility state of this layer

Return type:

bool

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CLayer.setVisible(visible=True)

Set the visibility state of this layer

Parameters:

visible (bool) –

Visibility state

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:
CLayer.getLocked()

Ascertain whether this layer is locked

Returns:

The lock state of this layer

Return type:

bool

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CLayer.setLocked(locked=True)

Set the lock state of this layer

Parameters:

locked (bool) –

Lock state

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:
CLayer.getPrintable()

Ascertain whether this layer is printable

Returns:

The printable state of this layer

Return type:

bool

Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::get_printable

CLayer.setPrintable(printable=True)

Set the printable state of this layer

Parameters:

printable (bool) – Printable state

Return type:

None

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

layer::set_printable

CLayer.getFrames(includeSubFrames=False)

Get all frames that are on this layer

Parameters:

includeSubFrames (bool) –

  • True: Include every frame on that layer

  • False: Include only top level frames directly beneath the layer

Raises:
Returns:

All frames currently on this layer

Return type:

list[CFrame]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

itemlist::allframes

CLayer.getItems(includeSubItems=False)

Get all items that are on this layer

Parameters:

includeSubItems (bool) –

  • True: Include every item on that layer

  • False: Include only top level items directly beneath the layer

Raises:
Returns:

All items currently on this layer

Return type:

list[CPageItem]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

itemlist::allframes

CLayer.remove()

Deletes this layer from it’s document. All subsequent calls to this layer’s functions will fail. Trying to delete the last layer of the document will raise a CometError.

Return type:

None

Raises:

CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

Special methods

CLayer.__repr__()

String representation.

Returns:

<CLayer> Name: Name

Path: Layer path

Example
<CLayer> Name: AAA
Path: AAA

Return type:

str