KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

API reference - Class RecursiveShapeIterator

Notation used in Ruby API documentation

Module: db

Description: An iterator delivering shapes recursively

The iterator can be obtained from a cell, a layer and optionally a region. It simplifies retrieval of shapes from a geometrical region while considering subcells as well. Some options can be specified in addition, i.e. the level to which to look into or shape classes and shape properties. The shapes are retrieved by using the shape method, next moves to the next shape and at_end tells, if the iterator has move shapes to deliver.

This is some sample code:

# print the polygon-like objects as seen from the initial cell "cell"
iter = cell.begin_shapes_rec(layer)
while !iter.at_end?
  if iter.shape.renders_polygon?
    polygon = iter.shape.polygon.transformed(iter.itrans)
    puts "In cell #{iter.cell.name}: " + polygon.to_s
  end
  iter.next
end

# or shorter:
cell.begin_shapes_rec(layer).each do |iter|
  if iter.shape.renders_polygon?
    polygon = iter.shape.polygon.transformed(iter.itrans)
    puts "In cell #{iter.cell.name}: " + polygon.to_s
  end
end

Cell offers three methods to get these iterators: begin_shapes_rec, begin_shapes_rec_touching and begin_shapes_rec_overlapping. Cell#begin_shapes_rec will deliver a standard recursive shape iterator which starts from the given cell and iterates over all child cells. Cell#begin_shapes_rec_touching delivers a RecursiveShapeIterator which delivers the shapes whose bounding boxed touch the given search box. Cell#begin_shapes_rec_overlapping delivers all shapes whose bounding box overlaps the search box.

A RecursiveShapeIterator object can also be created explicitly. This allows some more options, i.e. using multiple layers. A multi-layer recursive shape iterator can be created like this:

iter = RBA::RecursiveShapeIterator::new(layout, cell, [ layer_index1, layer_index2 .. ])

"layout" is the layout object, "cell" the RBA::Cell object of the initial cell. layer_index1 etc. are the layer indexes of the layers to get the shapes from. While iterating, RecursiveShapeIterator#layer delivers the layer index of the current shape.

The recursive shape iterator can be confined to a maximum hierarchy depth. By using max_depth=, the iterator will restrict the search depth to the given depth in the cell tree.

In addition, the recursive shape iterator supports selection and exclusion of subtrees. For that purpose it keeps flags per cell telling it for which cells to turn shape delivery on and off. The select_cells method sets the "start delivery" flag while unselect_cells sets the "stop delivery" flag. In effect, using unselect_cells will exclude that cell plus the subtree from delivery. Parts of that subtree can be turned on again using select_cells. For the cells selected that way, the shapes of these cells and their child cells are delivered, even if their parent was unselected.

To get shapes from a specific cell, i.e. "MACRO" plus its child cells, unselect the top cell first and the select the desired cell again:

# deliver all shapes inside "MACRO" and the sub-hierarchy:
iter = RBA::RecursiveShapeIterator::new(layout, cell, layer)
iter.unselect_cells(cell.cell_index)
iter.select_cells("MACRO")

Note that if "MACRO" uses library cells for example which are used otherwise as well, the iterator will only deliver the shapes for those instances belonging to "MACRO" (directly or indirectly), not those for other instances of these library cells.

The unselect_all_cells and select_all_cells methods turn on the "stop" and "start" flag for all cells respectively. If you use unselect_all_cells and use select_cells for a specific cell, the iterator will deliver only the shapes of the selected cell, not its children. Those are still unselected by unselect_all_cells:

# deliver all shapes of "MACRO" but not of child cells:
iter = RBA::RecursiveShapeIterator::new(layout, cell, layer)
iter.unselect_all_cells
iter.select_cells("MACRO")

Cell selection is done using cell indexes or glob pattern. Glob pattern are equivalent to the usual file name wildcards used on various command line shells. For example "A*" matches all cells starting with an "A". The curly brace notation and character classes are supported as well. For example "C{125,512}" matches "C125" and "C512" and "[ABC]*" matches all cells starting with an "A", a "B" or "C". "[^ABC]*" matches all cells not starting with one of that letters.

The RecursiveShapeIterator class has been introduced in version 0.18 and has been extended substantially in 0.23.

Public constructors

new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int layer)
Creates a recursive, single-layer shape iterator.
new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int[] layers)
Creates a recursive, multi-layer shape iterator.
new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int layer,
const Box box,
bool overlapping = false)
Creates a recursive, single-layer shape iterator with a region.
new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int layer,
const Region region,
bool overlapping = false)
Creates a recursive, single-layer shape iterator with a region.
new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int[] layers,
const Box box,
bool overlapping = false)
Creates a recursive, multi-layer shape iterator with a region.
new RecursiveShapeIterator ptrnew(const Layout layout,
const Cell cell,
unsigned int[] layers,
const Region region,
bool overlapping = false)
Creates a recursive, multi-layer shape iterator with a region.

Public methods

[const]bool!=(const RecursiveShapeIterator other)Comparison of iterators - inequality
[const]bool==(const RecursiveShapeIterator other)Comparison of iterators - equality
[const]RecursiveShapeIterator ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]DCplxTransalways_apply_dtransGets the global transformation if at top level, unity otherwise (micrometer-unit version)
[const]ICplxTransalways_apply_transGets the global transformation if at top level, unity otherwise
voidassign(const RecursiveShapeIterator other)Assigns another object to self
[const]boolat_end?End of iterator predicate
[const]const Cell ptrcellGets the current cell's object
[const]unsigned intcell_indexGets the current cell's index
[const]Regioncomplex_regionGets the complex region that this iterator is using
voidconfine_region(const Box box_region)Confines the region that this iterator is iterating over
voidconfine_region(const Region complex_region)Confines the region that this iterator is iterating over
[const]DCplxTransdtransGets the transformation into the initial cell applicable for floating point types
[const]new RecursiveShapeIterator ptrdupCreates a copy of self
[iter]RecursiveShapeIteratoreachNative iteration
voidenable_propertiesEnables properties for the given iterator.
voidfilter_properties(variant[] keys)Filters properties by certain keys.
voidfor_merged_input=(bool flag)Sets a flag indicating whether iterator optimizes for merged input
[const]boolfor_merged_input?Gets a flag indicating whether iterator optimizes for merged input
[const]DCplxTransglobal_dtransGets the global transformation to apply to all shapes delivered (in micrometer units)
voidglobal_dtrans=(const DCplxTrans t)Sets the global transformation to apply to all shapes delivered (transformation in micrometer units)
[const]ICplxTransglobal_transGets the global transformation to apply to all shapes delivered
voidglobal_trans=(const ICplxTrans t)Sets the global transformation to apply to all shapes delivered
[const]unsigned intlayerReturns the layer index where the current shape is coming from.
[const]const Layout ptrlayoutGets the layout this iterator is connected to
voidmap_properties(map<variant,variant> key_map)Maps properties by name key.
[const]intmax_depthGets the maximum hierarchy depth
voidmax_depth=(int depth)Specifies the maximum hierarchy depth to look into
[const]intmin_depthGets the minimum hierarchy depth
voidmin_depth=(int depth)Specifies the minimum hierarchy depth to look into
voidnextIncrements the iterator
voidoverlapping=(bool flag)Sets a flag indicating whether overlapping shapes are selected when a region is used
[const]booloverlapping?Gets a flag indicating whether overlapping shapes are selected when a region is used
[const]InstElement[]pathGets the instantiation path of the shape addressed currently
[const]unsigned longprop_idGets the effective properties ID
[const]BoxregionGets the basic region that this iterator is using
voidregion=(const Box box_region)Sets the rectangular region that this iterator is iterating over
voidregion=(const Region complex_region)Sets the complex region that this iterator is using
voidremove_propertiesRemoves properties for the given container.
voidresetResets the iterator to the initial state
voidreset_selectionResets the selection to the default state
voidselect_all_cellsSelects all cells.
voidselect_cells(unsigned int[] cells)Unselects the given cells.
voidselect_cells(string cells)Unselects the given cells.
[const]ShapeshapeGets the current shape
[const]unsigned intshape_flagsGets the shape selection flags
voidshape_flags=(unsigned int flags)Specifies the shape selection flags
[const]const Cell ptrtop_cellGets the top cell this iterator is connected to
[const]ICplxTranstransGets the current transformation by which the shapes must be transformed into the initial cell
voidunselect_all_cellsUnselects all cells.
voidunselect_cells(unsigned int[] cells)Unselects the given cells.
voidunselect_cells(string cells)Unselects the given cells.

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead
[const]ICplxTransitransUse of this method is deprecated. Use trans instead

Detailed description

!=

Signature: [const] bool != (const RecursiveShapeIterator other)

Description: Comparison of iterators - inequality

Two iterators are not equal if they do not point to the same shape.

==

Signature: [const] bool == (const RecursiveShapeIterator other)

Description: Comparison of iterators - equality

Two iterators are equal if they point to the same shape.

_const_cast

Signature: [const] RecursiveShapeIterator ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

always_apply_dtrans

Signature: [const] DCplxTrans always_apply_dtrans

Description: Gets the global transformation if at top level, unity otherwise (micrometer-unit version)

As the global transformation is only applicable on top level, use this method to transform shapes and instances into their local (cell-level) version while considering the global transformation properly.

This method has been introduced in version 0.27.

always_apply_trans

Signature: [const] ICplxTrans always_apply_trans

Description: Gets the global transformation if at top level, unity otherwise

As the global transformation is only applicable on top level, use this method to transform shapes and instances into their local (cell-level) version while considering the global transformation properly.

This method has been introduced in version 0.27.

assign

Signature: void assign (const RecursiveShapeIterator other)

Description: Assigns another object to self

at_end?

Signature: [const] bool at_end?

Description: End of iterator predicate

Returns true, if the iterator is at the end of the sequence

cell

Signature: [const] const Cell ptr cell

Description: Gets the current cell's object

This method has been introduced in version 0.23.

cell_index

Signature: [const] unsigned int cell_index

Description: Gets the current cell's index

complex_region

Signature: [const] Region complex_region

Description: Gets the complex region that this iterator is using

The complex region is the effective region (a Region object) that the iterator is selecting from the layout layers. This region can be a single box or a complex region.

This method has been introduced in version 0.25.

confine_region

(1) Signature: void confine_region (const Box box_region)

Description: Confines the region that this iterator is iterating over

This method is similar to setting the region (see region=), but will confine any region (complex or simple) already set. Essentially it does a logical AND operation between the existing and given region. Hence this method can only reduce a region, not extend it.

This method has been introduced in version 0.25.

(2) Signature: void confine_region (const Region complex_region)

Description: Confines the region that this iterator is iterating over

This method is similar to setting the region (see region=), but will confine any region (complex or simple) already set. Essentially it does a logical AND operation between the existing and given region. Hence this method can only reduce a region, not extend it.

This method has been introduced in version 0.25.

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

dtrans

Signature: [const] DCplxTrans dtrans

Description: Gets the transformation into the initial cell applicable for floating point types

This transformation corresponds to the one delivered by trans, but is applicable for the floating-point shape types in micron unit space.

This method has been introduced in version 0.25.3.

dup

Signature: [const] new RecursiveShapeIterator ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

each

Signature: [iter] RecursiveShapeIterator each

Description: Native iteration

This method enables native iteration, e.g.

  iter = ... # RecursiveShapeIterator
  iter.each do |i|
     ... i is the iterator itself
  end

This is slightly more convenient than the 'at_end' .. 'next' loop.

This feature has been introduced in version 0.28.

Python specific notes:
This method enables iteration of the object.

enable_properties

Signature: void enable_properties

Description: Enables properties for the given iterator.

Afer enabling properties, prop_id will deliver the effective properties ID for the current shape. By default, properties are not enabled and prop_id will always return 0 (no properties attached). Alternatively you can apply filter_properties or map_properties to enable properties with a specific name key.

Note that property filters/mappers are additive and act in addition (after) the currently installed filter.

This feature has been introduced in version 0.28.4.

filter_properties

Signature: void filter_properties (variant[] keys)

Description: Filters properties by certain keys.

Calling this method will reduce the properties to values with name keys from the 'keys' list. As a side effect, this method enables properties. As with enable_properties or remove_properties, this filter has an effect on the value returned by prop_id, not on the properties ID attached to the shape directly.

Note that property filters/mappers are additive and act in addition (after) the currently installed filter.

This feature has been introduced in version 0.28.4.

for_merged_input=

Signature: void for_merged_input= (bool flag)

Description: Sets a flag indicating whether iterator optimizes for merged input

If this flag is set to true, the iterator is allowed to skip shapes it deems irrelevant because they are covered entirely by other shapes. This allows shortcutting hierarchy traversal in some cases.

This method has been introduced in version 0.29.

Python specific notes:
The object exposes a writable attribute 'for_merged_input'. This is the setter.

for_merged_input?

Signature: [const] bool for_merged_input?

Description: Gets a flag indicating whether iterator optimizes for merged input

see for_merged_input= for details of this attribute.

This method has been introduced in version 0.29.

Python specific notes:
The object exposes a readable attribute 'for_merged_input'. This is the getter.

global_dtrans

Signature: [const] DCplxTrans global_dtrans

Description: Gets the global transformation to apply to all shapes delivered (in micrometer units)

See also global_dtrans=.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a readable attribute 'global_dtrans'. This is the getter.

global_dtrans=

Signature: void global_dtrans= (const DCplxTrans t)

Description: Sets the global transformation to apply to all shapes delivered (transformation in micrometer units)

The global transformation will be applied to all shapes delivered by biasing the "trans" attribute. The search regions apply to the coordinate space after global transformation.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a writable attribute 'global_dtrans'. This is the setter.

global_trans

Signature: [const] ICplxTrans global_trans

Description: Gets the global transformation to apply to all shapes delivered

See also global_trans=.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a readable attribute 'global_trans'. This is the getter.

global_trans=

Signature: void global_trans= (const ICplxTrans t)

Description: Sets the global transformation to apply to all shapes delivered

The global transformation will be applied to all shapes delivered by biasing the "trans" attribute. The search regions apply to the coordinate space after global transformation.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a writable attribute 'global_trans'. This is the setter.

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

itrans

Signature: [const] ICplxTrans itrans

Description: Gets the current transformation by which the shapes must be transformed into the initial cell

Use of this method is deprecated. Use trans instead

The shapes delivered are not transformed. Instead, this transformation must be applied to get the shape in the coordinate system of the top cell.

Starting with version 0.25, this transformation is a int-to-int transformation the 'itrans' method which was providing this transformation before is deprecated.

layer

Signature: [const] unsigned int layer

Description: Returns the layer index where the current shape is coming from.

This method has been introduced in version 0.23.

layout

Signature: [const] const Layout ptr layout

Description: Gets the layout this iterator is connected to

This method has been introduced in version 0.23.

map_properties

Signature: void map_properties (map<variant,variant> key_map)

Description: Maps properties by name key.

Calling this method will reduce the properties to values with name keys from the 'keys' hash and renames the properties. Property values with keys not listed in the key map will be removed. As a side effect, this method enables properties. As with enable_properties or remove_properties, this filter has an effect on the value returned by prop_id, not on the properties ID attached to the shape directly.

Note that property filters/mappers are additive and act in addition (after) the currently installed filter.

This feature has been introduced in version 0.28.4.

max_depth

Signature: [const] int max_depth

Description: Gets the maximum hierarchy depth

See max_depth= for a description of that attribute.

This method has been introduced in version 0.23.

Python specific notes:
The object exposes a readable attribute 'max_depth'. This is the getter.

max_depth=

Signature: void max_depth= (int depth)

Description: Specifies the maximum hierarchy depth to look into

A depth of 0 instructs the iterator to deliver only shapes from the initial cell. The depth must be specified before the shapes are being retrieved. Setting the depth resets the iterator.

Python specific notes:
The object exposes a writable attribute 'max_depth'. This is the setter.

min_depth

Signature: [const] int min_depth

Description: Gets the minimum hierarchy depth

See min_depth= for a description of that attribute.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a readable attribute 'min_depth'. This is the getter.

min_depth=

Signature: void min_depth= (int depth)

Description: Specifies the minimum hierarchy depth to look into

A depth of 0 instructs the iterator to deliver shapes from the top level. 1 instructs to deliver shapes from the first child level. The minimum depth must be specified before the shapes are being retrieved.

This method has been introduced in version 0.27.

Python specific notes:
The object exposes a writable attribute 'min_depth'. This is the setter.

new

(1) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int layer)

Description: Creates a recursive, single-layer shape iterator.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layer:The layer (index) from which the shapes are taken

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layer given by the layer index in the "layer" parameter.

This constructor has been introduced in version 0.23.

Python specific notes:
This method is the default initializer of the object.

(2) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int[] layers)

Description: Creates a recursive, multi-layer shape iterator.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layers:The layer indexes from which the shapes are taken

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layers given by the layer indexes in the "layers" parameter. While iterating use the layer method to retrieve the layer of the current shape.

This constructor has been introduced in version 0.23.

Python specific notes:
This method is the default initializer of the object.

(3) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int layer, const Box box, bool overlapping = false)

Description: Creates a recursive, single-layer shape iterator with a region.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layer:The layer (index) from which the shapes are taken
box:The search region
overlapping:If set to true, shapes overlapping the search region are reported, otherwise touching is sufficient

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layer given by the layer index in the "layer" parameter.

The search is confined to the region given by the "box" parameter. If "overlapping" is true, shapes whose bounding box is overlapping the search region are reported. If "overlapping" is false, shapes whose bounding box touches the search region are reported.

This constructor has been introduced in version 0.23. The 'overlapping' parameter has been made optional in version 0.27.

Python specific notes:
This method is the default initializer of the object.

(4) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int layer, const Region region, bool overlapping = false)

Description: Creates a recursive, single-layer shape iterator with a region.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layer:The layer (index) from which the shapes are taken
region:The search region
overlapping:If set to true, shapes overlapping the search region are reported, otherwise touching is sufficient

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layer given by the layer index in the "layer" parameter.

The search is confined to the region given by the "region" parameter. The region needs to be a rectilinear region. If "overlapping" is true, shapes whose bounding box is overlapping the search region are reported. If "overlapping" is false, shapes whose bounding box touches the search region are reported.

This constructor has been introduced in version 0.25. The 'overlapping' parameter has been made optional in version 0.27.

Python specific notes:
This method is the default initializer of the object.

(5) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int[] layers, const Box box, bool overlapping = false)

Description: Creates a recursive, multi-layer shape iterator with a region.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layers:The layer indexes from which the shapes are taken
box:The search region
overlapping:If set to true, shapes overlapping the search region are reported, otherwise touching is sufficient

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layers given by the layer indexes in the "layers" parameter. While iterating use the layer method to retrieve the layer of the current shape.

The search is confined to the region given by the "box" parameter. If "overlapping" is true, shapes whose bounding box is overlapping the search region are reported. If "overlapping" is false, shapes whose bounding box touches the search region are reported.

This constructor has been introduced in version 0.23. The 'overlapping' parameter has been made optional in version 0.27.

Python specific notes:
This method is the default initializer of the object.

(6) Signature: [static] new RecursiveShapeIterator ptr new (const Layout layout, const Cell cell, unsigned int[] layers, const Region region, bool overlapping = false)

Description: Creates a recursive, multi-layer shape iterator with a region.

layout:The layout which shall be iterated
cell:The initial cell which shall be iterated (including its children)
layers:The layer indexes from which the shapes are taken
region:The search region
overlapping:If set to true, shapes overlapping the search region are reported, otherwise touching is sufficient

This constructor creates a new recursive shape iterator which delivers the shapes of the given cell plus its children from the layers given by the layer indexes in the "layers" parameter. While iterating use the layer method to retrieve the layer of the current shape.

The search is confined to the region given by the "region" parameter. The region needs to be a rectilinear region. If "overlapping" is true, shapes whose bounding box is overlapping the search region are reported. If "overlapping" is false, shapes whose bounding box touches the search region are reported.

This constructor has been introduced in version 0.23. The 'overlapping' parameter has been made optional in version 0.27.

Python specific notes:
This method is the default initializer of the object.

next

Signature: void next

Description: Increments the iterator

This moves the iterator to the next shape inside the search scope.

overlapping=

Signature: void overlapping= (bool flag)

Description: Sets a flag indicating whether overlapping shapes are selected when a region is used

If this flag is false, shapes touching the search region are returned.

This method has been introduced in version 0.23.

Python specific notes:
The object exposes a writable attribute 'overlapping'. This is the setter.

overlapping?

Signature: [const] bool overlapping?

Description: Gets a flag indicating whether overlapping shapes are selected when a region is used

This method has been introduced in version 0.23.

Python specific notes:
The object exposes a readable attribute 'overlapping'. This is the getter.

path

Signature: [const] InstElement[] path

Description: Gets the instantiation path of the shape addressed currently

This attribute is a sequence of InstElement objects describing the cell instance path from the initial cell to the current cell containing the current shape.

This method has been introduced in version 0.25.

prop_id

Signature: [const] unsigned long prop_id

Description: Gets the effective properties ID

The shape iterator supports property filtering and translation. This method will deliver the effective property ID after translation. The original property ID can be obtained from 'shape.prop_id' and is not changed by installing filters or mappers.

prop_id is evaluated by Region objects for example, when they are created from a shape iterator.

See enable_properties, filter_properties, remove_properties and map_properties for details on this feature.

This attribute has been introduced in version 0.28.4.

region

Signature: [const] Box region

Description: Gets the basic region that this iterator is using

The basic region is the overall box the region iterator iterates over. There may be an additional complex region that confines the region iterator. See complex_region for this attribute.

This method has been introduced in version 0.23.

Python specific notes:
The object exposes a readable attribute 'region'. This is the getter.

region=

(1) Signature: void region= (const Box box_region)

Description: Sets the rectangular region that this iterator is iterating over

See region for a description of this attribute. Setting a simple region will reset the complex region to a rectangle and reset the iterator to the beginning of the sequence. This method has been introduced in version 0.23.

Python specific notes:
The object exposes a writable attribute 'region'. This is the setter.

(2) Signature: void region= (const Region complex_region)

Description: Sets the complex region that this iterator is using

See complex_region for a description of this attribute. Setting the complex region will reset the basic region (see region) to the bounding box of the complex region and reset the iterator to the beginning of the sequence.

This method overload has been introduced in version 0.25.

Python specific notes:
The object exposes a writable attribute 'region'. This is the setter.

remove_properties

Signature: void remove_properties

Description: Removes properties for the given container.

This will remove all properties and prop_id will deliver 0 always (no properties attached). Alternatively you can apply filter_properties or map_properties to enable properties with a specific name key.

Note that property filters/mappers are additive and act in addition (after) the currently installed filter. So effectively after 'remove_properties' you cannot get them back.

This feature has been introduced in version 0.28.4.

reset

Signature: void reset

Description: Resets the iterator to the initial state

This method has been introduced in version 0.23.

reset_selection

Signature: void reset_selection

Description: Resets the selection to the default state

In the initial state, the top cell and its children are selected. Child cells can be switched on and off together with their sub-hierarchy using select_cells and unselect_cells.

This method will also reset the iterator.

This method has been introduced in version 0.23.

select_all_cells

Signature: void select_all_cells

Description: Selects all cells.

This method will set the "selected" mark on all cells. The effect is that subsequent calls of unselect_cells will unselect only the specified cells, not their children, because they are still unselected.

This method will also reset the iterator.

This method has been introduced in version 0.23.

select_cells

(1) Signature: void select_cells (unsigned int[] cells)

Description: Unselects the given cells.

This method will sets the "selected" mark on the given cells. That means that these cells or their child cells are visited, unless they are marked as "unselected" again with the unselect_cells method.

The cells are given as a list of cell indexes.

This method will also reset the iterator.

This method has been introduced in version 0.23.

(2) Signature: void select_cells (string cells)

Description: Unselects the given cells.

This method will sets the "selected" mark on the given cells. That means that these cells or their child cells are visited, unless they are marked as "unselected" again with the unselect_cells method.

The cells are given as a glob pattern. A glob pattern follows the syntax of file names on the shell (i.e. "A*" are all cells starting with a letter "A").

This method will also reset the iterator.

This method has been introduced in version 0.23.

shape

Signature: [const] Shape shape

Description: Gets the current shape

Returns the shape currently referred to by the recursive iterator. This shape is not transformed yet and is located in the current cell.

shape_flags

Signature: [const] unsigned int shape_flags

Description: Gets the shape selection flags

See shape_flags= for a description of that property.

This getter has been introduced in version 0.28.

Python specific notes:
The object exposes a readable attribute 'shape_flags'. This is the getter.

shape_flags=

Signature: void shape_flags= (unsigned int flags)

Description: Specifies the shape selection flags

The flags are the same then being defined in Shapes (the default is RBA::Shapes::SAll). The flags must be specified before the shapes are being retrieved. Settings the shapes flags will reset the iterator.

Python specific notes:
The object exposes a writable attribute 'shape_flags'. This is the setter.

top_cell

Signature: [const] const Cell ptr top_cell

Description: Gets the top cell this iterator is connected to

This method has been introduced in version 0.23.

trans

Signature: [const] ICplxTrans trans

Description: Gets the current transformation by which the shapes must be transformed into the initial cell

The shapes delivered are not transformed. Instead, this transformation must be applied to get the shape in the coordinate system of the top cell.

Starting with version 0.25, this transformation is a int-to-int transformation the 'itrans' method which was providing this transformation before is deprecated.

unselect_all_cells

Signature: void unselect_all_cells

Description: Unselects all cells.

This method will set the "unselected" mark on all cells. The effect is that subsequent calls of select_cells will select only the specified cells, not their children, because they are still unselected.

This method will also reset the iterator.

This method has been introduced in version 0.23.

unselect_cells

(1) Signature: void unselect_cells (unsigned int[] cells)

Description: Unselects the given cells.

This method will sets the "unselected" mark on the given cells. That means that these cells or their child cells will not be visited, unless they are marked as "selected" again with the select_cells method.

The cells are given as a list of cell indexes.

This method will also reset the iterator.

This method has been introduced in version 0.23.

(2) Signature: void unselect_cells (string cells)

Description: Unselects the given cells.

This method will sets the "unselected" mark on the given cells. That means that these cells or their child cells will not be visited, unless they are marked as "selected" again with the select_cells method.

The cells are given as a glob pattern. A glob pattern follows the syntax of file names on the shell (i.e. "A*" are all cells starting with a letter "A").

This method will also reset the iterator.

This method has been introduced in version 0.23.