API reference - Class Layout

Notation used in Ruby API documentation

Module: db

Description: The layout object

This object represents a layout. The layout object contains the cell hierarchy and adds functionality for managing cell names and layer names. The cell hierarchy can be changed by adding cells and cell instances. Cell instances will virtually put the content of a cell into another cell. Many cell instances can be put into a cell thus forming repetitions of the cell content. This process can be repeated over multiple levels. In effect a cell graphs is created with parent cells and child cells. The graph must not be recursive, so there is at least one top cell, which does not have a parent cell. Multiple top cells can be present.

Layout is the very basic class of the layout database. It has a rich set of methods to manipulate and query the layout hierarchy, the geometrical objects, the meta information and other features of the layout database. For a discussion of the basic API and the related classes see The Database API.

Usually layout objects have already been created by KLayout's application core. You can address such a layout via the CellView object inside the LayoutView class. For example:

active_layout = RBA::CellView::active.layout
puts "Top cell of current layout is #{active_layout.top_cell.name}"

However, a layout can also be used standalone:

layout = RBA::Layout::new
cell = layout.create_cell("TOP")
layer = layout.layer(RBA::LayerInfo::new(1, 0))
cell.shapes(layer).insert(RBA::Box::new(0, 0, 1000, 1000))
layout.write("single_rect.gds")

Public constructors

new Layout ptrnew(Manager manager)Creates a layout object attached to a manager
new Layout ptrnewCreates a layout object
new Layout ptrnew(bool editable,
Manager manager)
Creates a layout object attached to a manager
new Layout ptrnew(bool editable)Creates a layout object

Public methods

[const]Layout 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.
unsigned intadd_lib_cell(Library ptr library,
unsigned int lib_cell_index)
Imports a cell from the library
voidadd_meta_info(const LayoutMetaInfo info)Adds meta information to the layout
unsigned intadd_pcell_variant(unsigned int pcell_id,
map<string,variant> parameters)
Creates a PCell variant for the given PCell ID with the parameters given as a name/value dictionary
unsigned intadd_pcell_variant(unsigned int pcell_id,
variant[] parameters)
Creates a PCell variant for the given PCell ID with the given parameters
unsigned intadd_pcell_variant(Library ptr library,
unsigned int pcell_id,
map<string,variant> parameters)
Creates a PCell variant for a PCell located in an external library with the parameters given as a name/value dictionary
unsigned intadd_pcell_variant(Library ptr library,
unsigned int pcell_id,
variant[] parameters)
Creates a PCell variant for a PCell located in an external library
voidassign(const Layout other)Assigns another object to self
[const]RecursiveShapeIteratorbegin_shapes(const Cell ptr cell,
unsigned int layer)
Delivers a recursive shape iterator for the shapes below the given cell on the given layer
voidbreak_polygons(unsigned long max_vertex_count,
double max_area_ratio)
Breaks the polygons of the layout into smaller ones
voidbreak_polygons(unsigned int layer,
unsigned long max_vertex_count,
double max_area_ratio)
Breaks the polygons of the layer into smaller ones
Cell ptrcell(string name)Gets a cell object from the cell name
[const]const Cell ptrcell(string name)Gets a cell object from the cell name (const version)
Cell ptrcell(unsigned int i)Gets a cell object from the cell index
[const]const Cell ptrcell(unsigned int i)Gets a cell object from the cell index (const version)
[const]stringcell_name(unsigned int index)Gets the name for a cell with the given index
[const]unsigned intcellsReturns the number of cells
Cell ptr[]cells(string name_filter)Gets the cell objects for a given name filter
[const]const Cell ptr[]cells(string name_filter)Gets the cell objects for a given name filter (const version)
voidcleanup(unsigned int[] cell_indexes_to_keep = [])Cleans up the layout
voidclearClears the layout
voidclear_all_meta_infoClears all meta information of the layout (cell specific and global)
voidclear_layer(unsigned int layer_index)Clears a layer
voidclear_layer(unsigned int layer_index,
unsigned int flags)
Clears a layer (given shape types only)
voidclear_meta_infoClears the meta information of the layout
unsigned intclip(unsigned int cell,
const Box box)
Clips the given cell by the given rectangle and produce a new cell with the clip
unsigned intclip(unsigned int cell,
const DBox box)
Clips the given cell by the given rectangle and produce a new cell with the clip
Cell ptrclip(const Cell cell,
const Box box)
Clips the given cell by the given rectangle and produce a new cell with the clip
Cell ptrclip(const Cell cell,
const DBox box)
Clips the given cell by the given rectangle and produce a new cell with the clip
[const]unsigned intclip_into(unsigned int cell,
Layout ptr target,
const Box box)
Clips the given cell by the given rectangle and produce a new cell with the clip
[const]unsigned intclip_into(unsigned int cell,
Layout ptr target,
const DBox box)
Clips the given cell by the given rectangle and produce a new cell with the clip
[const]Cell ptrclip_into(const Cell cell,
Layout ptr target,
const Box box)
Clips the given cell by the given rectangle and produce a new cell with the clip
[const]Cell ptrclip_into(const Cell cell,
Layout ptr target,
const DBox box)
Clips the given cell by the given rectangle and produce a new cell with the clip
unsigned intconvert_cell_to_static(unsigned int cell_index)Converts a PCell or library cell to a usual (static) cell
voidcopy_layer(unsigned int src,
unsigned int dest)
Copies a layer
voidcopy_layer(unsigned int src,
unsigned int dest,
unsigned int flags)
Copies a layer (selected shape types only)
voidcopy_meta_info(const Layout other)Copies the meta information from the other layout into this layout
voidcopy_meta_info(const Layout other,
const CellMapping cm)
Copies the meta information from the other layout into this layout for the cells given by the cell mapping
voidcopy_tree_shapes(const Layout source_layout,
const CellMapping cell_mapping)
Copies the shapes for all given mappings in the CellMapping object
voidcopy_tree_shapes(const Layout source_layout,
const CellMapping cell_mapping,
const LayerMapping layer_mapping)
Copies the shapes for all given mappings in the CellMapping object using the given layer mapping
Cell ptrcreate_cell(string name)Creates a cell with the given name
Cell ptrcreate_cell(string pcell_name,
map<string,variant> params)
Creates a cell as a PCell variant for the PCell with the given name
Cell ptrcreate_cell(string name,
string lib_name)
Creates a cell with the given name
Cell ptrcreate_cell(string pcell_name,
string lib_name,
map<string,variant> params)
Creates a cell for a PCell with the given PCell name from the given library
[const]doubledbuGets the database unit
voiddbu=(double dbu)Sets the database unit
voiddelete_cell(unsigned int cell_index)Deletes a cell
voiddelete_cell_rec(unsigned int cell_index)Deletes a cell plus all subcells
voiddelete_cells(unsigned int[] cell_index_list)Deletes multiple cells
voiddelete_layer(unsigned int layer_index)Deletes a layer
voiddelete_property(variant key)Deletes the user property with the given key
[const]new Layout ptrdupCreates a copy of self
[iter]Celleach_cellIterates the unsorted cell list
[iter]unsigned inteach_cell_bottom_upIterates the bottom-up sorted cell list
[iter]unsigned inteach_cell_top_downbegin iterator of the top-down sorted cell list
[const,iter]LayoutMetaInfoeach_meta_infoIterates over the meta information of the layout
[iter]unsigned inteach_top_cellIterates the top cells
voidend_changesCancels the "in changes" state (see "start_changes")
[const]unsigned interror_layerReturns the index of the error layer
variantfind_layer(const LayerInfo info)Finds a layer with the given properties
variantfind_layer(string name)Finds a layer with the given name
variantfind_layer(int layer,
int datatype)
Finds a layer with the given layer and datatype number
variantfind_layer(int layer,
int datatype,
string name)
Finds a layer with the given layer and datatype number and name
voidflatten(unsigned int cell_index,
int levels,
bool prune)
Flattens the given cell
voidflatten_into(unsigned int source_cell_index,
unsigned int target_cell_index,
const ICplxTrans trans,
int levels)
Flattens the given cell into another cell
[const]LayerInfoget_info(unsigned int index)Gets the info structure for a specified layer
[const]unsigned intguiding_shape_layerReturns the index of the guiding shape layer
boolhas_cell?(string name)Returns true if a cell with a given name exists
[const]boolhas_prop_id?Returns true, if the layout has user properties
voidinsert(unsigned int cell_index,
int layer,
const Region region)
Inserts a region into the given cell and layer
voidinsert(unsigned int cell_index,
int layer,
const Edges edges)
Inserts an edge collection into the given cell and layer
voidinsert(unsigned int cell_index,
int layer,
const EdgePairs edge_pairs)
Inserts an edge pair collection into the given cell and layer
voidinsert(unsigned int cell_index,
int layer,
const Texts texts)
Inserts an text collection into the given cell and layer
unsigned intinsert_layer(const LayerInfo props)Inserts a new layer with the given properties
voidinsert_layer_at(unsigned int index,
const LayerInfo props)
Inserts a new layer with the given properties at the given index
unsigned intinsert_special_layer(const LayerInfo props)Inserts a new special layer with the given properties
voidinsert_special_layer_at(unsigned int index,
const LayerInfo props)
Inserts a new special layer with the given properties at the given index
[const]boolis_editable?Returns a value indicating whether the layout is editable.
[const]boolis_free_layer?(unsigned int layer_index)Returns true, if a layer index is a free (unused) layer index
[const]boolis_special_layer?(unsigned int layer_index)Returns true, if a layer index is a special layer index
[const]boolis_valid_cell_index?(unsigned int cell_index)Returns true, if a cell index is a valid index
[const]boolis_valid_layer?(unsigned int layer_index)Returns true, if a layer index is a valid normal layout layer index
unsigned intlayerCreates a new internal layer
unsigned intlayer(const LayerInfo info)Finds or creates a layer with the given properties
unsigned intlayer(string name)Finds or creates a layer with the given name
unsigned intlayer(int layer,
int datatype)
Finds or creates a layer with the given layer and datatype number
unsigned intlayer(int layer,
int datatype,
string name)
Finds or creates a layer with the given layer and datatype number and name
[const]unsigned int[]layer_indexesGets a list of valid layer's indices
[const]LayerInfo[]layer_infosGets a list of valid layer's properties
[const]unsigned intlayersReturns the number of layers
[const]Library ptrlibraryGets the library this layout lives in or nil if the layout is not part of a library
voidmerge_meta_info(const Layout other)Merges the meta information from the other layout into this layout
voidmerge_meta_info(const Layout other,
const CellMapping cm)
Merges the meta information from the other layout into this layout for the cells given by the cell mapping
new LayoutMetaInfo ptrmeta_info(string name)Gets the meta information for a given name
variantmeta_info_value(string name)Gets the meta information value for a given name
voidmove_layer(unsigned int src,
unsigned int dest)
Moves a layer
voidmove_layer(unsigned int src,
unsigned int dest,
unsigned int flags)
Moves a layer (selected shape types only)
voidmove_tree_shapes(Layout source_layout,
const CellMapping cell_mapping)
Moves the shapes for all given mappings in the CellMapping object
voidmove_tree_shapes(Layout source_layout,
const CellMapping cell_mapping,
const LayerMapping layer_mapping)
Moves the shapes for all given mappings in the CellMapping object using the given layer mapping
unsigned int[]multi_clip(unsigned int cell,
Box[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
unsigned int[]multi_clip(unsigned int cell,
DBox[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
Cell ptr[]multi_clip(const Cell cell,
Box[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
Cell ptr[]multi_clip(const Cell cell,
DBox[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
unsigned int[]multi_clip_into(unsigned int cell,
Layout ptr target,
Box[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
unsigned int[]multi_clip_into(unsigned int cell,
Layout ptr target,
DBox[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
Cell ptr[]multi_clip_into(const Cell cell,
Layout ptr target,
Box[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
Cell ptr[]multi_clip_into(const Cell cell,
Layout ptr target,
DBox[] boxes)
Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.
[const]const PCellDeclaration ptrpcell_declaration(string name)Gets a reference to the PCell declaration for the PCell with the given name
[const]const PCellDeclaration ptrpcell_declaration(unsigned int pcell_id)Gets a reference to the PCell declaration for the PCell with the given PCell ID.
[const]unsigned intpcell_id(string name)Gets the ID of the PCell with the given name
[const]unsigned int[]pcell_idsGets the IDs of the PCells registered in the layout
[const]string[]pcell_namesGets the names of the PCells registered in the layout
[const]unsigned longprop_idGets the properties ID associated with the layout
voidprop_id=(unsigned long id)Sets the properties ID associated with the layout
[const]variantpropertiesGets the user properties as a hash
[const]variant[]properties(unsigned long properties_id)Gets the properties set for a given properties ID
unsigned longproperties_id(variant[] properties)Gets the properties ID for a given properties set
[const]variantproperty(variant key)Gets the user property with the given key
voidprune_cell(unsigned int cell_index,
int levels)
Deletes a cell plus subcells not used otherwise
voidprune_subcells(unsigned int cell_index,
int levels)
Deletes all sub cells of the cell which are not used otherwise down to the specified level of hierarchy
LayerMapread(string filename)Load the layout from the given file
LayerMapread(string filename,
const LoadLayoutOptions options)
Load the layout from the given file with options
voidrefreshCalls Cell#refresh on all cells inside this layout
unsigned intregister_pcell(string name,
PCellDeclaration ptr declaration)
Registers a PCell declaration under the given name
voidremove_meta_info(string name)Removes meta information from the layout
voidrename_cell(unsigned int index,
string name)
Renames the cell with given index
voidscale_and_snap(Cell cell,
int grid,
int mult,
int div)
Scales and snaps the layout below a given cell by the given rational factor and snaps to the given grid
voidscale_and_snap(unsigned int cell_index,
int grid,
int mult,
int div)
Scales and snaps the layout below a given cell by the given rational factor and snaps to the given grid
voidset_info(unsigned int index,
const LayerInfo props)
Sets the info structure for a specified layer
voidset_property(variant key,
variant value)
Sets the user property with the given key to the given value
voidstart_changesSignals the start of an operation bringing the layout into invalid state
voidswap_layers(unsigned int a,
unsigned int b)
Swap two layers
[const]const Technology ptrtechnologyGets the Technology object of the technology this layout is associated with or nil if the layout is not associated with a technology
[const]stringtechnology_nameGets the name of the technology this layout is associated with
voidtechnology_name=(string name)Sets the name of the technology this layout is associated with
Cell ptrtop_cellReturns the top cell object
[const]const Cell ptrtop_cellReturns the top cell object (const version)
Cell ptr[]top_cellsReturns the top cell objects
[const]const Cell ptr[]top_cellsReturns the top cell objects (const version)
voidtransform(const Trans trans)Transforms the layout with the given transformation
voidtransform(const ICplxTrans trans)Transforms the layout with the given complex integer transformation
voidtransform(const DTrans trans)Transforms the layout with the given transformation, which is in micrometer units
voidtransform(const DCplxTrans trans)Transforms the layout with the given complex integer transformation, which is in micrometer units
[const]boolunder_construction?Returns true if the layout object is under construction
[const]stringunique_cell_name(string name)Creates a new unique cell name from the given name
voidupdateUpdates the internals of the layout
voidwrite(string filename,
const SaveLayoutOptions options)
Writes the layout to a stream file
voidwrite(string filename)Writes the layout to a stream file

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

unsigned intadd_cell(string name)Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes(unsigned int cell_index,
unsigned int layer)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_overlapping(unsigned int cell_index,
unsigned int layer,
Box region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_overlapping(const Cell ptr cell_index,
unsigned int layer,
Box region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_overlapping(unsigned int cell_index,
unsigned int layer,
DBox region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_overlapping(const Cell ptr cell,
unsigned int layer,
DBox region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_touching(unsigned int cell_index,
unsigned int layer,
Box region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_touching(const Cell ptr cell,
unsigned int layer,
Box region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_touching(unsigned int cell_index,
unsigned int layer,
DBox region)
Use of this method is deprecated
[const]RecursiveShapeIteratorbegin_shapes_touching(const Cell ptr cell,
unsigned int layer,
DBox region)
Use of this method is deprecated
unsigned intcell_by_name(string name)Use of this method is deprecated
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]unsigned int[]layer_indicesUse of this method is deprecated. Use layer_indexes instead
voidwrite(string filename,
bool gzip,
const SaveLayoutOptions options)
Use of this method is deprecated

Detailed description

_const_cast

Signature: [const] Layout 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.

add_cell

Signature: unsigned int add_cell (string name)

Description: Adds a cell with the given name

Returns:The index of the newly created cell.

Use of this method is deprecated

From version 0.23 on this method is deprecated because another method exists which is more convenient because is returns a Cell object (create_cell).

add_lib_cell

Signature: unsigned int add_lib_cell (Library ptr library, unsigned int lib_cell_index)

Description: Imports a cell from the library

library:The reference to the library from which to import the cell
lib_cell_index:The index of the imported cell in the library
Returns:The cell index of the new proxy cell in this layout

This method imports the given cell from the library and creates a new proxy cell. The proxy cell acts as a pointer to the actual cell which still resides in the library (precisely: in library.layout). The name of the new cell will be the name of library cell.

This method has been introduced in version 0.22.

add_meta_info

Signature: void add_meta_info (const LayoutMetaInfo info)

Description: Adds meta information to the layout

See LayoutMetaInfo for details about layouts and meta information. This method has been introduced in version 0.25.

add_pcell_variant

(1) Signature: unsigned int add_pcell_variant (unsigned int pcell_id, map<string,variant> parameters)

Description: Creates a PCell variant for the given PCell ID with the parameters given as a name/value dictionary

Returns:The cell index of the pcell variant proxy cell

This method will create a PCell variant proxy for a local PCell definition. It will create the PCell variant for the given parameters. Note that this method does not allow one to create PCell instances for PCells located in a library. Use add_pcell_variant with the library parameter for that purpose. Unlike the variant using a list of parameters, this version allows specification of the parameters with a key/value dictionary. The keys are the parameter names as given by the PCell declaration.

The parameters are a sequence of variants which correspond to the parameters declared by the PCellDeclaration object.

The name of the new cell will be the name of the PCell. If a cell with that name already exists, a new unique name is generated.

This method has been introduced in version 0.22.

(2) Signature: unsigned int add_pcell_variant (unsigned int pcell_id, variant[] parameters)

Description: Creates a PCell variant for the given PCell ID with the given parameters

Returns:The cell index of the pcell variant proxy cell

This method will create a PCell variant proxy for a local PCell definition. It will create the PCell variant for the given parameters. Note that this method does not allow one to create PCell instances for PCells located in a library. Use add_pcell_variant with the library parameter for that purpose.

The parameters are a sequence of variants which correspond to the parameters declared by the PCellDeclaration object.

The name of the new cell will be the name of the PCell. If a cell with that name already exists, a new unique name is generated.

This method has been introduced in version 0.22.

(3) Signature: unsigned int add_pcell_variant (Library ptr library, unsigned int pcell_id, map<string,variant> parameters)

Description: Creates a PCell variant for a PCell located in an external library with the parameters given as a name/value dictionary

Returns:The cell index of the new proxy cell in this layout

This method will import a PCell from a library and create a variant for the given parameter set. Technically, this method creates a proxy to the library and creates the variant inside that library. Unlike the variant using a list of parameters, this version allows specification of the parameters with a key/value dictionary. The keys are the parameter names as given by the PCell declaration.

The parameters are a sequence of variants which correspond to the parameters declared by the PCellDeclaration object.

The name of the new cell will be the name of the PCell. If a cell with that name already exists, a new unique name is generated.

This method has been introduced in version 0.22.

(4) Signature: unsigned int add_pcell_variant (Library ptr library, unsigned int pcell_id, variant[] parameters)

Description: Creates a PCell variant for a PCell located in an external library

Returns:The cell index of the new proxy cell in this layout

This method will import a PCell from a library and create a variant for the given parameter set. Technically, this method creates a proxy to the library and creates the variant inside that library.

The parameters are a sequence of variants which correspond to the parameters declared by the PCellDeclaration object.

The name of the new cell will be the name of the PCell. If a cell with that name already exists, a new unique name is generated.

This method has been introduced in version 0.22.

assign

Signature: void assign (const Layout other)

Description: Assigns another object to self

begin_shapes

(1) Signature: [const] RecursiveShapeIterator begin_shapes (const Cell ptr cell, unsigned int layer)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer

cell:The cell object of the initial (top) cell
layer:The layer from which to get the shapes
Returns:A suitable iterator

For details see the description of the RecursiveShapeIterator class. This version is convenience overload which takes a cell object instead of a cell index.

This method is deprecated. Use Cell#begin_shapes_rec instead.

This method has been added in version 0.24.

(2) Signature: [const] RecursiveShapeIterator begin_shapes (unsigned int cell_index, unsigned int layer)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer

cell_index:The index of the initial (top) cell
layer:The layer from which to get the shapes
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class.

This method is deprecated. Use Cell#begin_shapes_rec instead.

This method has been added in version 0.18.

begin_shapes_overlapping

(1) Signature: [const] RecursiveShapeIterator begin_shapes_overlapping (unsigned int cell_index, unsigned int layer, Box region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box overlaps the given region.

This method is deprecated. Use Cell#begin_shapes_rec_overlapping instead.

This method has been added in version 0.18.

(2) Signature: [const] RecursiveShapeIterator begin_shapes_overlapping (const Cell ptr cell_index, unsigned int layer, Box region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

cell:The cell object for the starting cell
layer:The layer from which to get the shapes
region:The search region
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box overlaps the given region. It is convenience overload which takes a cell object instead of a cell index.

This method is deprecated. Use Cell#begin_shapes_rec_overlapping instead.

This method has been added in version 0.24.

(3) Signature: [const] RecursiveShapeIterator begin_shapes_overlapping (unsigned int cell_index, unsigned int layer, DBox region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search, the region given in micrometer units

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region as a DBox object in micrometer units
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box overlaps the given region.

This method is deprecated. Use Cell#begin_shapes_rec_overlapping instead.

This variant has been added in version 0.25.

(4) Signature: [const] RecursiveShapeIterator begin_shapes_overlapping (const Cell ptr cell, unsigned int layer, DBox region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search, the region given in micrometer units

cell:The cell object for the starting cell
layer:The layer from which to get the shapes
region:The search region as a DBox object in micrometer units
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box overlaps the given region. It is convenience overload which takes a cell object instead of a cell index.

This method is deprecated. Use Cell#begin_shapes_rec_overlapping instead.

This variant has been added in version 0.25.

begin_shapes_touching

(1) Signature: [const] RecursiveShapeIterator begin_shapes_touching (unsigned int cell_index, unsigned int layer, Box region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box touches the given region.

This method is deprecated. Use Cell#begin_shapes_rec_touching instead.

This method has been added in version 0.18.

(2) Signature: [const] RecursiveShapeIterator begin_shapes_touching (const Cell ptr cell, unsigned int layer, Box region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search

cell:The cell object for the starting cell
layer:The layer from which to get the shapes
region:The search region
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box touches the given region. It is convenience overload which takes a cell object instead of a cell index.

This method is deprecated. Use Cell#begin_shapes_rec_touching instead.

This method has been added in version 0.24.

(3) Signature: [const] RecursiveShapeIterator begin_shapes_touching (unsigned int cell_index, unsigned int layer, DBox region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search, the region given in micrometer units

cell_index:The index of the starting cell
layer:The layer from which to get the shapes
region:The search region as a DBox object in micrometer units
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box touches the given region.

This method is deprecated. Use Cell#begin_shapes_rec_touching instead.

This variant has been added in version 0.25.

(4) Signature: [const] RecursiveShapeIterator begin_shapes_touching (const Cell ptr cell, unsigned int layer, DBox region)

Description: Delivers a recursive shape iterator for the shapes below the given cell on the given layer using a region search, the region given in micrometer units

cell:The cell object for the starting cell
layer:The layer from which to get the shapes
region:The search region as a DBox object in micrometer units
Returns:A suitable iterator

Use of this method is deprecated

For details see the description of the RecursiveShapeIterator class. This version gives an iterator delivering shapes whose bounding box touches the given region. It is convenience overload which takes a cell object instead of a cell index.

This method is deprecated. Use Cell#begin_shapes_rec_touching instead.

This variant has been added in version 0.25.

break_polygons

(1) Signature: void break_polygons (unsigned long max_vertex_count, double max_area_ratio)

Description: Breaks the polygons of the layout into smaller ones

There are two criteria for splitting a polygon: a polygon is split into parts with less then 'max_vertex_count' points and an bounding box-to-polygon area ratio less than 'max_area_ratio'. The area ratio is supposed to render polygons whose bounding box is a better approximation. This applies for example to 'L' shape polygons.

Using a value of 0 for either limit means that the respective limit isn't checked. Breaking happens by cutting the polygons into parts at 'good' locations. The algorithm does not have a specific goal to minimize the number of parts for example. The only goal is to achieve parts within the given limits.

Breaking also applies to paths if their polygon representation satisfies the breaking criterion. In that case, paths are converted to polygons and broken into smaller parts.

This variant applies breaking to all cells and layers.

This method has been introduced in version 0.29.5.

(2) Signature: void break_polygons (unsigned int layer, unsigned long max_vertex_count, double max_area_ratio)

Description: Breaks the polygons of the layer into smaller ones

This variant applies breaking to all cells and the given layer.

This method has been introduced in version 0.29.5.

cell

(1) Signature: Cell ptr cell (string name)

Description: Gets a cell object from the cell name

name:The cell name
Returns:A reference to the cell (a Cell object)

If name is not a valid cell name, this method will return "nil". This method has been introduced in version 0.23 and replaces cell_by_name.

(2) Signature: [const] const Cell ptr cell (string name)

Description: Gets a cell object from the cell name (const version)

name:The cell name
Returns:A reference to the cell (a Cell object)

If name is not a valid cell name, this method will return "nil". This method has been introduced in version 0.23 and replaces cell_by_name.

This variant has been introduced in version 0.29.6.

(3) Signature: Cell ptr cell (unsigned int i)

Description: Gets a cell object from the cell index

i:The cell index
Returns:A reference to the cell (a Cell object)

If the cell index is not a valid cell index, this method will raise an error. Use is_valid_cell_index? to test whether a given cell index is valid.

(4) Signature: [const] const Cell ptr cell (unsigned int i)

Description: Gets a cell object from the cell index (const version)

i:The cell index
Returns:A reference to the cell (a Cell object)

If the cell index is not a valid cell index, this method will raise an error. Use is_valid_cell_index? to test whether a given cell index is valid.

This variant has been introduced in version 0.29.6.

cell_by_name

Signature: unsigned int cell_by_name (string name)

Description: Gets the cell index for a given name

Use of this method is deprecated

Returns the cell index for the cell with the given name. If no cell with this name exists, an exception is thrown. From version 0.23 on, a version of the cell method is provided which returns a Cell object for the cell with the given name or "nil" if the name is not valid. This method replaces cell_by_name and has_cell?

cell_name

Signature: [const] string cell_name (unsigned int index)

Description: Gets the name for a cell with the given index

cells

(1) Signature: [const] unsigned int cells

Description: Returns the number of cells

Returns:The number of cells (the maximum cell index)

(2) Signature: Cell ptr[] cells (string name_filter)

Description: Gets the cell objects for a given name filter

name_filter:The cell name filter (glob pattern)
Returns:A list of Cell object of the cells matching the pattern

This method has been introduced in version 0.27.3.

(3) Signature: [const] const Cell ptr[] cells (string name_filter)

Description: Gets the cell objects for a given name filter (const version)

name_filter:The cell name filter (glob pattern)
Returns:A list of Cell object of the cells matching the pattern

This method has been introduced in version 0.27.3.

This variant has been introduced in version 0.29.6.

cleanup

Signature: void cleanup (unsigned int[] cell_indexes_to_keep = [])

Description: Cleans up the layout

This method will remove proxy objects that are no longer in use. After changing PCell parameters such proxy objects may still be present in the layout and are cached for later reuse. Usually they are cleaned up automatically, but in a scripting context it may be useful to clean up these cells explicitly.

Use 'cell_indexes_to_keep' for specifying a list of cell indexes of PCell variants or library proxies you don't want to be cleaned up.

This method has been introduced in version 0.25.

clear

Signature: void clear

Description: Clears the layout

Clears the layout completely.

clear_all_meta_info

Signature: void clear_all_meta_info

Description: Clears all meta information of the layout (cell specific and global)

See LayoutMetaInfo for details about layouts and meta information. This method has been introduced in version 0.28.16.

clear_layer

(1) Signature: void clear_layer (unsigned int layer_index)

Description: Clears a layer

layer_index:The index of the layer to delete.

Clears the layer: removes all shapes.

This method was introduced in version 0.19.

(2) Signature: void clear_layer (unsigned int layer_index, unsigned int flags)

Description: Clears a layer (given shape types only)

layer_index:The index of the layer to delete.
flags:The type selector for the shapes to delete (see Shapes class, S... constants).

Clears the layer: removes all shapes for the given shape types.

This method was introduced in version 0.28.9.

clear_meta_info

Signature: void clear_meta_info

Description: Clears the meta information of the layout

See LayoutMetaInfo for details about layouts and meta information. This method has been introduced in version 0.28.8.

clip

(1) Signature: unsigned int clip (unsigned int cell, const Box box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell index of the cell to clip
box:The clip box in database units
Returns:The index of the new cell

This method will cut a rectangular region given by the box from the given cell. The clip will be stored in a new cell whose index is returned. The clip will be performed hierarchically. The resulting cell will hold a hierarchy of child cells, which are potentially clipped versions of child cells of the original cell. This method has been added in version 0.21.

(2) Signature: unsigned int clip (unsigned int cell, const DBox box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell index of the cell to clip
box:The clip box in micrometer units
Returns:The index of the new cell

This variant which takes a micrometer-unit box has been added in version 0.28.

(3) Signature: Cell ptr clip (const Cell cell, const Box box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell reference of the cell to clip
box:The clip box in database units
Returns:The reference to the new cell

This variant which takes cell references instead of cell indexes has been added in version 0.28.

(4) Signature: Cell ptr clip (const Cell cell, const DBox box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell reference of the cell to clip
box:The clip box in micrometer units
Returns:The reference to the new cell

This variant which takes a micrometer-unit box and cell references has been added in version 0.28.

clip_into

(1) Signature: [const] unsigned int clip_into (unsigned int cell, Layout ptr target, const Box box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell index of the cell to clip
box:The clip box in database units
target:The target layout
Returns:The index of the new cell in the target layout

This method will cut a rectangular region given by the box from the given cell. The clip will be stored in a new cell in the target layout. The clip will be performed hierarchically. The resulting cell will hold a hierarchy of child cells, which are potentially clipped versions of child cells of the original cell.

Please note that it is important that the database unit of the target layout is identical to the database unit of the source layout to achieve the desired results.This method also assumes that the target layout holds the same layers than the source layout. It will copy shapes to the same layers than they have been on the original layout. This method has been added in version 0.21.

(2) Signature: [const] unsigned int clip_into (unsigned int cell, Layout ptr target, const DBox box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The cell index of the cell to clip
box:The clip box in micrometer units
target:The target layout
Returns:The index of the new cell in the target layout

This variant which takes a micrometer-unit box has been added in version 0.28.

(3) Signature: [const] Cell ptr clip_into (const Cell cell, Layout ptr target, const Box box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The reference to the cell to clip
box:The clip box in database units
target:The target layout
Returns:The reference to the new cell in the target layout

This variant which takes cell references instead of cell indexes has been added in version 0.28.

(4) Signature: [const] Cell ptr clip_into (const Cell cell, Layout ptr target, const DBox box)

Description: Clips the given cell by the given rectangle and produce a new cell with the clip

cell:The reference to the cell to clip
box:The clip box in micrometer units
target:The target layout
Returns:The reference to the new cell in the target layout

This variant which takes a micrometer-unit box and cell references has been added in version 0.28.

convert_cell_to_static

Signature: unsigned int convert_cell_to_static (unsigned int cell_index)

Description: Converts a PCell or library cell to a usual (static) cell

Returns:The index of the new cell

This method will create a new cell which contains the static representation of the PCell or library proxy given by "cell_index". If that cell is not a PCell or library proxy, it won't be touched and the input cell index is returned.

This method has been added in version 0.23.

copy_layer

(1) Signature: void copy_layer (unsigned int src, unsigned int dest)

Description: Copies a layer

src:The layer index of the source layer.
dest:The layer index of the destination layer.

Copies a layer from the source to the destination layer. The destination layer is not cleared before, so that this method merges shapes from the source with the destination layer.

This method was introduced in version 0.19.

(2) Signature: void copy_layer (unsigned int src, unsigned int dest, unsigned int flags)

Description: Copies a layer (selected shape types only)

src:The layer index of the source layer.
dest:The layer index of the destination layer.
flags:A combination of the shape type flags from Shapes, S... constants

Copies a layer from the source to the destination layer. The destination layer is not cleared before, so that this method merges shapes from the source with the destination layer.

This method variant has been introduced in version 0.28.9.

copy_meta_info

(1) Signature: void copy_meta_info (const Layout other)

Description: Copies the meta information from the other layout into this layout

See LayoutMetaInfo for details about cells and meta information. The meta information from this layout will be replaced by the meta information from the other layout.

This method has been introduced in version 0.28.16.

(2) Signature: void copy_meta_info (const Layout other, const CellMapping cm)

Description: Copies the meta information from the other layout into this layout for the cells given by the cell mapping

See LayoutMetaInfo for details about cells and meta information. This method will use the source/target cell pairs from the cell mapping object and merge the meta information from each source cell from the 'other' layout into the mapped cell inside self. This method can be used with 'copy_tree_shapes' and similar to copy meta information in addition to the shapes. All cell-specific keys in this layout will be replaced by the respective values from the other layout.

This method has been introduced in version 0.28.16.

copy_tree_shapes

(1) Signature: void copy_tree_shapes (const Layout source_layout, const CellMapping cell_mapping)

Description: Copies the shapes for all given mappings in the CellMapping object

source_layout:The layout where to take the shapes from
cell_mapping:The cell mapping object that determines how cells are identified between source and target layout

Provide a CellMapping object to specify pairs of cells which are mapped from the source layout to this layout. When constructing such a cell mapping object for example with CellMapping#for_multi_cells_full, use self as the target layout. During the cell mapping construction, the cell mapper will usually create a suitable target hierarchy already. After having completed the cell mapping, use copy_tree_shapes to copy over the shapes from the source to the target layout.

This method has been added in version 0.26.8.

(2) Signature: void copy_tree_shapes (const Layout source_layout, const CellMapping cell_mapping, const LayerMapping layer_mapping)

Description: Copies the shapes for all given mappings in the CellMapping object using the given layer mapping

source_layout:The layout where to take the shapes from
cell_mapping:The cell mapping object that determines how cells are identified between source and target layout
layer_mapping:Specifies which layers are copied from the source layout to the target layout

Provide a CellMapping object to specify pairs of cells which are mapped from the source layout to this layout. When constructing such a cell mapping object for example with CellMapping#for_multi_cells_full, use self as the target layout. During the cell mapping construction, the cell mapper will usually create a suitable target hierarchy already. After having completed the cell mapping, use copy_tree_shapes to copy over the shapes from the source to the target layout.

This method has been added in version 0.26.8.

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.

create_cell

(1) Signature: Cell ptr create_cell (string name)

Description: Creates a cell with the given name

name:The name of the cell to create
Returns:The Cell object of the newly created cell.

If a cell with that name already exists, the unique name will be chosen for the new cell consisting of the given name plus a suitable suffix.

This method has been introduce in version 0.23 and replaces add_cell.

(2) Signature: Cell ptr create_cell (string pcell_name, map<string,variant> params)

Description: Creates a cell as a PCell variant for the PCell with the given name

pcell_name:The name of the PCell and also the name of the cell to create
params:The PCell parameters (key/value dictionary)
Returns:The Cell object of the newly created cell or an existing cell if the PCell has already been used with these parameters.

PCells are instantiated by creating a PCell variant. A PCell variant is linked to the PCell and represents this PCell with a particular parameter set.

This method will look up the PCell by the PCell name and create a new PCell variant for the given parameters. If the PCell has already been instantiated with the same parameters, the original variant will be returned. Hence this method is not strictly creating a cell - only if the required variant has not been created yet.

The parameters are specified as a key/value dictionary with the names being the ones from the PCell declaration.

If no PCell with the given name exists, nil is returned.

This method has been introduce in version 0.24.

(3) Signature: Cell ptr create_cell (string name, string lib_name)

Description: Creates a cell with the given name

name:The name of the library cell and the name of the cell to create
lib_name:The name of the library where to take the cell from
Returns:The Cell object of the newly created cell or an existing cell if the library cell has already been used in this layout.

Library cells are imported by creating a 'library proxy'. This is a cell which represents the library cell in the framework of the current layout. The library proxy is linked to the library and will be updated if the library cell is changed.

This method will look up the cell by the given name in the specified library and create a new library proxy for this cell. If the same library cell has already been used, the original library proxy is returned. Hence, strictly speaking this method does not always create a new cell but may return a reference to an existing cell.

If the library name is not valid, nil is returned.

This method has been introduce in version 0.24.

(4) Signature: Cell ptr create_cell (string pcell_name, string lib_name, map<string,variant> params)

Description: Creates a cell for a PCell with the given PCell name from the given library

pcell_name:The name of the PCell and also the name of the cell to create
lib_name:The name of the library where to take the PCell from
params:The PCell parameters (key/value dictionary)
Returns:The Cell object of the newly created cell or an existing cell if this PCell has already been used with the given parameters

This method will look up the PCell by the PCell name in the specified library and create a new PCell variant for the given parameters plus the library proxy. The parameters must be specified as a key/value dictionary with the names being the ones from the PCell declaration.

If no PCell with the given name exists or the library name is not valid, nil is returned. Note that this function - despite the name - may not always create a new cell, but return an existing cell if the PCell from the library has already been used with the given parameters.

This method has been introduce in version 0.24.

dbu

Signature: [const] double dbu

Description: Gets the database unit

The database unit is the value of one units distance in micrometers. For numerical reasons and to be compliant with the GDS2 format, the database objects use integer coordinates. The basic unit of these coordinates is the database unit. You can convert coordinates to micrometers by multiplying the integer value with the database unit. Typical values for the database unit are 0.001 micrometer (one nanometer).

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

dbu=

Signature: void dbu= (double dbu)

Description: Sets the database unit

See dbu for a description of the database unit.

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

delete_cell

Signature: void delete_cell (unsigned int cell_index)

Description: Deletes a cell

cell_index:The index of the cell to delete

This deletes a cell but not the sub cells of the cell. These subcells will likely become new top cells unless they are used otherwise. All instances of this cell are deleted as well. Hint: to delete multiple cells, use "delete_cells" which is far more efficient in this case.

This method has been introduced in version 0.20.

delete_cell_rec

Signature: void delete_cell_rec (unsigned int cell_index)

Description: Deletes a cell plus all subcells

cell_index:The index of the cell to delete

This deletes a cell and also all sub cells of the cell. In contrast to prune_cell, all cells are deleted together with their instances even if they are used otherwise.

This method has been introduced in version 0.20.

delete_cells

Signature: void delete_cells (unsigned int[] cell_index_list)

Description: Deletes multiple cells

cell_index_list:An array of cell indices of the cells to delete

This deletes the cells but not the sub cells of these cells. These subcells will likely become new top cells unless they are used otherwise. All instances of these cells are deleted as well.

This method has been introduced in version 0.20.

delete_layer

Signature: void delete_layer (unsigned int layer_index)

Description: Deletes a layer

layer_index:The index of the layer to delete.

This method frees the memory allocated for the shapes of this layer and remembers the layer's index for reuse when the next layer is allocated.

delete_property

Signature: void delete_property (variant key)

Description: Deletes the user property with the given key

This method is a convenience method that deletes the property with the given key. It does nothing if no property with that key exists. Using that method is more convenient than creating a new property set with a new ID and assigning that properties ID. This method may change the properties ID.

This method has been introduced in version 0.24.

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.

dup

Signature: [const] new Layout ptr dup

Description: Creates a copy of self

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

each_cell

Signature: [iter] Cell each_cell

Description: Iterates the unsorted cell list

each_cell_bottom_up

Signature: [iter] unsigned int each_cell_bottom_up

Description: Iterates the bottom-up sorted cell list

In bottom-up traversal a cell is not delivered before the last child cell of this cell has been delivered. The bottom-up iterator does not deliver cells but cell indices actually.

each_cell_top_down

Signature: [iter] unsigned int each_cell_top_down

Description: begin iterator of the top-down sorted cell list

The top-down cell list has the property of delivering all cells before they are instantiated. In addition the first cells are all top cells. There is at least one top cell. The top-down iterator does not deliver cells but cell indices actually.

each_meta_info

Signature: [const,iter] LayoutMetaInfo each_meta_info

Description: Iterates over the meta information of the layout

See LayoutMetaInfo for details about layouts and meta information.

This method has been introduced in version 0.25.

each_top_cell

Signature: [iter] unsigned int each_top_cell

Description: Iterates the top cells

A layout may have an arbitrary number of top cells. The usual case however is that there is one top cell.

end_changes

Signature: void end_changes

Description: Cancels the "in changes" state (see "start_changes")

error_layer

Signature: [const] unsigned int error_layer

Description: Returns the index of the error layer

The error layer is used to place error texts on it, for example when a PCell evaluation fails.

This method has been added in version 0.23.13.

find_layer

(1) Signature: variant find_layer (const LayerInfo info)

Description: Finds a layer with the given properties

If a layer with the given properties already exists, this method will return the index of that layer.If no such layer exists, it will return nil.

In contrast to layer, this method will also find layers matching by name only. For example:

# finds layer '17/0' and 'name (17/0)':
index = layout.find_layer(RBA::LayerInfo::new(17, 0))
# finds layer 'name' (first priority), but also 'name (17/0)' (second priority):
index = layout.find_layer(RBA::LayerInfo::new('name'))
# note that this will not match layer 'name (17/0)' and create a new name-only layer:
index = layout.layer(RBA::LayerInfo::new('name'))

This method has been introduced in version 0.23 and has been extended to name queries in version 0.28.11.

(2) Signature: variant find_layer (string name)

Description: Finds a layer with the given name

If a layer with the given name already exists, this method will return the index of that layer.If no such layer exists, it will return nil.

In contrast to layer, this method will also find numbered layers if the name matches. For example:

# finds layer 'name' (first priority), but also 'name (17/0)' (second priority):
index = layout.find_layer('name')
# note that this will not match layer 'name (17/0)' and create a new name-only layer:
index = layout.layer('name')

This method has been introduced in version 0.23 and has been extended to name queries in version 0.28.11.

(3) Signature: variant find_layer (int layer, int datatype)

Description: Finds a layer with the given layer and datatype number

If a layer with the given layer/datatype already exists, this method will return the index of that layer.If no such layer exists, it will return nil.

This method has been introduced in version 0.23.

(4) Signature: variant find_layer (int layer, int datatype, string name)

Description: Finds a layer with the given layer and datatype number and name

If a layer with the given layer/datatype/name already exists, this method will return the index of that layer.If no such layer exists, it will return nil.

This method has been introduced in version 0.23.

flatten

Signature: void flatten (unsigned int cell_index, int levels, bool prune)

Description: Flattens the given cell

cell_index:The cell which should be flattened
levels:The number of hierarchy levels to flatten (-1: all, 0: none, 1: one level etc.)
prune:Set to true to remove orphan cells.

This method propagates all shapes and instances from the specified number of hierarchy levels below into the given cell. It also removes the instances of the cells from which the shapes came from, but does not remove the cells themselves if prune is set to false. If prune is set to true, these cells are removed if not used otherwise.

This method has been introduced in version 0.20.

flatten_into

Signature: void flatten_into (unsigned int source_cell_index, unsigned int target_cell_index, const ICplxTrans trans, int levels)

Description: Flattens the given cell into another cell

source_cell_index:The source cell which should be flattened
target_cell_index:The target cell into which the resulting objects are written
trans:The transformation to apply on the output shapes and instances
levels:The number of hierarchy levels to flatten (-1: all, 0: none, 1: one level etc.)

This method works like 'flatten', but allows specification of a target cell which can be different from the source cell plus a transformation which is applied for all shapes and instances in the target cell.

In contrast to the 'flatten' method, the source cell is not modified.

This method has been introduced in version 0.24.

get_info

Signature: [const] LayerInfo get_info (unsigned int index)

Description: Gets the info structure for a specified layer

If the layer index is not a valid layer index, an empty LayerProperties object will be returned.

guiding_shape_layer

Signature: [const] unsigned int guiding_shape_layer

Description: Returns the index of the guiding shape layer

The guiding shape layer is used to store guiding shapes for PCells.

This method has been added in version 0.22.

has_cell?

Signature: bool has_cell? (string name)

Description: Returns true if a cell with a given name exists

Returns true, if the layout has a cell with the given name

has_prop_id?

Signature: [const] bool has_prop_id?

Description: Returns true, if the layout has user properties

This method has been introduced in version 0.24.

insert

(1) Signature: void insert (unsigned int cell_index, int layer, const Region region)

Description: Inserts a region into the given cell and layer

If the region is (conceptionally) a flat region, it will be inserted into the cell's shapes list as a flat sequence of polygons. If the region is a deep (hierarchical) region, it will create a subhierarchy below the given cell and its shapes will be put into the respective cells. Suitable subcells will be picked for inserting the shapes. If a hierarchy already exists below the given cell, the algorithm will try to reuse this hierarchy.

This method has been introduced in version 0.26.

(2) Signature: void insert (unsigned int cell_index, int layer, const Edges edges)

Description: Inserts an edge collection into the given cell and layer

If the edge collection is (conceptionally) flat, it will be inserted into the cell's shapes list as a flat sequence of edges. If the edge collection is deep (hierarchical), it will create a subhierarchy below the given cell and its edges will be put into the respective cells. Suitable subcells will be picked for inserting the edges. If a hierarchy already exists below the given cell, the algorithm will try to reuse this hierarchy.

This method has been introduced in version 0.26.

(3) Signature: void insert (unsigned int cell_index, int layer, const EdgePairs edge_pairs)

Description: Inserts an edge pair collection into the given cell and layer

If the edge pair collection is (conceptionally) flat, it will be inserted into the cell's shapes list as a flat sequence of edge pairs. If the edge pair collection is deep (hierarchical), it will create a subhierarchy below the given cell and its edge pairs will be put into the respective cells. Suitable subcells will be picked for inserting the edge pairs. If a hierarchy already exists below the given cell, the algorithm will try to reuse this hierarchy.

This method has been introduced in version 0.27.

(4) Signature: void insert (unsigned int cell_index, int layer, const Texts texts)

Description: Inserts an text collection into the given cell and layer

If the text collection is (conceptionally) flat, it will be inserted into the cell's shapes list as a flat sequence of texts. If the text collection is deep (hierarchical), it will create a subhierarchy below the given cell and its texts will be put into the respective cells. Suitable subcells will be picked for inserting the texts. If a hierarchy already exists below the given cell, the algorithm will try to reuse this hierarchy.

This method has been introduced in version 0.27.

insert_layer

Signature: unsigned int insert_layer (const LayerInfo props)

Description: Inserts a new layer with the given properties

Returns:The index of the newly created layer

insert_layer_at

Signature: void insert_layer_at (unsigned int index, const LayerInfo props)

Description: Inserts a new layer with the given properties at the given index

This method will associate the given layer info with the given layer index. If a layer with that index already exists, this method will change the properties of the layer with that index. Otherwise a new layer is created.

insert_special_layer

Signature: unsigned int insert_special_layer (const LayerInfo props)

Description: Inserts a new special layer with the given properties

Returns:The index of the newly created layer

Special layers can be used to represent objects that should not participate in normal viewing or other related operations. Special layers are not reported as valid layers.

insert_special_layer_at

Signature: void insert_special_layer_at (unsigned int index, const LayerInfo props)

Description: Inserts a new special layer with the given properties at the given index

See insert_special_layer for a description of special layers.

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.

is_editable?

Signature: [const] bool is_editable?

Description: Returns a value indicating whether the layout is editable.

Returns:True, if the layout is editable.

If a layout is editable, in general manipulation methods are enabled and some optimizations are disabled (i.e. shape arrays are expanded).

This method has been introduced in version 0.22.

is_free_layer?

Signature: [const] bool is_free_layer? (unsigned int layer_index)

Description: Returns true, if a layer index is a free (unused) layer index

Returns:true, if this is the case

This method has been introduced in version 0.26.

is_special_layer?

Signature: [const] bool is_special_layer? (unsigned int layer_index)

Description: Returns true, if a layer index is a special layer index

Returns:true, if this is the case

is_valid_cell_index?

Signature: [const] bool is_valid_cell_index? (unsigned int cell_index)

Description: Returns true, if a cell index is a valid index

Returns:true, if this is the case

This method has been added in version 0.20.

is_valid_layer?

Signature: [const] bool is_valid_layer? (unsigned int layer_index)

Description: Returns true, if a layer index is a valid normal layout layer index

Returns:true, if this is the case

layer

(1) Signature: unsigned int layer

Description: Creates a new internal layer

This method will create a new internal layer and return the layer index for this layer. The layer does not have any properties attached to it. That means, it is not going to be saved to a layout file unless it is given database properties with set_info.

This method is equivalent to "layer(RBA::LayerInfo::new())".

This method has been introduced in version 0.25.

(2) Signature: unsigned int layer (const LayerInfo info)

Description: Finds or creates a layer with the given properties

If a layer with the given properties already exists, this method will return the index of that layer.If no such layer exists, a new one with these properties will be created and its index will be returned. If "info" is anonymous (info.anonymous? is true), a new layer will always be created.

This method has been introduced in version 0.23.

(3) Signature: unsigned int layer (string name)

Description: Finds or creates a layer with the given name

If a layer with the given name already exists, this method will return the index of that layer.If no such layer exists, a new one with this name will be created and its index will be returned.

This method has been introduced in version 0.23.

(4) Signature: unsigned int layer (int layer, int datatype)

Description: Finds or creates a layer with the given layer and datatype number

If a layer with the given layer/datatype already exists, this method will return the index of that layer.If no such layer exists, a new one with these properties will be created and its index will be returned.

This method has been introduced in version 0.23.

(5) Signature: unsigned int layer (int layer, int datatype, string name)

Description: Finds or creates a layer with the given layer and datatype number and name

If a layer with the given layer/datatype/name already exists, this method will return the index of that layer.If no such layer exists, a new one with these properties will be created and its index will be returned.

This method has been introduced in version 0.23.

layer_indexes

Signature: [const] unsigned int[] layer_indexes

Description: Gets a list of valid layer's indices

This method returns an array with layer indices representing valid layers.

This method has been introduced in version 0.19.

layer_indices

Signature: [const] unsigned int[] layer_indices

Description: Gets a list of valid layer's indices

Use of this method is deprecated. Use layer_indexes instead

This method returns an array with layer indices representing valid layers.

This method has been introduced in version 0.19.

layer_infos

Signature: [const] LayerInfo[] layer_infos

Description: Gets a list of valid layer's properties

The method returns an array with layer properties representing valid layers. The sequence and length of this list corresponds to that of layer_indexes.

This method has been introduced in version 0.25.

layers

Signature: [const] unsigned int layers

Description: Returns the number of layers

The number of layers reports the maximum (plus 1) layer index used so far. Not all of the layers with an index in the range of 0 to layers-1 needs to be a valid layer. These layers can be either valid, special or unused. Use is_valid_layer? and is_special_layer? to test for the first two states.

library

Signature: [const] Library ptr library

Description: Gets the library this layout lives in or nil if the layout is not part of a library

This attribute has been introduced in version 0.27.5.

merge_meta_info

(1) Signature: void merge_meta_info (const Layout other)

Description: Merges the meta information from the other layout into this layout

See LayoutMetaInfo for details about cells and meta information. Existing keys in this layout will be overwritten by the respective values from the other layout. New keys will be added.

This method has been introduced in version 0.28.16.

(2) Signature: void merge_meta_info (const Layout other, const CellMapping cm)

Description: Merges the meta information from the other layout into this layout for the cells given by the cell mapping

See LayoutMetaInfo for details about cells and meta information. This method will use the source/target cell pairs from the cell mapping object and merge the meta information from each source cell from the 'other' layout into the mapped cell inside self. This method can be used with 'copy_tree_shapes' and similar to copy meta information in addition to the shapes. Existing cell-specific keys in this layout will be overwritten by the respective values from the other layout. New keys will be added.

This method has been introduced in version 0.28.16.

meta_info

Signature: new LayoutMetaInfo ptr meta_info (string name)

Description: Gets the meta information for a given name

See LayoutMetaInfo for details about layouts and meta information.

If no meta information with the given name exists, nil is returned.

This method has been introduced in version 0.28.8.

meta_info_value

Signature: variant meta_info_value (string name)

Description: Gets the meta information value for a given name

See LayoutMetaInfo for details about layouts and meta information.

If no meta information with the given name exists, a nil value will be returned. A more generic version that delivers all fields of the meta information is meta_info.

This method has been introduced in version 0.25. Starting with version 0.28.8, the value is of variant type instead of string only.

move_layer

(1) Signature: void move_layer (unsigned int src, unsigned int dest)

Description: Moves a layer

src:The layer index of the source layer.
dest:The layer index of the destination layer.

Moves a layer from the source to the destination layer. The target is not cleared before, so that this method merges shapes from the source with the destination layer. The source layer is empty after that operation.

This method was introduced in version 0.19.

(2) Signature: void move_layer (unsigned int src, unsigned int dest, unsigned int flags)

Description: Moves a layer (selected shape types only)

src:The layer index of the source layer.
dest:The layer index of the destination layer.
flags:A combination of the shape type flags from Shapes, S... constants

Moves a layer from the source to the destination layer. The target is not cleared before, so that this method merges shapes from the source with the destination layer. The copied shapes are removed from the source layer.

This method variant has been introduced in version 0.28.9.

move_tree_shapes

(1) Signature: void move_tree_shapes (Layout source_layout, const CellMapping cell_mapping)

Description: Moves the shapes for all given mappings in the CellMapping object

This method acts like the corresponding copy_tree_shapes method, but removes the shapes from the source layout after they have been copied.

This method has been added in version 0.26.8.

(2) Signature: void move_tree_shapes (Layout source_layout, const CellMapping cell_mapping, const LayerMapping layer_mapping)

Description: Moves the shapes for all given mappings in the CellMapping object using the given layer mapping

This method acts like the corresponding copy_tree_shapes method, but removes the shapes from the source layout after they have been copied.

This method has been added in version 0.26.8.

multi_clip

(1) Signature: unsigned int[] multi_clip (unsigned int cell, Box[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The cell index of the cell to clip
boxes:The clip boxes in database units
Returns:The indexes of the new cells

This method will cut rectangular regions given by the boxes from the given cell. The clips will be stored in a new cells whose indexed are returned. The clips will be performed hierarchically. The resulting cells will hold a hierarchy of child cells, which are potentially clipped versions of child cells of the original cell. This version is somewhat more efficient than doing individual clips because the clip cells may share clipped versions of child cells.

This method has been added in version 0.21.

(2) Signature: unsigned int[] multi_clip (unsigned int cell, DBox[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The cell index of the cell to clip
boxes:The clip boxes in micrometer units
Returns:The indexes of the new cells

This variant which takes micrometer-unit boxes has been added in version 0.28.

(3) Signature: Cell ptr[] multi_clip (const Cell cell, Box[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The reference to the cell to clip
boxes:The clip boxes in database units
Returns:The references to the new cells

This variant which takes cell references has been added in version 0.28.

(4) Signature: Cell ptr[] multi_clip (const Cell cell, DBox[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The reference to the cell to clip
boxes:The clip boxes in micrometer units
Returns:The references to the new cells

This variant which takes cell references and micrometer-unit boxes has been added in version 0.28.

multi_clip_into

(1) Signature: unsigned int[] multi_clip_into (unsigned int cell, Layout ptr target, Box[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The cell index of the cell to clip
boxes:The clip boxes in database units
target:The target layout
Returns:The indexes of the new cells

This method will cut rectangular regions given by the boxes from the given cell. The clips will be stored in a new cells in the given target layout. The clips will be performed hierarchically. The resulting cells will hold a hierarchy of child cells, which are potentially clipped versions of child cells of the original cell. This version is somewhat more efficient than doing individual clips because the clip cells may share clipped versions of child cells.

Please note that it is important that the database unit of the target layout is identical to the database unit of the source layout to achieve the desired results. This method also assumes that the target layout holds the same layers than the source layout. It will copy shapes to the same layers than they have been on the original layout.

This method has been added in version 0.21.

(2) Signature: unsigned int[] multi_clip_into (unsigned int cell, Layout ptr target, DBox[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The cell index of the cell to clip
boxes:The clip boxes in database units
target:The target layout
Returns:The indexes of the new cells

This variant which takes micrometer-unit boxes has been added in version 0.28.

(3) Signature: Cell ptr[] multi_clip_into (const Cell cell, Layout ptr target, Box[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The reference the cell to clip
boxes:The clip boxes in database units
target:The target layout
Returns:The references to the new cells

This variant which takes cell references boxes has been added in version 0.28.

(4) Signature: Cell ptr[] multi_clip_into (const Cell cell, Layout ptr target, DBox[] boxes)

Description: Clips the given cell by the given rectangles and produces new cells with the clips, one for each rectangle.

cell:The reference the cell to clip
boxes:The clip boxes in micrometer units
target:The target layout
Returns:The references to the new cells

This variant which takes cell references and micrometer-unit boxes has been added in version 0.28.

new

(1) Signature: [static] new Layout ptr new (Manager manager)

Description: Creates a layout object attached to a manager

This constructor specifies a manager object which is used to store undo information for example.

Starting with version 0.25, layouts created with the default constructor are always editable. Before that version, they inherited the editable flag from the application.

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

(2) Signature: [static] new Layout ptr new

Description: Creates a layout object

Starting with version 0.25, layouts created with the default constructor are always editable. Before that version, they inherited the editable flag from the application.

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

(3) Signature: [static] new Layout ptr new (bool editable, Manager manager)

Description: Creates a layout object attached to a manager

This constructor specifies a manager object which is used to store undo information for example. It also allows one to specify whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods.

This method was introduced in version 0.22.

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

(4) Signature: [static] new Layout ptr new (bool editable)

Description: Creates a layout object

This constructor specifies whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods.

This method was introduced in version 0.22.

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

pcell_declaration

(1) Signature: [const] const PCellDeclaration ptr pcell_declaration (string name)

Description: Gets a reference to the PCell declaration for the PCell with the given name

Returns a reference to the local PCell declaration with the given name. If the name is not a valid PCell name, this method returns nil.

Usually this method is used on library layouts that define PCells. Note that this method cannot be used on the layouts using the PCell from a library.

This method has been introduced in version 0.22.

(2) Signature: [const] const PCellDeclaration ptr pcell_declaration (unsigned int pcell_id)

Description: Gets a reference to the PCell declaration for the PCell with the given PCell ID.

Returns a reference to the local PCell declaration with the given PCell id. If the parameter is not a valid PCell ID, this method returns nil. The PCell ID is the number returned by register_pcell for example.

Usually this method is used on library layouts that define PCells. Note that this method cannot be used on the layouts using the PCell from a library.

This method has been introduced in version 0.22.

pcell_id

Signature: [const] unsigned int pcell_id (string name)

Description: Gets the ID of the PCell with the given name

This method is equivalent to 'pcell_declaration(name).id'.

This method has been introduced in version 0.22.

pcell_ids

Signature: [const] unsigned int[] pcell_ids

Description: Gets the IDs of the PCells registered in the layout

Returns an array of PCell IDs.

This method has been introduced in version 0.24.

pcell_names

Signature: [const] string[] pcell_names

Description: Gets the names of the PCells registered in the layout

Returns an array of PCell names.

This method has been introduced in version 0.24.

prop_id

Signature: [const] unsigned long prop_id

Description: Gets the properties ID associated with the layout

This method has been introduced in version 0.24.

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

prop_id=

Signature: void prop_id= (unsigned long id)

Description: Sets the properties ID associated with the layout

This method is provided, if a properties ID has been derived already. Usually it's more convenient to use delete_property, set_property or property.

This method has been introduced in version 0.24.

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

properties

(1) Signature: [const] variant properties

Description: Gets the user properties as a hash

This method is a convenience method that gets all user properties as a single hash.

This method has been introduced in version 0.29.5.

(2) Signature: [const] variant[] properties (unsigned long properties_id)

Description: Gets the properties set for a given properties ID

properties_id:The properties ID to get the properties for
Returns:The array of variants (see properties_id)

Basically performs the backward conversion of the 'properties_id' method. Given a properties ID, returns the properties set as an array of pairs of variants. In this array, each key and the value are stored as pairs (arrays with two elements). If the properties ID is not valid, an empty array is returned.

properties_id

Signature: unsigned long properties_id (variant[] properties)

Description: Gets the properties ID for a given properties set

properties:The array of pairs of variants (both elements can be integer, double or string)
Returns:The unique properties ID for that set

Before a set of properties can be attached to a shape, it must be converted into an ID that is unique for that set. The properties set must be given as a list of pairs of variants, each pair describing a name and a value. The name acts as the key for the property and does not need to be a string (it can be an integer or double value as well). The backward conversion can be performed with the 'properties' method.

property

Signature: [const] variant property (variant key)

Description: Gets the user property with the given key

This method is a convenience method that gets the property with the given key. If no property with that key exists, it will return nil. Using that method is more convenient than using the properties ID to retrieve the property value. This method has been introduced in version 0.24.

prune_cell

Signature: void prune_cell (unsigned int cell_index, int levels)

Description: Deletes a cell plus subcells not used otherwise

cell_index:The index of the cell to delete
levels:The number of hierarchy levels to consider (-1: all, 0: none, 1: one level etc.)

This deletes a cell and also all sub cells of the cell which are not used otherwise. The number of hierarchy levels to consider can be specified as well. One level of hierarchy means that only the direct children of the cell are deleted with the cell itself. All instances of this cell are deleted as well.

This method has been introduced in version 0.20.

prune_subcells

Signature: void prune_subcells (unsigned int cell_index, int levels)

Description: Deletes all sub cells of the cell which are not used otherwise down to the specified level of hierarchy

cell_index:The root cell from which to delete a sub cells
levels:The number of hierarchy levels to consider (-1: all, 0: none, 1: one level etc.)

This deletes all sub cells of the cell which are not used otherwise. All instances of the deleted cells are deleted as well. It is possible to specify how many levels of hierarchy below the given root cell are considered.

This method has been introduced in version 0.20.

read

(1) Signature: LayerMap read (string filename)

Description: Load the layout from the given file

filename:The name of the file to load.
Returns:A layer map that contains the mapping used by the reader including the layers that have been created.

The format of the file is determined automatically and automatic unzipping is provided. No particular options can be specified.

This method has been added in version 0.18.

(2) Signature: LayerMap read (string filename, const LoadLayoutOptions options)

Description: Load the layout from the given file with options

filename:The name of the file to load.
options:The options object specifying further options for the reader.
Returns:A layer map that contains the mapping used by the reader including the layers that have been created.

The format of the file is determined automatically and automatic unzipping is provided. In this version, some reader options can be specified.

This method has been added in version 0.18.

refresh

Signature: void refresh

Description: Calls Cell#refresh on all cells inside this layout

This method is useful to recompute all PCells from a layout. Note that this does not update PCells which are linked from a library. To recompute PCells from a library, you need to use Library#refresh on the library object from which the PCells are imported.

This method has been introduced in version 0.27.9.

register_pcell

Signature: unsigned int register_pcell (string name, PCellDeclaration ptr declaration)

Description: Registers a PCell declaration under the given name

Registers a local PCell in the current layout. If a declaration with that name already exists, it is replaced with the new declaration.

This method has been introduced in version 0.22.

remove_meta_info

Signature: void remove_meta_info (string name)

Description: Removes meta information from the layout

See LayoutMetaInfo for details about layouts and meta information. This method has been introduced in version 0.25.

rename_cell

Signature: void rename_cell (unsigned int index, string name)

Description: Renames the cell with given index

The cell with the given index is renamed to the given name. NOTE: it is not ensured that the name is unique. This method allows assigning identical names to different cells which usually breaks things. Consider using unique_cell_name to generate truely unique names.

scale_and_snap

(1) Signature: void scale_and_snap (Cell cell, int grid, int mult, int div)

Description: Scales and snaps the layout below a given cell by the given rational factor and snaps to the given grid

This method is useful to scale a layout by a non-integer factor. The scale factor is given by the rational number mult / div. After scaling, the layout will be snapped to the given grid.

Snapping happens 'as-if-flat' - that is, touching edges will stay touching, regardless of their hierarchy path. To achieve this, this method usually needs to produce cell variants.

This method has been introduced in version 0.26.1.

(2) Signature: void scale_and_snap (unsigned int cell_index, int grid, int mult, int div)

Description: Scales and snaps the layout below a given cell by the given rational factor and snaps to the given grid

Like the other version of scale_and_snap, but taking a cell index for the argument.

This method has been introduced in version 0.26.1.

set_info

Signature: void set_info (unsigned int index, const LayerInfo props)

Description: Sets the info structure for a specified layer

set_property

Signature: void set_property (variant key, variant value)

Description: Sets the user property with the given key to the given value

This method is a convenience method that sets the property with the given key to the given value. If no property with that key exists, it will create one. Using that method is more convenient than creating a new property set with a new ID and assigning that properties ID. This method may change the properties ID. Note: GDS only supports integer keys. OASIS supports numeric and string keys. This method has been introduced in version 0.24.

start_changes

Signature: void start_changes

Description: Signals the start of an operation bringing the layout into invalid state

This method should be called whenever the layout is about to be brought into an invalid state. After calling this method, under_construction? returns true which tells foreign code (i.e. the asynchronous painter or the cell tree view) not to use this layout object.

This state is cancelled by the end_changes method. The start_changes method can be called multiple times and must be cancelled the same number of times.

This method can be used to speed up certain operations. For example iterating over the layout with a RecursiveShapeIterator while modifying other layers of the layout can be very inefficient, because inside the loop the layout's state is invalidate and updated frequently. Putting a update and start_changes sequence before the loop (use both methods in that order!) and a end_changes call after the loop can improve the performance dramatically.

In addition, it can be necessary to prevent redraw operations in certain cases by using start_changes .. end_changes, in particular when it is possible to put a layout object into an invalid state temporarily.

While the layout is under construction update can be called to update the internal state explicitly if required. This for example might be necessary to update the cell bounding boxes or to redo the sorting for region queries.

swap_layers

Signature: void swap_layers (unsigned int a, unsigned int b)

Description: Swap two layers

a:The first of the layers to swap.
b:The second of the layers to swap.

Swaps the shapes of both layers.

This method was introduced in version 0.19.

technology

Signature: [const] const Technology ptr technology

Description: Gets the Technology object of the technology this layout is associated with or nil if the layout is not associated with a technology

This method has been introduced in version 0.27. Before that, the technology has been kept in the 'technology' meta data element.

technology_name

Signature: [const] string technology_name

Description: Gets the name of the technology this layout is associated with

This method has been introduced in version 0.27. Before that, the technology has been kept in the 'technology' meta data element.

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

technology_name=

Signature: void technology_name= (string name)

Description: Sets the name of the technology this layout is associated with

Changing the technology name will re-assess all library references because libraries can be technology specified. Cell layouts may be substituted during this re-assessment.

This method has been introduced in version 0.27.

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

top_cell

(1) Signature: Cell ptr top_cell

Description: Returns the top cell object

Returns:The Cell object of the top cell

If the layout has a single top cell, this method returns the top cell's Cell object. If the layout does not have a top cell, this method returns "nil". If the layout has multiple top cells, this method raises an error.

This method has been introduced in version 0.23.

(2) Signature: [const] const Cell ptr top_cell

Description: Returns the top cell object (const version)

Returns:The Cell object of the top cell

If the layout has a single top cell, this method returns the top cell's Cell object. If the layout does not have a top cell, this method returns "nil". If the layout has multiple top cells, this method raises an error.

This variant has been introduced in version 0.29.6.

top_cells

(1) Signature: Cell ptr[] top_cells

Description: Returns the top cell objects

Returns:The Cell objects of the top cells

This method returns and array of Cell objects representing the top cells of the layout. This array can be empty, if the layout does not have a top cell (i.e. no cell at all).

This method has been introduced in version 0.23.

(2) Signature: [const] const Cell ptr[] top_cells

Description: Returns the top cell objects (const version)

Returns:The Cell objects of the top cells

This method returns and array of Cell objects representing the top cells of the layout. This array can be empty, if the layout does not have a top cell (i.e. no cell at all).

This variant has been introduced in version 0.29.6.

transform

(1) Signature: void transform (const Trans trans)

Description: Transforms the layout with the given transformation

This method has been introduced in version 0.23.

(2) Signature: void transform (const ICplxTrans trans)

Description: Transforms the layout with the given complex integer transformation

This method has been introduced in version 0.23.

(3) Signature: void transform (const DTrans trans)

Description: Transforms the layout with the given transformation, which is in micrometer units

This variant will internally translate the transformation's displacement into database units. Apart from that, it behaves identical to the version with a Trans argument.

This variant has been introduced in version 0.25.

(4) Signature: void transform (const DCplxTrans trans)

Description: Transforms the layout with the given complex integer transformation, which is in micrometer units

This variant will internally translate the transformation's displacement into database units. Apart from that, it behaves identical to the version with a ICplxTrans argument.

This method has been introduced in version 0.23.

under_construction?

Signature: [const] bool under_construction?

Description: Returns true if the layout object is under construction

A layout object is either under construction if a transaction is ongoing or the layout is brought into invalid state by "start_changes".

unique_cell_name

Signature: [const] string unique_cell_name (string name)

Description: Creates a new unique cell name from the given name

Returns:A unique name derived from the argument

If a cell with the given name exists, a suffix will be added to make the name unique. Otherwise, the argument will be returned unchanged.

The returned name can be used to rename cells without risk of creating name clashes.

This method has been introduced in version 0.28.

update

Signature: void update

Description: Updates the internals of the layout

This method updates the internal state of the layout. Usually this is done automatically This method is provided to ensure this explicitly. This can be useful while using start_changes and end_changes to wrap a performance-critical operation. See start_changes for more details.

write

(1) Signature: void write (string filename, bool gzip, const SaveLayoutOptions options)

Description: Writes the layout to a stream file

filename:The file to which to write the layout
gzip:Ignored
options:The option set to use for writing. See SaveLayoutOptions for details

Use of this method is deprecated

Starting with version 0.23, this variant is deprecated since the more convenient variant with two parameters automatically determines the compression mode from the file name. The gzip parameter is ignored staring with version 0.23.

(2) Signature: void write (string filename, const SaveLayoutOptions options)

Description: Writes the layout to a stream file

filename:The file to which to write the layout
options:The option set to use for writing. See SaveLayoutOptions for details

This version automatically determines the compression mode from the file name. The file is written with zlib compression if the suffix is ".gz" or ".gzip".

This variant has been introduced in version 0.23.

(3) Signature: void write (string filename)

Description: Writes the layout to a stream file

filename:The file to which to write the layout