load_layout

photonforge.load_layout(filename, technology=None, layers=[], cell_names=[], library_properties=False, post_load_function=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]) – If not empty, only these layers will be converted.

  • cell_names (Iterable[str]) – 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], Any] | None) – Function called for each component after the layout is loaded from GDSII/OASIS file (see Note).

Note

The post_load_function is 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]