ILayers

class ILayers

Bases: ImpactCOMWrapperBase, Iterable

Description:

A collection of ILayer objects.

Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance

property count

Gets Count.

Description:

The number of items in this collection.

Returns:

The value of Count.

Return type:

count (int)

add(name, type, original)
Description:

Adds a new layer.

Remarks:

If ‘Name’ is an empty string, ‘Type’ is an invalid layer type string or ‘Original’ is an invalid ILayer object this method will fail. If a layer already exists with the name specified then the name of the new layer will be modified, i.e. if an attempt to create a layer called ‘new_layer’ is made and a layer already exists called ‘new_layer’ then the actual name of the new layer will be ‘NewLayer_1’.

Parameters:
  • name (str) – The name of the new layer.

  • type (str) – The ‘type string’ of the new layer, e.g. “ONE_UP”, “MULTI_UP”.

  • original (ILayer) – The layer that the new layer is based upon.

find_by_resolved_key(key)
Description:

Finds the layer in a copied drawing that matches the given layer key from the original drawing.

Remarks:

When you open a copy of a revision drawing using IDatabaseRevision.open_copy there is no easy way to find a layer from the current project and match it with a layer in the revision drawing because all the usual key properties are cleared. ILayers.find_by_resolved_key facilitates this, by passing in an L_KEY value it will find the matching ILayer in the revision drawing. Introduced in Impact 11.1.0.30 and 12.0.0.96.

Parameters:

key (int) – The layer key from the original drawing.

item(variant)
Description:

Gets an ILayer object with the specified name or index.

Parameters:

variant (any) – Specifies the name or index of the object to retrieve.

remove(value)
Description:

Removed the specified layer from the collection, thus deleting it from the drawing.

Returns:

Returns true if the layer is successfully removed.

Parameters:

value (any) – The layer to remove, this may be an integer index, a layer name or an ILayer object.

Examples