Template projects

From Axel Public Wiki
Jump to navigation Jump to search

LogicLab offers the possibility to create template projects that can be selected when creating a new project. The purpose of template projects is to start from a non-empty project that already contains basic definitions or configurations that can be useful for the PLC programmer.

During the creation of a new project, you can choose whether to create an empty project or a project starting from a template.

Creating template projects

Below are the instructions for preparing and defining a template project.

First, you need to start with a functioning LogicLab project (one that compiles, has no errors, etc.).

  • Close the IDE if it’s running
  • Clean the project to be used as a template by deleting the following directories inside the project folder:
    • Delete the “Build” directory
    • Delete the “ChangeTargetBackup” directory
    • Delete the “Download” directory
    • Delete the “PreviousVersions” directory
    • Delete the “RSM” directory
    • Delete the “Simulation” directory
    • Delete any file that you may have put in the project directory (for example old copies or backup files)
    • We have provided this batch script to automatically clean the project to prepare a template project
  • Copy the clean project folder into the destination PLC directory. For example, if the project target is LLExec, the destination folder will be Catalog\LLExec_2p0\LLExec\PLC. The template project folder in the current example is called LLExec_PlcSample.
  • Define the new template project in the target PCT XML
    • For our LLExec target, we edited the Catalog\LLExec_2p0\LLExec\LLExec_2p0.pct file
    • Add a templateprj node as child of the targetdef XML node. It must be defined like this: <templateprj descr="Your description" caption="Your caption" id="PREFIX_YourName">PLC\LLExec_PlcSample\LLExec_PlcSample.plcprj</templateprj>
    • The node value must be a link to the .plcprj project file (as you can see, it’s a relative path). The id attribute must be unique for any template of any target device; for this reason, it’s recommended to maintain the “PREFIX” prefix. The caption and the descr attributes will be shown in the IDE, in the target templates list.
  • Clean the catalog cache: delete the AlCatalog.LOG and AlCatalog.XML in che Catalog directory


After adding the new node to the XML, you should have something similar to this:

<targetdef>
	<!-- ... -->
	<templateprj descr="LLExec PLC sample application" caption="PLC Sample" id="PREFIX_PLCSample">PLC\LLExec_PlcSample\LLExec_PlcSample.plcprj</templateprj>
	<!-- ... -->
</targetdef>

Then, the result in LogicLab will be this:

Template1.jpg