Click Dialect API
Tier: Dialect Surface
Click prebuilt blocks, aliases, and validation/communication helpers.
Mapping and Runtime Helpers
TagMap
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mappings
|
dict[Tag | Block, Tag | BlockRange] | Iterable[MappingEntry] | None
|
|
None
|
include_system
|
bool
|
Whether to include built-in system tag mappings
(SC/SD points). Default |
True
|
from_nickname_file
classmethod
validate
validate(
program: Program,
mode: ValidationMode = "warn",
profile: HardwareProfile | None = None,
) -> ClickValidationReport
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
program
|
Program
|
The Program to validate. |
required |
mode
|
ValidationMode
|
"warn" (findings as hints) or "strict" (findings as errors). |
'warn'
|
profile
|
HardwareProfile | None
|
Optional hardware capability profile override. |
None
|
Returns:
| Type | Description |
|---|---|
ClickValidationReport
|
ClickValidationReport with categorized findings. |
tags_from_plc_data
tags_from_plc_data(
data: Mapping[str, bool | int | float | str],
) -> dict[str, bool | int | float | str]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Mapping[str, bool | int | float | str]
|
|
required |
Returns:
| Type | Description |
|---|---|
dict[str, bool | int | float | str]
|
|
dict[str, bool | int | float | str]
|
that appear in both data and this TagMap. |
LadderBundle
dataclass
LadderExportError
Bases: RuntimeError
ClickDataProvider
ModbusAddress
dataclass
ModbusReceiveInstruction
dataclass
Bases: Instruction
ModbusRtuTarget
dataclass
ModbusSendInstruction
dataclass
Bases: Instruction
ModbusTcpTarget
dataclass
RegisterType
Bases: Enum
WordOrder
Bases: Enum
NopInstruction
ladder_to_pyrung
ladder_to_pyrung(
source: str | Path | LadderBundle,
*,
nickname_csv: str | Path | None = None,
nicknames: dict[str, str] | None = None,
output_path: str | Path | None = None,
) -> str
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path | LadderBundle
|
A file path (to main.csv or a directory containing main.csv
and optional |
required |
nickname_csv
|
str | Path | None
|
Optional path to a Click nickname CSV file (Address.csv).
Read via |
None
|
nicknames
|
dict[str, str] | None
|
Optional pre-parsed |
None
|
output_path
|
str | Path | None
|
Optional path to write the generated Python file.
If |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The generated Python source code as a string. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
TypeError
|
If |
ladder_to_pyrung_project
ladder_to_pyrung_project(
source: str | Path | LadderBundle,
*,
nickname_csv: str | Path | None = None,
nicknames: dict[str, str] | None = None,
output_dir: str | Path | None = None,
) -> dict[str, str]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | Path | LadderBundle
|
A file path (to main.csv or a directory containing main.csv
and optional |
required |
nickname_csv
|
str | Path | None
|
Optional path to a Click nickname CSV file (Address.csv). |
None
|
nicknames
|
dict[str, str] | None
|
Optional pre-parsed |
None
|
output_dir
|
str | Path | None
|
Optional directory to write the project files into.
If |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dict mapping relative file paths to their content, e.g. |
dict[str, str]
|
|
pyrung_to_ladder
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
program
|
Program
|
The Program to export. |
required |
tag_map
|
TagMap
|
TagMap mapping logical tags to Click hardware addresses. |
required |
Returns:
| Type | Description |
|---|---|
LadderBundle
|
A LadderBundle containing main and subroutine row matrices. |