blark.solution.TwincatTsProject

class blark.solution.TwincatTsProject(guid: str, netid: str, path: Path | None, plcs: list[TwincatPlcProject])[source]

Bases: object

Container for a loaded TwinCAT tsproj project.

This is typically instantiated after the Solution parser generates a Project instance. This contains information about the target PLC and all loaded PLC projects.

Methods

__init__(guid, netid, path, plcs)

from_filename(filename)

Load a tsproj project from its filename.

from_xml(tsproj, root[, filename])

Load a tsproj project from its XML source.

Attributes

file_extension

plcs_by_name

A dictionary of PLCs by name.

guid

The globally unique identifier for the tsproj.

netid

The AMS Net ID of the target PLC.

path

The path to this project on disk.

plcs

PLC projects (.plcproj) part of this tsproj.

file_extension: ClassVar[str] = '.tsproj'
guid: str

The globally unique identifier for the tsproj.

netid: str

The AMS Net ID of the target PLC.

path: Path | None

The path to this project on disk.

plcs: list[TwincatPlcProject]

PLC projects (.plcproj) part of this tsproj.

property plcs_by_name: dict[str, TwincatPlcProject]

A dictionary of PLCs by name.

Returns:
dict[str, TwincatPlcProject]
classmethod from_xml(tsproj: Element, root: Path, filename: Path | None = None) Self[source]

Load a tsproj project from its XML source.

Parameters:
xmllxml.etree.Element
filenamepathlib.Path
Returns:
TwincatTsProject
classmethod from_filename(filename: Path) Self[source]

Load a tsproj project from its filename.

Parameters:
filenamepathlib.Path
Returns:
TwincatTsProject
__init__(guid: str, netid: str, path: Path | None, plcs: list[TwincatPlcProject]) None