KLayout is a layout viewer and editor primarily for integrated circuit layouts (GDSII, OASIS). The `klayout` Python package (v0.30.7) provides a standalone scripting interface to KLayout's powerful database and geometry manipulation functionalities, allowing users to programmatically create, modify, and analyze layouts without requiring the full graphical application. It maintains an active release cadence, with minor updates released frequently to address issues and enhance features, often multiple times a month.
pip install klayoutVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a new GDSII layout, define a cell and layer, add a simple rectangular shape, and save the result using the `klayout.db` module.
Migrate your code to use `import klayout.db as db` and access classes/functions through the `db` alias (e.g., `db.Layout()`, `db.DBox()`).
Understand that `pip install klayout` is for scripting-only. If you need the GUI, download the appropriate KLayout installer for your operating system from `klayout.de/build.html`.
Always explicitly set `layout.dbu` at the beginning of your script to ensure consistent units (e.g., `layout.dbu = 0.001` for 1nm resolution, meaning coordinates are in micrometers). All input values to geometry functions should then be scaled appropriately to this DBU.
Run `pip install klayout` to install the package.
Change your import and object instantiation to use `klayout.db`: `import klayout.db as db; layout = db.Layout()`.
Before creating a new layer index, check if the layer already exists using `layout.find_layer()` or ensure you only call `layout.layer(LayerInfo(...))` once for each unique layer definition. `layout.layer()` is idempotent for existing layer infos.
No dependency data recorded yet.