API reference - Class Instance

Notation used in Ruby API documentation

Description: An instance proxy

An instance proxy is basically a pointer to an instance of different kinds, similar to Shape, the shape proxy. Instance objects can be duplicated without creating copies of the instances itself: the copy will still point to the same instance than the original.

When the Instance object is modified, the actual instance behind it is modified. The Instance object acts as a simplified interface for single and array instances with or without properties.

See The Database API for more details about the database objects.

Public constructors

new Instance ptrnewCreates a new object of this class

Public methods

[const]bool!=(const Instance b)Inequality of two Instance objects
[const]bool<(const Instance b)Provide an order criterion for two Instance objects
[const]bool==(const Instance b)Equality of two Instance objects
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]PointaReturn the displacement vector for the 'a' axis
voida=(const Point a)Sets the displacement vector for the 'a' axis
voidassign(const Instance other)Assigns another object to self
[const]PointbReturn the displacement vector for the 'b' axis
voidb=(const Point b)Sets the displacement vector for the 'b' axis
[const]BoxbboxThe bounding box of the instance
Cell ptrcellGet the Cell object of the cell this instance refers to
voidcell=(const Cell ptr cell)Sets the Cell object this instance refers to
[const]unsigned intcell_indexGet the index of the cell this instance refers to
voidcell_index=(unsigned int cell_index)Sets the index of the cell this instance refers to
[const]CellInstArraycell_instGet the basic CellInstArray object associated with this instance reference.
voidcell_inst=(const CellInstArray inst)Changes the CellInstArray object to the given one.
voidchange_pcell_parameter(string name,
variant value)
Changes a single parameter of a PCell instance to the given value
voidchange_pcell_parameters(variant[] params)Changes the parameters of a PCell instance to the list of parameters
voidchange_pcell_parameters(map<string,variant> dict)Changes the parameters of a PCell instance to the dictionary of parameters
voidconvert_to_staticConverts a PCell instance to a static cell
[const]CplxTranscplx_transGet the complex transformation of the instance or the first instance in the array
voidcplx_trans=(const CplxTrans arg1)Sets the complex transformation of the instance or the first instance in the array
voiddeleteDelete this instance
voiddelete_property(variant key)Deletes the user property with the given key
[const]new Instance ptrdupCreates a copy of self
voidexplodeExplodes the instance array
voidflattenFlattens the instance
voidflatten(int levels)Flattens the instance
[const]boolhas_prop_id?Returns true, if the instance has properties
[const]boolis_complex?Test, if the array is a complex array
[const]boolis_null?Check, if the instance is a valid one
[const]boolis_pcell?Returns a value indicating whether the instance is a PCell instance
[const]boolis_regular_array?Test, if this instance is a regular array
[const]boolis_valid?Test if the Instance object is still pointing to a valid instance
Layout ptrlayoutGets the layout this instance is contained in
[const]unsigned longnaReturn the number of instances in the 'a' axis
voidna=(unsigned long na)Sets the number of instances in the 'a' axis
[const]unsigned longnbReturn the number of instances in the 'b' axis
voidnb=(unsigned long nb)Sets the number of instances in the 'b' axis
Cell ptrparent_cellGets the cell this instance is contained in
voidparent_cell=(Cell ptr arg1)Moves the instance to a different cell
[const]const PCellDeclaration ptrpcell_declarationReturns the PCell declaration object
[const]variant[]pcell_parametersGets the parameters of a PCell instance as a list of values
[const]map<string,variant>pcell_parameters_by_nameGets the parameters of a PCell instance as a dictionary of values vs. names
[const]unsigned longprop_idGet the properties ID associated with the instance
voidprop_id=(unsigned long id)Sets the properties ID associated with the instance
variantproperty(variant key)Gets the user property with the given key
voidset_property(variant key,
variant value)
Set the user property with the given key to the given value
[const]unsigned longsizeThe number of single instances in the instance array
[const]stringto_sCreate a string showing the contents of the reference
[const]stringto_s(bool with_cellname)Create a string showing the contents of the reference
[const]TranstransGet the transformation of the instance or the first instance in the array
voidtrans=(const Trans arg1)Sets the transformation of the instance or the first instance in the array
voidtransform(const Trans t)Transforms the instance array with the given transformation
voidtransform(const CplxTrans t)Transforms the instance array with the given transformation
voidtransform(const ICplxTrans t)Transforms the instance array with the given transformation
voidtransform_into(const Trans t)Transforms the instance array with the given transformation
voidtransform_into(const CplxTrans t)Transforms the instance array with the given transformation
voidtransform_into(const ICplxTrans t)Transforms the instance array with the given transformation

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

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

Detailed description

[const] bool !=(const Instance b)

Description: Inequality of two Instance objects

Warning: this operator returns true if both objects refer to the same instance, not just identical ones.

[const] bool <(const Instance b)

Description: Provide an order criterion for two Instance objects

Warning: this operator is just provided to establish any order, not a particular one.

[const] bool ==(const Instance b)

Description: Equality of two Instance objects

See the hint on the < operator.

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.

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.

[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.

[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.

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.

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.

[const] Point a

Description: Return the displacement vector for the 'a' axis

Python specific notes:

The object exposes a readable attribute 'a'. This is the getter.

void a=(const Point a)

Description: Sets the displacement vector for the 'a' axis

If the instance was not an array instance before it is made one.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'a'. This is the setter.

void assign(const Instance other)

Description: Assigns another object to self

[const] Point b

Description: Return the displacement vector for the 'b' axis

Python specific notes:

The object exposes a readable attribute 'b'. This is the getter.

void b=(const Point b)

Description: Sets the displacement vector for the 'b' axis

If the instance was not an array instance before it is made one.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'b'. This is the setter.

[const] Box bbox

Description: The bounding box of the instance

The bounding box incorporates all instances that the array represents. It gives the overall extension of the child cell as seen in the calling cell (or all array members if the instance forms an array). This method has been introduced in version 0.23.

Cell ptr cell

Description: Get the Cell object of the cell this instance refers to

Please note that before version 0.23 this method returned the cell the instance is contained in. For consistency, this method has been renamed parent_cell.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a readable attribute 'cell'. This is the getter.

void cell=(const Cell ptr cell)

Description: Sets the Cell object this instance refers to

Setting the cell object to nil is equivalent to deleting the instance.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'cell'. This is the setter.

[const] unsigned int cell_index

Description: Get the index of the cell this instance refers to

Python specific notes:

The object exposes a readable attribute 'cell_index'. This is the getter.

void cell_index=(unsigned int cell_index)

Description: Sets the index of the cell this instance refers to

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'cell_index'. This is the setter.

[const] CellInstArray cell_inst

Description: Get the basic CellInstArray object associated with this instance reference.

Python specific notes:

The object exposes a readable attribute 'cell_inst'. This is the getter.

void cell_inst=(const CellInstArray inst)

Description: Changes the CellInstArray object to the given one.

This method replaces the instance by the given CellInstArray object.

This method has been introduced in version 0.22

Python specific notes:

The object exposes a writable attribute 'cell_inst'. This is the setter.

void change_pcell_parameter(string name,variant value)

Description: Changes a single parameter of a PCell instance to the given value

This method changes a parameter of a PCell instance to the given value. The name identifies the PCell parameter and must correspond to one parameter listed in the PCell declaration.

This method has been introduced in version 0.24.

void change_pcell_parameters(variant[] params)

Description: Changes the parameters of a PCell instance to the list of parameters

This method changes the parameters of a PCell instance to the given list of parameters. The list must correspond to the parameters listed in the pcell declaration. A more convenient method is provided with the same name which accepts a dictionary of names and values . This method has been introduced in version 0.24.

void change_pcell_parameters(map<string,variant> dict)

Description: Changes the parameters of a PCell instance to the dictionary of parameters

This method changes the parameters of a PCell instance to the given values. The values are specifies as a dictionary of names (keys) vs. values. Unknown names are ignored and only the parameters listed in the dictionary are changed.

This method has been introduced in version 0.24.

void convert_to_static

Description: Converts a PCell instance to a static cell

If the instance is a PCell instance, this method will convert the cell into a static cell and remove the PCell variant if required. A new cell will be created containing the PCell content but begin a static cell. If the instance is not a PCell instance, this method will not do anything.

This method has been introduced in version 0.24.

[const] CplxTrans cplx_trans

Description: Get the complex transformation of the instance or the first instance in the array

This method is always valid compared to trans, since simple transformations can be expressed as complex transformations as well.

Python specific notes:

The object exposes a readable attribute 'cplx_trans'. This is the getter.

void cplx_trans=(const CplxTrans arg1)

Description: Sets the complex transformation of the instance or the first instance in the array

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'cplx_trans'. This is the setter.

void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

void delete

Description: Delete this instance

After this method was called, the instance object is pointing to nothing.

This method has been introduced in version 0.23.

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. Calling this method may invalidate any iterators. It should not be called inside a loop iterating over instances.

This method has been introduced in version 0.22.

void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

[const] bool destroyed?

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

Use of this method is deprecated. Use _destroyed? instead

[const] new Instance ptr dup

Description: Creates a copy of self

void explode

Description: Explodes the instance array

This method does nothing if the instance was not an array before. The instance object will point to the first instance of the array afterwards.

This method has been introduced in version 0.23.

void flatten

Description: Flattens the instance

This method will convert the instance to a number of shapes which are equivalent to the content of the cell. The instance itself will be removed. There is another variant of this method which allows specification of the number of hierarchy levels to flatten.

This method has been introduced in version 0.24.

void flatten(int levels)

Description: Flattens the instance

This method will convert the instance to a number of shapes which are equivalent to the content of the cell. The instance itself will be removed. This version of the method allows specification of the number of hierarchy levels to remove. Specifying 1 for 'levels' will remove the instance and replace it by the contents of the cell. Specifying a negative value or zero for the number of levels will flatten the instance completely.

This method has been introduced in version 0.24.

[const] bool has_prop_id?

Description: Returns true, if the instance has properties

[const] bool is_complex?

Description: Test, if the array is a complex array

Returns true if the array represents complex instances (that is, with magnification and arbitrary rotation angles).

[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

[const] bool is_null?

Description: Check, if the instance is a valid one

[const] bool is_pcell?

Description: Returns a value indicating whether the instance is a PCell instance

This method has been introduced in version 0.24.

[const] bool is_regular_array?

Description: Test, if this instance is a regular array

[const] bool is_valid?

Description: Test if the Instance object is still pointing to a valid instance

If the instance represented by the given reference has been deleted, this method returns false. If however, another instance has been inserted already that occupies the original instances position, this method will return true again.

This method has been introduced in version 0.23 and is a shortcut for "inst.cell.is_valid?(inst)".

Layout ptr layout

Description: Gets the layout this instance is contained in

This method has been introduced in version 0.22.

[const] unsigned long na

Description: Return the number of instances in the 'a' axis

Python specific notes:

The object exposes a readable attribute 'na'. This is the getter.

void na=(unsigned long na)

Description: Sets the number of instances in the 'a' axis

If the instance was not an array instance before it is made one.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'na'. This is the setter.

[const] unsigned long nb

Description: Return the number of instances in the 'b' axis

Python specific notes:

The object exposes a readable attribute 'nb'. This is the getter.

void nb=(unsigned long nb)

Description: Sets the number of instances in the 'b' axis

If the instance was not an array instance before it is made one.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'nb'. This is the setter.

[static] new Instance ptr new

Description: Creates a new object of this class

Python specific notes:

This method is the default initializer of the object

Cell ptr parent_cell

Description: Gets the cell this instance is contained in

Returns nil if the instance does not live inside a cell. This method was named "cell" previously which lead to confusion with cell_index. It was renamed to "parent_cell" in version 0.23.

Python specific notes:

The object exposes a readable attribute 'parent_cell'. This is the getter.

void parent_cell=(Cell ptr arg1)

Description: Moves the instance to a different cell

Both the current and the target cell must live in the same layout.

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'parent_cell'. This is the setter.

[const] const PCellDeclaration ptr pcell_declaration

Description: Returns the PCell declaration object

If the instance is a PCell instance, this method returns the PCell declaration object for that PCell. If not, this method will return nil. This method has been introduced in version 0.24.

[const] variant[] pcell_parameters

Description: Gets the parameters of a PCell instance as a list of values

Returns:A list of values

If the instance is a PCell instance, this method will return an array of values where each value corresponds to one parameter. The order of the values is the order the parameters are declared in the PCell declaration. If the instance is not a PCell instance, this list returned will be empty.

This method has been introduced in version 0.24.

[const] map<string,variant> pcell_parameters_by_name

Description: Gets the parameters of a PCell instance as a dictionary of values vs. names

Returns:A dictionary of values by parameter name

If the instance is a PCell instance, this method will return a map of values vs. parameter names. The names are the ones defined in the PCell declaration.If the instance is not a PCell instance, the dictionary returned will be empty.

This method has been introduced in version 0.24.

[const] unsigned long prop_id

Description: Get the properties ID associated with the instance

Python specific notes:

The object exposes a readable attribute 'prop_id'. This is the getter.

void prop_id=(unsigned long id)

Description: Sets the properties ID associated with the instance

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.22.

Python specific notes:

The object exposes a writable attribute 'prop_id'. This is the setter.

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 layout object and the properties ID to retrieve the property value. This method has been introduced in version 0.22.

void set_property(variant key,variant value)

Description: Set 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. Calling this method may invalidate any iterators. It should not be called inside a loop iterating over instances.

This method has been introduced in version 0.22.

[const] unsigned long size

Description: The number of single instances in the instance array

If the instance represents a single instance, the count is 1. Otherwise it is na*nb.

Python specific notes:

This method is also available as 'len(object)'

[const] string to_s

Description: Create a string showing the contents of the reference

This method has been introduced with version 0.16.

Python specific notes:

This method is also available as 'str(object)'

[const] string to_s(bool with_cellname)

Description: Create a string showing the contents of the reference

Passing true to with_cellname makes the string contain the cellname instead of the cell index

This method has been introduced with version 0.23.

Python specific notes:

This method is also available as 'str(object)'

[const] Trans trans

Description: Get the transformation of the instance or the first instance in the array

The transformation returned is only valid if the array does not represent a complex transformation array

Python specific notes:

The object exposes a readable attribute 'trans'. This is the getter.

void trans=(const Trans arg1)

Description: Sets the transformation of the instance or the first instance in the array

This method has been introduced in version 0.23.

Python specific notes:

The object exposes a writable attribute 'trans'. This is the setter.

void transform(const Trans t)

Description: Transforms the instance array with the given transformation

See Cell#transform for a description of this method.

This method has been introduced in version 0.23.

void transform(const CplxTrans t)

Description: Transforms the instance array with the given transformation

See Cell#transform for a description of this method.

This method has been introduced in version 0.23.

void transform(const ICplxTrans t)

Description: Transforms the instance array with the given transformation

See Cell#transform for a description of this method.

This method has been introduced in version 0.23.

void transform_into(const Trans t)

Description: Transforms the instance array with the given transformation

See Cell#transform_into for a description of this method.

This method has been introduced in version 0.23.

void transform_into(const CplxTrans t)

Description: Transforms the instance array with the given transformation

See Cell#transform_into for a description of this method.

This method has been introduced in version 0.23.

void transform_into(const ICplxTrans t)

Description: Transforms the instance array with the given transformation

See Cell#transform_into for a description of this method.

This method has been introduced in version 0.23.