PLCnext CLI

Concept

The PLCnext CLI (PLCnext Command Line Interface) provides the entire toolchain for C++ programming on the PLCnext Technology platform as well as a template system for creating projects. Based on the templates, you can develop your applications. Use the PLCnext CLI to unpack and manage the SDKs. CMake is contained as the build environment and each SDK has its own configuration. A parser integrated in PLCnext CLI creates the metadata required for PLCnext Technology. The LibraryBuilder contained in PLCnext CLI creates a PLCnext Engineer li­brary from the project.

PLCnext CLI command structure

  • Use the Command Line Interface to call functions by means of simple commands.
  • Activate the PLCnext CLI by calling the plcncli.exe via the shell, e.g.:
  • C:\Program Files\PHOENIX CONTACT\PLCnCLI 2020.0 LTS\plcncli.exe.
  • If you added it to your system "PATH" variable, you can simply use plcncli as a command everywhere in the console.

 

There is a long and a short form for the commands, which you can use as you like:

Long form for the commands

To add the parameters, prefix --.

E.g.: new project --name MyProject1 

CLI_NewProject.png

Short form for the commands

To add the parameters, prefix -.

E.g.: new project -n MyProject1

CLI_NewProjectshort.png
 

Command details

The functions are structured hierarchically. For each command, there is another level of commands that specifies the desired function in more detail. Use the --help command to call a description of the individual functions.
E.g.: new project --help
PLCnCLI

If you do not specify all the parameters, the system will use default parameters. The values will be displayed after the command was executed.
For example, if you do not specify a directory path via the --output option for a new project, a subfolder is created and used in the current directory.

How to

PLCnext CLI command overview

The PLCnext CLI provides the following commands, which you can use to execute the corresponding functions.

Command Meaning
build Compile a project
generate Generate configuration and code files
get Query information about projects, controllers, settings, etc.
set Change settings, e.g. set a project controller
update Update of controllers in the current project
install Install an SDK
show-log Opens the location of the CLI log files.
migrate-old-cli Migrates all caches and user settings from an old CLI installation. NoteNoteUse this command, if you had a previous installation of the PLCnCLI and your settings or already installed SDKs are missing after an update of the PLCnCLI.
new Create new files/projects
deploy Deploy files for production.
help Call additional information about a specific command
version Show version information

Each command can be specified using additional parameters. Commands consist of the fol­lowing:

PLCnext CLI call

Level 1

Level 2

Level 3

plcncli

new

project

-n or --name

If you require information on parameters or additional command levels, you can request them for each level by means of the --help command.

CLI template system:

With the plcncli new command it is possible to add new files or start new projects. These are based on templates, and they are adapted to the current project or pre-configured by additional parameters.

Currently available is the PLM program project template (via plcncli new project) which can be extended by additional programs (via plcncli new program) and components (via plcncli new component).

A second option is the ACF project template (via plcncli new acfproject), and additional ACF components can be added via plcncli new acfcomponents.

For more Information about the project types, please read this.

 

The following example shows an option of how to configure a project up to the complete PLCnext library using the PLCnext CLI:

  1. Open a project folder of your choice:
    e.g., C:\Users\<username>\Documents\CLI Projects.

  2. Generate a new project with the project name Project1:
    plcncli new project –n Project1

  3. Go to the Project1 project folder:
    cd Project1

  4. Select the desired controller for the project (e.g., AXC F 2152):
    plcncli set targets --add -n AXCF2152

  5. Generate metafiles and code files:
    plcncli generate all
    Generate metafiles and code files separatelyGenerate metafiles and code files separately

    Use the following command to generate only the necessary metafiles for the project:
    plcncli generate config

    Use the following command to generate only the necessary code files for the project:
    plcncli generate code

  6. Compile the project.:
    plcncli build

  7. Generate a library for PLCnext Engineer:
    plcncli generate library


The library and the .so files are located in the bin folder of the project.

 

Importing a library

You can then import the generated library into PLCnext Engineer. Click here for a description how to import libraries in PLCnext Engineer.

 

 

 

 


 • Published/reviewed: 2020-06-12 • Revision 32 •