blark.solution.TwincatPlcProject

class blark.solution.TwincatPlcProject(guid: str, xti_path: Path | None, plcproj_path: Path | None, properties: dict[str, str], dependencies: dict[str, DependencyInformation], sources: list[TwincatSourceCodeItem])[source]

Bases: object

A TwinCAT PLC project.

This typically corresponds to a single .plcproj file.

Methods

__init__(guid, xti_path, plcproj_path, ...)

from_filename(filename)

Load a plcproj from its filename.

from_project_xml(xml, root)

Load a plcproj from the tsproj itself.

from_standalone_xml(tsproj_or_xti_xml, ...)

Load a PLC project from standalone XML code.

from_xti_filename(xti_filename)

Load a .plcproj from its XTI contents.

Attributes

file_extension

name

The project name.

guid

The globally unique identifier for the tsproj.

xti_path

Path to an XTI file for the project.

plcproj_path

The PLC Project - plcproj - path.

properties

plcproj-defined properties (name, project build, etc.)

dependencies

Dependencies for the PLC project.

sources

Source code parts which blark can extract information from.

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

The globally unique identifier for the tsproj.

xti_path: Path | None

Path to an XTI file for the project.

plcproj_path: Path | None

The PLC Project - plcproj - path.

properties: dict[str, str]

plcproj-defined properties (name, project build, etc.)

dependencies: dict[str, DependencyInformation]

Dependencies for the PLC project.

sources: list[TwincatSourceCodeItem]

Source code parts which blark can extract information from.

classmethod from_standalone_xml(tsproj_or_xti_xml: Element | None, plcproj_xml: Element) Self[source]

Load a PLC project from standalone XML code.

Parameters:
tsproj_or_xti_xmlOptional[lxml.etree.Element]

lxml-loaded .tsproj or .xti contents.

plcproj_xmllxml.etree.Element

lxml-loaded .plcproj contents.

Returns:
Self

[TODO:description]

property name: str | None

The project name.

classmethod from_filename(filename: Path) Self[source]

Load a plcproj from its filename.

Parameters:
filenamepathlib.Path
Returns:
Self
classmethod from_xti_filename(xti_filename: Path) Self[source]

Load a .plcproj from its XTI contents.

Parameters:
xti_filenamepathlib.Path

XTI filename.

Returns:
Self
classmethod from_project_xml(xml: Element, root: Path) Self[source]

Load a plcproj from the tsproj itself.

The loading procedure typically happens in the following order:

Solution -> tsproj -> xti -> plcproj

Parameters:
xmllxml.etree.Element
rootpathlib.Path

The root path to load files from the project.

Returns:
Self
__init__(guid: str, xti_path: Path | None, plcproj_path: Path | None, properties: dict[str, str], dependencies: dict[str, DependencyInformation], sources: list[TwincatSourceCodeItem]) None