linkcad.env
Options and logging utilities for scripts and plugins.
from linkcad.env import ( get_option_boolean, set_option_boolean, get_option_int, set_option_int, get_option_real, set_option_real, get_option_string, set_option_string, EventLog, Severity,)Options
LinkCAD stores persistent format and tool options under string keys (e.g. "GdsiiInFlattenAll"). The functions below let scripts read and override these values without opening the Options dialog.
Functions
| Function | Description |
|---|---|
get_option_boolean(name, default) | Read a boolean option; returns default if not set |
set_option_boolean(name, value) | Write a boolean option |
get_option_int(name, default) | Read an integer option |
set_option_int(name, value) | Write an integer option |
get_option_real(name, default) | Read a float option |
set_option_real(name, value) | Write a float option |
get_option_string(name, default) | Read a string option |
set_option_string(name, value) | Write a string option |
from linkcad.env import get_option_boolean, set_option_boolean
# Check whether GDSII import flattens hierarchyflatten = get_option_boolean("GdsiiInFlattenAll", False)print(f"GDSII flatten: {flatten}")
# Temporarily overrideset_option_boolean("GdsiiInFlattenAll", True)Logging
EventLog
The application event log. Messages written here appear in the LinkCAD log panel.
from linkcad.env import EventLog, Severity
log = EventLog.instance()log.log(Severity.Info, "Processing complete")log.log(Severity.Warning, "Layer 'TEMP' will be deleted")log.log(Severity.Error, "Could not open file")| Method | Description |
|---|---|
EventLog.instance() | Class method — get the singleton log instance |
log.log(severity, message) | Write a message with the given severity |
Severity
Log message severity levels.
| Value | Description |
|---|---|
Severity.Info | Informational message |
Severity.Warning | Non-fatal warning |
Severity.Error | Recoverable error |