Properties¶
- class photonforge.Properties(**kwargs)¶
Properties container.
- Parameters:
**kwargs (int, float, str, bytes, Sequence[int, float, str, bytes]) – Named properties.
Example
>>> properties = pf.Properties(int_value=1, byte_string=b"some text") >>> properties["int_value"] 1 >>> del properties.int_value >>> properties Properties(**{"byte_string": b"some text"}) >>> properties.byte_string b'some text'
>>> component = pf.Component() >>> component.properties.new_value = 123 >>> component.properties Properties(**{"new_value": 123})
Note
Sequences of length 1 are relpaced by their contents. Strings are stored as ‘bytes’ using the utf-8 encoding.
Methods
add_gds_property
(attribute, value)Set a property compatible with GDSII layouts.
copy
()Create a copy of these properties.
keys
()Return the keys for these properties.
- add_gds_property(attribute, value)¶
Set a property compatible with GDSII layouts.
GDSII properties are stored under the “S_GDS_PROPERTY” key and are composed of a non-negative attribute number and a string value.
- Parameters:
attribute (int) – Property attribute number.
value (str | bytes) – Property value. Strings are stored as bytes using the utf-8 encoding.
- Returns:
This object.
- Return type:
Note
GDSII files only support properties on geometrical structures, labels, and references. Properties on components (cells) are not supported and will not be included in the gds file.
- copy()¶
Create a copy of these properties.
- Returns:
New copy.
- keys()¶
Return the keys for these properties.
- Returns:
Property keys.