The API chapter documents the LayoutEditor's own classes: layout, schematic, 3d, dialogs, layers, and so on. Those classes are the same in C++ macros and in Python (LayoutScript). This chapter is about everything outside that core: C libraries that a C++ macro can load, the ngspice simulator plugin, and — for Python — the fact that the rest of the Python ecosystem is available but not listed here.
A C++ macro can reach beyond the LayoutEditor classes in two ways.
#include <…>)From LayoutEditor version 20260918, an angle-bracket include loads a binding plugin. It does not open a system header such as /usr/include/math.h and it does not paste C into the macro. The line
#include <math.h>
means: find the plugin that registered the header name math.h (here pluginBindingMath), load it, and make its functions and constants visible (sin, M_PI, …). If that plugin is not installed, compilation stops with an error. There is no silent fallback to the C library on the host.
Quoted includes are unchanged and are not part of this chapter:
#include "helpers.layout" // inserts another macro file as source
The LayoutEditor classes (layout, point, cell, math, file, stdlib, …) still need no include. You add #include <…> only when you want the C names (sin next to math::sin, fopen next to the file class, and so on). Several C and C++ header names map to the same plugin (<math.h> and <cmath>, <stdio.h> and <cstdio>, …).
The bindings are a subset of a desktop C library. Templates, printf varargs, malloc / exit, and strcpy / strcat are out of scope. Some calls differ from ISO C on purpose so they fit the macro language (for example fgets(fp, maxLen) returns a string; localtime copies into a tm you own). Each library page lists what is bound, what is not, and a complete example.
Bundled plugins ship with the editor. Further libraries can be added as Qt plugins in ~/LayoutEditor/plugins (Windows: %USERPROFILE%\LayoutEditor\plugins). LayoutEditor looks in that home folder first. Do not copy plugins into layout.app on macOS (that breaks the signature). Please contact LayoutEditor support for help and example code for such an extension: support@layouteditor.com.
The class ngspice is not an #include. It is a LayoutScript class that talks to pluginNgspice, the in-process circuit simulator shipped with the same LayoutEditor release. All ngspice objects share one simulator instance. You load a netlist (loadCircuit / loadFile), run it, and read waveforms with results() as plotData. Do not spawn an external ngspice process. The menus Utilities → NGSpice use the same plugin; this chapter documents the scripting API.
Python scripts use the same LayoutEditor API as C++ macros (from LayoutScript import *). On top of that, any other Python library can be imported: the standard library (json, math, pathlib, …) and third-party packages (numpy, pandas, …) if they are installed for the interpreter that runs the script.
Those packages are not described in this chapter. Use their own documentation. The pages below are the C++ binding plugins and the ngspice class; they are not a catalogue of import modules.
Two details matter in practice:
import the bundled standard library. Extra packages must be available inside that environment (see pythonEnv and Scripting in Python).The ngspice class is available in Python as well (sim = ngspice()). For math, files, time and compression, prefer native Python modules instead of the C #include plugins — those plugins exist for C++ macros only.
<ctype.h> / <cctype>) — isdigit / toupper (character codes)<errno.h> / <cerrno>) — get_errno / set_errno<math.h> / <cmath>) — trigonometry, exp / log, rounding, M_PIpluginNgspice)<stdint.h> / <stddef.h> / <stdbool.h>) — INT32_MAX, NULL<stdio.h> / <cstdio>) — fopen / fgets / fputs (no printf)<stdlib.h> / <cstdlib>) — atoi / atof / abs (no malloc, exit, system)<string.h> / <cstring>) — memcmp / memcpy (not strcpy)<time.h> / <ctime>) — time, localtime, strftime<zlib.h>) — compressText / uncompressText and the stream API