Automated creating or modifying of projects

logi.CAD 3 provides a tool for the automated creating or modifying of logi.CAD 3 →projects.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The tool is intended for usage by an experienced user of logi.CAD 3.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg A condition for the successful usage of the tool is the knowledge of the action to be executed as it would be executed in the graphical user interface of logi.CAD 3.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The output of the tool is in English only.

Preparation

  1. Make sure that logi.CAD 3 is installed. Have the following information prepared:

    • The path to the logi.CAD 3 installation directory

    • The path to a directory that will be used as the workspace
      In case the directory does not exist, the tool creates it.

    • the information for the project that should be created or modified – e.g. the path and name for the project and the project template to be used

    • The path to the log configuration file (see below for more information)
      A sample configuration file is included in the installation of logi.CAD 3.

  2. If the JAVA JDK has not already been installed on your computer, install and unpack the JAVA JDK. In case of an installation, also enhance the environment variable PATH of the operating system by the folder to which the JAVA JDK has been installed/unpacked. In case of doubts, ask your administrator to support you in doing so.

  3. Open a command line: e.g. cmd.exe under Windows and navigate to the logi.CAD 3 installation directory.

Invocation

@REM Commands to start the development environment in English
start cmd /c logicad3.exe -nl en -data <WORKSPACE> -nosplash -vmargs -Dlicenseaccepted=true -Dosgi.requiredJavaVersion=<X.Y> -DLC3useRTS3MetaData=true -Xms256m -Xmx6144m -Dlc3.serverport=50055 -Dlog4j.configuration=file:<LOG-CONFIGURATION>
ping 127.0.0.1 -n 40 1>NUL
 
@REM Command to create the project based on a template
java -jar util\com.logicals.lc3.command.jar -port 50055 --createProject -projectName <PROJECT> -targetPath <PROJECTPATH> -templateName <TEMPLATENAME>
 
@REM Command to modify the project (replace the content of a file in the project)
java -jar util\com.logicals.lc3.command.jar -port 50055 --modifyProject -targetFilePath <FILE_TO_BE_MODIFIED> -sourceFilePath <REPLACEMENT_FILE> -binary
 
@REM Command to delete a file in the project
java -jar util\com.logicals.lc3.command.jar -port 50055 --removeProjectFile -targetFilePath <FILE_TO_BE_DELETED>
 
@REM Command to exit the development environment
java -jar util\com.logicals.lc3.command.jar -port 50055 -shutdown

Description of parameters:

Parameter

Description

Example

<WORKSPACE>

absolute path to a workspace to which the project should be imported
Please note:

  • The directory of the workspace must not be located within a directory that is a logi.CAD 3 project.

  • After the invocation, the workspace will contain a reference to the logi.CAD 3 project. That means that the logi.CAD 3 project is not copied into the workspace.
    This is the same behavior as within the graphical user interface of logi.CAD 3 when you would use the command Import... and the import type Existing Projects into Workspace with the disabled option Copy projects into workspace.

C:\temp\LC3Workspace

<X.Y>

version number of the required Java version
Best practice to determine this version number: Open the file logiCAD3.ini that is located in the installation folder of logi.CAD 3. Search the line with the text -Dosgi.requiredJavaVersion=. Use the specification behind = as the version number.

1.8

<LOG-CONFIGURATION>

path to the log configuration file
All messages of the tool will be output to the device as specified in the log configuration file.

C:\LC3LogConfig\log4j.xml

<PROJECT>

name of the project that should be created

MyProject

<PROJECTPATH>

absolute path to the folder where the project should be created

C:\LC3Projects\

<TEMPLATENAME>

name of the project template which will be the base of the project
The project templates are located in the subfolder
templates\projects of the installation folder of logi.CAD 3.
The name of the project template is specified in the file Lc3Project.templateconf . If the English language variant of logi.CAD 3 is started, enter the English name of the project template. If there a blanks in the name of the project template, enclose the name in "".

"logi.CAD 3 Projekt"

<FILE_TO_BE_MODIFIED>

absolute path and name of the file for which the content should be replaced (= original file)
If this file does not exist, it is automatically created by logi.CAD 3.

C:\LC3Projects\MyProject\TestNotes.txt

<REPLACEMENT_FILE>

absolute path and name of the file the content of which is used for the replacement (= replacement file)
The file name of the original file is kept during the replacement. Referring to the example, this means that the content of C:\LC3Projects\MyProject\TestNotes.txt is replace by the content of C:\Templates\DoneTests.txt. After the command has been invoked, the file TestNotes.txt still exists in the project.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg If the replacement file is a binary file, add the parameter -binary. This parameter -binary is not required for non-binary files (e.g. text files).

C:\Templates\DoneTests.txt

<FILE_TO_BE_DELETED>

absolute path and name of the file which should be deleted
It is not possbile to delete project folder by using this parameter.

C:\LC3Projects\MyProject\GenericTestNotes.txt

  • The parameter -noSplash is optional. If it is not specified, the splashscreen of logi.CAD 3 is displayed after the invocation.

  • The parameter -Dlog4j.configuration is also optional . However, logi.cals recommends to specify this parameter so that log events are output .

  • All other parameters are mandatory. If they are not specified, an appropriate message will indicate that parameters are missing.

Example for invocation
start cmd /c logicad3.exe -nl en -data C:\temp\LC3Workspace -nosplash -vmargs -Dlicenseaccepted=true -Dosgi.requiredJavaVersion=1.8 -DLC3useRTS3MetaData=true -Xms256m -Xmx6144m -Dlc3.serverport=50055 -Dlog4j.configuration=file:C:\LC3LogConfig\log4j.xml
ping 127.0.0.1 -n 40 1>NUL
java -jar util\com.logicals.lc3.command.jar -port 50055 --createProject -projectName MyProject -targetPath C:\LC3Projects\ -templateName "logi.CAD 3 Project"
java -jar util\com.logicals.lc3.command.jar -port 50055 --modifyProject -targetFilePath C:\LC3Projects\MyProject\TestNotes.txt -sourceFilePath C:\Templates\DoneTests.txt
java -jar util\com.logicals.lc3.command.jar -port 50055 --removeProjectFile -targetFilePath C:\LC3Projects\MyProject\GenericTestNotes.txt
java -jar util\com.logicals.lc3.command.jar -port 50055 -shutdown

Log configuration file

This file is needed to configure the log4j logging mechanism. The file specifies how log events are output.

Sample log configuration file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
<!-- This configuration logs to console. -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.out"/>
<param name="immediateFlush" value="true"/>
<param name="encoding" value="UTF-8"/>
<param name="threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p: %m%n" />
</layout>
</appender>
 
<!-- This configuration logs to a file, with more information than for the console. -->
<appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="C:\\temp\\logfile.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss} %-5p [THREAD ID=%t] [Method:%M] %c{1}:%L - %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="console" />
<appender-ref ref="file" />
</root>
</log4j:configuration>