load_layout¶
- photonforge.load_layout(filename, technology=None, layers=None, cell_names=None, library_properties=False, post_load_function=None, compact='auto', temp_dir=None)¶
Load a layout file as components.
- Parameters:
filename (str) – GDSII/OASIS file name to load.
technology (Technology | None) – Technology used to create the layout. If not specified, the current default technology will be used.
layers (Iterable[tuple[int, int] | str] | None) – If not empty, only these layers will be converted.
cell_names (Iterable[str] | None) – If not empty, only these cells (and dependencies) will be converted.
library_properties (bool) – If
True, this function also returns any library properties the layout might have.post_load_function (Callable[[Component], object] | None) – Function called for each component after the layout is loaded from GDSII/OASIS file (see Note).
compact (bool | str) – Recover exact rectangular repetitions from translated geometry and scalar references. Recovered geometry is stored in synthetic components named with the
_PHOTONFORGE_COMPACT_prefix; these are included in the returned dictionary and passed topost_load_functionlike any other component."auto"(default) compacts only files that are at least 256 MiB on disk avoiding compaction overhead for small files while keeping large files bounded automatically.temp_dir (str | None) – Directory used for compact-mode spill files when the layout does not fit in the bounded in-memory workspace. Defaults to the system temporary directory.
Note
Polygons with fewer than three vertices after import conversion are skipped with a runtime warning. Zero-area polygons, explicit rectangles, and circles are retained.
The
post_load_functionis called once for each component after the layout is imported, in case, for example, pins or ports need to be automatically registered and created or in-place modification or analysis is needed. The provided function operates on components without copying them, which means that modifications done using this callback are implemented in-place. If the layout has a hierarchy, the callback is applied through the hierarchy as well, therefore traversing through the component tree is not needed.- Returns:
Dictionary of components indexed by name. If
library_properties == True, also returns those properties.- Return type:
dict[str, Component] | tuple[dict[str, Component], Properties]
See also