Glyph

Cells and hierarchy

Cells are how GDS organises geometry. One cell is the top cell (the root of what gets saved); other cells are reusable stamps.

The Glyph Cells panel showing a TOP cell expanded to reveal DEVICE and PAD child cells with instance counts, while the canvas shows the placed instances.View full image

The Cells panel lists every cell with its shape / SRef / ARef counts. Each row's tooltip also shows the cell's content extent and how many flattened instances of it exist across the whole design (AREFs counted as rows × cols); a cell instanced many times shows a small ×N badge — click it to open Find shapes & instances… pre-seeded with ref:<cell> over the whole document (in quotes when the name has a space, ref:"Block 1"), so you can jump straight to every placement. In flat view a header button cycles the sort between name, instance count, and area — handy for finding "which cell is placed 50 000 times" or the largest cells. The tree view opens with the top cell's direct children already visible (one level deep) rather than fully collapsed to a single row, so a hierarchy design doesn't look empty on first open. The list follows the cell you are editing: entering a cell, or reopening the Cells tab, scrolls its row into view when the list shows it. Breadcrumb at the top of the canvas shows the edit context.

Action How
Add cell + button at the top of the panel
Enter a cell (start editing its contents) Double-click the cell row (anywhere on it, its hover icons included), select its row from the keyboard (Tab onto the list, then ↑ / ↓) and press Enter, or double-click an SRef/ARef in the canvas with the Select tool armed (a shape under the cursor, e.g. text, is edited instead of entering). Re-fits the view to that cell when its geometry would otherwise be off-screen — a child's coordinates are its own, so without this a cell placed far from the parent origin opened onto a blank canvas. The view is left alone when the cell is already in view, when it is empty, when you return to the top cell, and when you switch tabs (each tab keeps its own view).
Exit a cell (back to parent) Click a breadcrumb crumb above the canvas, or press Esc with nothing selected (after entering from the Cells list or the palette, Esc returns to the cell you entered from; when the enter moved the view, Esc moves it back too, unless you have moved the view since: a pan, a zoom or a bookmark)
Rename Click the pencil icon on the cell row, type, Enter
Duplicate cell Right-click the cell row → "Duplicate cell". Copies its shapes/SRefs/AREFs under a new name (lowest free <name>_N suffix). Shallow duplicate: any SRef/AREF inside the copy still points at the same child cells as the original — matches KLayout's default cell copy, not its ancestry-isolating "Make Cell Variants".
Delete × button on the cell row (the top cell cannot be deleted)
Hide / show cell instances Eye icon on the cell row. While hidden, every SRef/AREF that targets that cell is omitted from the canvas (the cell itself, its shapes, and the row stay — only the instances are muted). Useful for "mute the dummy fill" without changing layers. The hidden flag is per-document, undoable, and is not written to the .gds.
Group selection into a new cell Right-click selection → Group. Selection is replaced by an SRef to the new cell.
Flatten hierarchy Arrange → Flatten hierarchy: inlines every SRef/AREF in the active cell.
Prune unreferenced cells Arrange → Prune unreferenced cells…: deletes every cell unreachable from any top cell (orphaned subtrees and reference cycles left behind by edits) in one undoable step. A second, independently-valid top-level structure — one with no incoming refs of its own — is never touched.

Entering a cell from the Cells list or the palette's Go to cell starts the breadcrumb at the cell on screen: it shows the shortest path by which that cell places the one you entered, or, when it does not place it, the entered cell is shown as top. Esc then returns to the cell and breadcrumb you left. Enter another cell from there and each Esc retraces one enter, back to that cell. When an enter moved the view to bring the cell on screen, Esc also returns the view to where you were, as one Alt + ← would (so Alt + → still reaches the entered cell's view); if you moved the view inside (a pan, a zoom or a recalled bookmark), Esc leaves the view where you put it. The same holds when you entered by double-clicking an instance, Enter cell or Descend. Two exceptions: entering a cell you are already inside (one higher up the breadcrumb) forgets the earlier enters, so Esc then goes up one level at a time; and an enter whose starting breadcrumb contains a cell you have since deleted is skipped, so Esc goes to the enter before it and leaves the view where it is, or else up one level if the breadcrumb has one (the status hint offers Esc only when it will move).

Inside an entered cell the cells above it on the breadcrumb are drawn dimmed beneath it, where they sit around the instance you entered, so you edit a symbol in place among its neighbours. They are a backdrop only: a click, a hover or a snap never reaches them. Entered by double-clicking an instance, or with Enter cell on a selected one, the backdrop sits around that instance (in an array, around the element you double-clicked; Enter cell on a selected array takes its first element); entered from the Cells list or Go to cell, which name a cell and not an instance, it sits around the cell's first placement. The backdrop is hidden while a hierarchy minimum level of 1 or more is set and during Preview as exposed.

Each cell row also shows a small shapes·refs count next to the cell name so you can scan the hierarchy at a glance (a row nested too deep for the panel's width leaves it out rather than cut it short; Safari can still show it cut, tested on WebKit). The icons that appear on a row under the pointer (eye, box, pencil, insert, delete) take their place beside the name, which is shortened with … to make room, and a click on one acts after a short pause, about half a second, the time a double-click takes; a double-click there, its two clicks within that half second, enters the cell and changes nothing else (a slower double-click runs the icon's action as well). Pressing a key or clicking elsewhere in that pause runs the icon's action at once, and an icon reached with Tab acts at once on Enter or Space. From the keyboard the list is one Tab stop: Tab from the filter lands on a row's name (the row you were last on, else the first row in view), ↑ / ↓ move to the previous / next row, Home / End to the first / last, → / ← expand / collapse a row of the tree view, and Enter enters that row's cell. Tab from a row's name walks that row's own icons, then leaves the list. A click on a row's name makes it the list's row, so Enter then enters it; a click on one of its icons leaves the keyboard focus where it was.

Cell-model guarantees (what Glyph does differently than the raw GDS spec)

  • Rename is safe. Renaming a cell also rewrites every SREF / AREF that pointed to it, and updates topCell if needed. No dangling refs.
  • A cell the file only references. A GDS file can place a cell it never defines. Glyph opens it without a notice and lists the missing name under its parent in the Cells panel, with no shapes; its instances draw nothing, and the Objects panel lists each as Instance → NAME with no size. Entering, showing as top, setting as the document top cell, renaming, duplicating, deleting or adding such a row to My files is refused with a message naming it: "PAD_A" is referenced but not defined in this file, so it cannot be deleted.
  • KLayout's metadata cell. A file written by gdsfactory or by KLayout with PCell or meta information carries a cell named $$$CONTEXT_INFO$$$ that holds that information. KLayout hides it; Glyph lists it in the Cells panel, as the last root of the tree after the top cells KLayout shows (a cell it annotates is still listed under it when you expand it), and keeps it as the top cell of a saved GDS file, but treats the design (the top cell KLayout shows) as the top everywhere else: the file opens on it, switching tabs, restoring a session, pruning and the breadcrumb's Home return to it, and the Cells list marks it as the top. A Claude call that names no cell also works in it. An OASIS export leaves the metadata cell out and writes its PCell and meta information as KLayout's own OASIS does, and opening such an OASIS (from KLayout, gdsfactory or Glyph) rebuilds the metadata cell, so the information survives a save as OASIS or GDS. A context far past any real file is cut: Glyph charges it about three bytes a character (so the cut comes near 5 MB of context text, 16 MB as charged), keeps it part by part in file order, the layout's part and each cell's part whole or not at all, until the next part would pass the limit, and the open says how many parts it left out. A single value longer than one GDS record, or a context of more than 32 768 values, is saved in the form KLayout itself writes, and KLayout reads it back whole; a CIF or DXF export carries no KLayout context, so it leaves the metadata cell out (KLayout would show it as the top) and that information is not kept there. Each says so. An SVG, EPS or PNG export draws the top cell the file opens on, not the metadata cell. Its one placeholder polygon is not counted in the open's note about boundaries with fewer than 3 distinct vertices. Send to BEAM does not count that polygon as geometry either: a file with nothing else in it has nothing to send, and the Send dialog never preselects its layer 0 as the exposure layer.
  • Cyclic references are refused at insert time. You cannot place cell A inside cell A, and you cannot place B inside A if A is already (directly or transitively) inside B.
  • Deleting a cell cascades. All SRef/ARef instances of the deleted cell are also removed from every containing cell in the same command. A single Undo restores the cell and every ref that pointed to it. The cascade only removes references to the deleted cell — cells it referenced are not recursively deleted, so a subcell used only by the one you just deleted becomes an orphan top-level cell — a valid top cell in its own right, so Prune unreferenced cells leaves it alone (it is unreferenced, not unreachable); delete it explicitly if you do not want it.

These guarantees mirror KLayout's cell model (refs-by-name, cycle-guarded inserts, cascade-delete) so files written by Glyph load cleanly in other tools.


Updated 2026-11-27

Open Glyph — free, no install Your files never leave your computer.
Open Glyph →