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

API reference - Class Net

Notation used in Ruby API documentation

Module: db

Description: A single net.

Class hierarchy: Net » NetlistObject

A net connects multiple pins or terminals together. Pins are either pin or subcircuits of outgoing pins of the circuit the net lives in. Terminals are connections made to specific terminals of devices.

Net objects are created inside a circuit with Circuit#create_net.

To connect a net to an outgoing pin of a circuit, use Circuit#connect_pin, to disconnect a net from an outgoing pin use Circuit#disconnect_pin. To connect a net to a pin of a subcircuit, use SubCircuit#connect_pin, to disconnect a net from a pin of a subcircuit, use SubCircuit#disconnect_pin. To connect a net to a terminal of a device, use Device#connect_terminal, to disconnect a net from a terminal of a device, use Device#disconnect_terminal.

This class has been added in version 0.26.

Public methods

void_assign(const Net other)Assigns another object to self
[const]Net 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]new Net ptr_dupCreates a copy of self
[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.
Circuit ptrcircuitGets the circuit the net lives in.
voidclearClears the net.
[const]unsigned longcluster_idGets the cluster ID of the net.
voidcluster_id=(unsigned long id)Sets the cluster ID of the net.
[const,iter]NetPinRefeach_pinIterates over all outgoing pins the net connects.
[iter]NetPinRefeach_pinIterates over all outgoing pins the net connects (non-const version).
[const,iter]NetSubcircuitPinRefeach_subcircuit_pinIterates over all subcircuit pins the net connects.
[iter]NetSubcircuitPinRefeach_subcircuit_pinIterates over all subcircuit pins the net connects (non-const version).
[const,iter]NetTerminalRefeach_terminalIterates over all terminals the net connects.
[iter]NetTerminalRefeach_terminalIterates over all terminals the net connects (non-const version).
[const]stringexpanded_nameGets the expanded name of the net.
[const]boolis_floating?Returns true, if the net is floating.
[const]boolis_internal?Returns true, if the net is an internal net.
[const]boolis_passive?Returns true, if the net is passive.
[const]stringnameGets the name of the net.
voidname=(string name)Sets the name of the net.
[const]unsigned longpin_countReturns the number of outgoing pins connected by this net.
[const]stringqnameGets the qualified name.
[const]unsigned longsubcircuit_pin_countReturns the number of subcircuit pins connected by this net.
[const]unsigned longterminal_countReturns the number of terminals connected by this net.
[const]stringto_sGets the qualified name.

Detailed description

_assign

Signature: void _assign (const Net other)

Description: Assigns another object to self

_const_cast

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

_dup

Signature: [const] new Net ptr _dup

Description: Creates a copy of self

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

circuit

Signature: Circuit ptr circuit

Description: Gets the circuit the net lives in.

clear

Signature: void clear

Description: Clears the net.

cluster_id

Signature: [const] unsigned long cluster_id

Description: Gets the cluster ID of the net.

See cluster_id= for details about the cluster ID.

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

cluster_id=

Signature: void cluster_id= (unsigned long id)

Description: Sets the cluster ID of the net.

The cluster ID connects the net with a layout cluster. It is set when the net is extracted from a layout.

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

each_pin

(1) Signature: [const,iter] NetPinRef each_pin

Description: Iterates over all outgoing pins the net connects.

Pin connections are described by NetPinRef objects. Pin connections are connections to outgoing pins of the circuit the net lives in.

(2) Signature: [iter] NetPinRef each_pin

Description: Iterates over all outgoing pins the net connects (non-const version).

Pin connections are described by NetPinRef objects. Pin connections are connections to outgoing pins of the circuit the net lives in.

This constness variant has been introduced in version 0.26.8

each_subcircuit_pin

(1) Signature: [const,iter] NetSubcircuitPinRef each_subcircuit_pin

Description: Iterates over all subcircuit pins the net connects.

Subcircuit pin connections are described by NetSubcircuitPinRef objects. These are connections to specific pins of subcircuits.

(2) Signature: [iter] NetSubcircuitPinRef each_subcircuit_pin

Description: Iterates over all subcircuit pins the net connects (non-const version).

Subcircuit pin connections are described by NetSubcircuitPinRef objects. These are connections to specific pins of subcircuits.

This constness variant has been introduced in version 0.26.8

each_terminal

(1) Signature: [const,iter] NetTerminalRef each_terminal

Description: Iterates over all terminals the net connects.

Terminals connect devices. Terminal connections are described by NetTerminalRef objects.

(2) Signature: [iter] NetTerminalRef each_terminal

Description: Iterates over all terminals the net connects (non-const version).

Terminals connect devices. Terminal connections are described by NetTerminalRef objects.

This constness variant has been introduced in version 0.26.8

expanded_name

Signature: [const] string expanded_name

Description: Gets the expanded name of the net.

The expanded name takes the name of the net. If the name is empty, the cluster ID will be used to build a name.

is_floating?

Signature: [const] bool is_floating?

Description: Returns true, if the net is floating.

Floating nets are those which don't have any device or subcircuit on it and are not connected through a pin.

is_internal?

Signature: [const] bool is_internal?

Description: Returns true, if the net is an internal net.

Internal nets are those which connect exactly two terminals and nothing else (pin_count = 0 and terminal_count == 2).

is_passive?

Signature: [const] bool is_passive?

Description: Returns true, if the net is passive.

Passive nets don't have devices or subcircuits on it. They can be exposed through a pin. is_floating? implies is_passive?.

This method has been introduced in version 0.26.1.

name

Signature: [const] string name

Description: Gets the name of the net.

See name= for details about the name.

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

name=

Signature: void name= (string name)

Description: Sets the name of the net.

The name of the net is used for naming the net in schematic files for example. The name of the net has to be unique.

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

pin_count

Signature: [const] unsigned long pin_count

Description: Returns the number of outgoing pins connected by this net.

qname

Signature: [const] string qname

Description: Gets the qualified name.

The qualified name is like the expanded name, but the circuit's name is preceded (i.e. 'CIRCUIT:NET') if available.

Python specific notes:
This method is also available as 'str(object)'.

subcircuit_pin_count

Signature: [const] unsigned long subcircuit_pin_count

Description: Returns the number of subcircuit pins connected by this net.

terminal_count

Signature: [const] unsigned long terminal_count

Description: Returns the number of terminals connected by this net.

to_s

Signature: [const] string to_s

Description: Gets the qualified name.

The qualified name is like the expanded name, but the circuit's name is preceded (i.e. 'CIRCUIT:NET') if available.

Python specific notes:
This method is also available as 'str(object)'.