KLayout Manual: Main Index » Class Index » API reference - Class Instance

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.

Public constructors

InstancenewCreates 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
[const]PointaReturn the displacement vector for the 'a' axis
[const]voidassign(const Instance other)Assign the contents of another object to self
[const]PointbReturn the displacement vector for the 'b' axis
Cell ptrcellGets the cell this instance is contained in
[const]unsigned intcell_indexGet 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.
[const]CplxTranscplx_transGet the complex transformation of the instance or the first instance in the array
voidcreateEnsures the C++ object is created
voiddelete_property(variant key)Deletes the user property with the given key
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
[const]InstancedupCreates a copy of self
[const]boolhas_prop_id?Check, if the instance is associated with a properties Id
[const]boolis_complex?Test, if the array is a complex array
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
[const]boolis_null?Check, if the instance is a valid one
[const]boolis_regular_array?Test, if this instance is a regular array
Layout ptrlayoutGets the layout this instance is contained in
[const]unsigned longnaReturn the number of instances in the 'a' axis
[const]unsigned longnbReturn the number of instances in the 'b' axis
[const]unsigned intparent_cell_indexRetrieve the reference to the parent cell
[const]unsigned intprop_idGet the properties Id associated with the instance
voidprop_id=(unsigned int 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 intsizeThe number of single instances in the instance array
[const]stringto_sCreate a string showing the contents of the reference
[const]TranstransGet the transformation of the first instance in the array

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.

[const] Point a

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

[const] void assign(const Instance other)

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

[const] Point b

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

Cell ptr cell

Description: Gets the cell this instance is contained in

This method has been introduced in version 0.22.

[const] unsigned int cell_index

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

[const] CellInstArray cell_inst

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

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

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

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 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 will invalidate any iterators. It should not be called inside a loop iterating over shapes.

This method has been introduced in version 0.22.

void destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, 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] Instance dup

Description: Creates a copy of self

[const] bool has_prop_id?

Description: Check, if the instance is associated with a properties Id

[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

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

[const] bool is_null?

Description: Check, if the instance is a valid one

[const] bool is_regular_array?

Description: Test, if this instance is a regular array

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

[const] unsigned long nb

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

[static] Instance new

Description: Creates a new object of this class

[const] unsigned int parent_cell_index

Description: Retrieve the reference to the parent cell

[const] unsigned int prop_id

Description: Get the properties Id associated with the instance

void prop_id=(unsigned int id)

Description: Sets the properties Id associated with the instance

This method has been introduced in version 0.22.

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 does not exist, 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 will invalidate any iterators. It should not be called inside a loop iterating over shapes.

This method has been introduced in version 0.22.

[const] unsigned int 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.

[const] string to_s

Description: Create a string showing the contents of the reference

This method has been introduced with version 0.16.

[const] Trans trans

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

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