Tia-Portal-CLI

Generate and import TIA Portal blocks in SCL and ladder

Where an AI agent actually programs the PLC. Blocks arrive as SCL sources or as SimaticML XML, which is the only route to ladder (LAD) and FBD. Writes are previews until --apply, so a generated block can be reviewed before it reaches the project.

46 of the 351 verbs · TIA Portal V19, V20 and V21

tia import-block --file F [--folder A/B] [--replace OLD=NEW ...] [--apply]
See the verb's own --help.
tia import-source --file F.scl [--folder A/B] [--replace] [--apply]
the dry-run lists overwrites
tia add-source --file F.scl [--name N] [--apply]
the source as an OBJECT of the project, kept (unlike import-source, which generates the block and discards the source)
tia delete-source --name X [--apply]
removes the source object
tia import-opcua --kind server|reference --name X [--file F.xml] [--apply]
creates the interface: server empty or +Import when --file comes along
tia delete-opcua --kind K --name X [--apply]
removes an OPC UA interface
tia import-supervisions --file F [--kind supervisions|settings] [--apply]
.xlsx back into the global ProDiag supervisions, or .dat back into the settings with --kind settings
tia db-snapshot --name DB [--file F.xml] [--load|--start-values] [--apply]
snapshot of the actual values of a DB: without a flag it takes the snapshot, --load puts the snapshot back as actual values, --start-values puts the START values back as actual
tia protect-block --name X --password P [--apply]
know-how protection: hides the code of the block behind a password
tia unprotect-block --name X --password P [--apply]
removes the know-how protection
tia add-connection --kind s7|tcp|isoontcp|iso|ptp|udp|fdl|hmi --device D --partner P [--name N] [--subnet S] [--apply]
communication connection between two devices of the project
tia delete-connection --name X [--device D] [--apply]
removes the communication connection
tia import-ladder --file F.scl [--name N] [--folder A/B] [--culture <list>] [--strict] [--force] [--apply]
any SCL FUNCTION or FUNCTION_BLOCK → LAD block, statement by statement
tia import-tags --file F [--folder A/B] [--replace OLD=NEW ...] [--apply]
--replace rewrites the XML before importing
tia delete-tag-table --name "Folder/Table" [--apply]
opposite of create-tag-table
tia create-tag-table --name N [--folder A/B] [--apply]
empty tag table
tia add-tag --table "Folder/Table" --name N --type Bool --address %M10.0 [--comment C] [--allow-overlap] [--apply] | --table T --tag NAME:Type:%addr[:comment] [--tag ...] [--allow-overlap] [--apply]
a tag in an existing table
tia delete-tag --table "Folder/Table" --name N [--apply]
See the verb's own --help.
tia rename-block --name X --to NEW [--apply]
block or UDT
tia set-tag --table "Folder/Table" --name N [--type T] [--address %M10.0] [--comment C] [--rename NEW] [--apply]
only what is passed changes
tia clone --block N | --table T | --file F.xml --replace OLD=NEW [--replace ...] [--keep TAG ...] [--at %M432.0|auto] [--folder A/B] [--with-instances] [--apply]
--file clones an XML template from disk instead of exporting a project object, block or tag table read from the file, so no molde has to live in the project: plan-area and new-drive emit it with the repo templates in
tia add-call --block X --fb NAME [--inst iDB] [--create-inst] [--param P=<tag|DB.path.member|const>] [--after N] [--title T] [--comment C] [--fb OTHER ...] [--out DIR] [--apply]
LAD network with the signal, EN on the powerrail
tia create-prodiag-fb --name X [--folder A/B] [--apply]
empty ProDiag FB
tia set-block-comment --name X [--title T] [--comment C] [--apply]
title and comment of the BLOCK header
tia set-project-comment --comment C [--apply]
comment of the PROJECT
tia set-type-comment --name X [--title T] [--comment C] [--apply]
title and comment of the UDT
tia set-network --block X --index N [--title T] [--comment C] [--apply]
title/comment of an EXISTING network
tia delete-network --block X --index N [--index M ...] [--out DIR] [--apply]
N is 1-based, the numbering of explain-block
tia set-retain --block FB --member M [--off] [--out DIR] [--apply]
retain flag in the declaration of the FB
tia add-db-member --db X --member "A.B.NAME:Type" [--member ...] | --name M [--path A.B] [--type T | --like SIBLING] [--out DIR] [--apply]
--member is repeatable: N members in a single export/compile/import
tia edit-db-member --db X --name M [--path A.B] [--type T] [--rename NEW] [--out DIR] [--apply]
renaming does not update the references to the member
tia delete-db-member --db X --member "A.B.NAME" [--member ...] | --name M [--path A.B] [--out DIR] [--apply]
--member is repeatable, without the type: N members in a single export/compile/import
tia add-fb-param --block FB --param "SECTION.NAME:Type" [--param ...] [--out DIR] [--force] [--apply]
the section is Input|Output|InOut|Static|Temp
tia delete-fb-param --block FB --param "SECTION.NAME" [--param ...] [--out DIR] [--force] [--apply]
repeatable, without the type
tia compile [--block X | --folder A/B | --device NAME] [--errors] [--fail-on-error] [--apply]
--errors = flat list {where,message,count} instead of a tree, warnings when there is no error
tia diff-block --file F.xml [--name X]
read-only, normalized compare
tia doctor [--verb V] [--config F]
read-only preflight of the generative verbs
tia audit [--plc N] [--max 50] [--db "DB GLOBAL"] [--baseline F.json]
project × STANDARD/BEST PRACTICES rules
tia gen-profinet --config F [--apply]
one BOOL communication tag per PROFINET IO-Device mapped in the --config JSON
tia standardize-tags [--config F] [--apply]
renames the %M tags to the house pattern and re-addresses each one into the memory set of its keyword
tia plan-area --name NAME --number N [--id ID] [--panel QA-xx] [--struct S] [--direct-loads N] [--db NAME] [--requirements F.json] [--out DIR] [--apply]
dry: writes <name>-area.steps (tag folders 2.N/3.N, panel I/O tables, the area DB --db, default 'DB <NAME>' upper case, imported from <name>-db.scl into '8
tia new-drive --kind direct|reversing --tag ID --name EQUIPMENT --area NAME --number N --panel QA-xx [--like "TABLE (ID)"] --folder A/B (--di %I<b>.<bit> [--breaker %I<b>.<bit>] --dq %Q<b>.<bit> | --dp DEVICE --dp-kind srw01|ssw900|cfw11) [--dq-reverse %Q<b>.<bit>] [--dp-reversal plc|drive] [--rewire] [--title T] [--fc NAME] [--struct S] [--db NAME] [--out DIR] [--apply]
--dp: the load sits behind a PROFIBUS DP slave whose words recipe 6 made tags (<DEVICE>_DP_ENTRADAS + _DP_CONTROLE, CFW11 _DP_SAIDAS): no panel DI/DQ
tia gen-fault-ob [--config F] [--out DIR] [--apply]
one diagnostic OB per device group named <GroupPrefix>xx, cloned from the repo template
tia replicate-fc --config F [--template FOLDER] [--target-folder FOLDER] [--out DIR] [--apply] [--force]
--template: template from another area
tia gen-alarm-fc [--config F] [--area NAME]* [--out DIR] [--apply]
one alarm-word FC per plant area plus the OB that calls them
tia replicate-instruments --config F [--area NAME]* [--out DIR] [--apply]
one FC per instrument area from the tag folders in --config, with the DB GLOBAL members and the calling OB

Common questions

How do I generate a TIA Portal FB from SCL on the command line?

tia import-source brings the SCL in and tia compile compiles it; tia import-block takes a SimaticML XML block instead. tia audit and tia doctor check the result before you pass --apply.

Can an AI agent write ladder (LAD) into TIA Portal?

Yes, through SimaticML XML with tia import-ladder. Openness has no text form for LAD or FBD, so XML is the only route.

Run these verbs on your own project

Every verb above takes JSON on the way out and plain flags on the way in. Tia-Portal-CLI is local and on-premise: nothing is sent to a cloud service, and every write is a preview until you pass --apply. 14-day free trial, e-mail only, no card.

Start a 14-day free trial

Other verb families