It shows how to create a library bundle with C source code for your own system functions, which can be integrated into logi.CAD 3.
This is an inofficial guide, and some of the interfaces may not work in later releases!
Furthermore, you will need the "secret" "vendor-libraries.zip" to succeed. (Don´t ask me for it.)
C Programming skills are required. No java programming skills are required.
Do not only read the instructions, also watch the screenshots carefully!
Click on the screenshots to show them with more detail.
Make no use of this information. Have fun!
Step 1: Download Eclipse and Logi.CAD3
"Eclipse for RCP and RAP Developers" is the right package.
The current release "Eclipse Kepler" will be perfectly fine.
Of course you will also need logi.CAD 3 V1.0.0, which can be obtained here
Step 2: Import Project Into Eclipse
Within the empty "Package Explorer", select "Import..."
Select "Existing Maven Projects", and hit "Next".
Now hit "Browse..." and select the folder "vendor-libraries" from the extracted "vendor-libraries.zip".
Hit "Next" button.
Step 3: Finish Importing the Project
Next, you will be asked to install tycho.
Proceed as shown in the screenshots.
Be sure to accept the license agreement, and accept the security warning.
Step 4: Restart Eclipse
Be sure to select the same workspace as before when starting again.
The new library bundle will now be shown within the package explorer, but with many errors.
Step 5: Fix Errors
Select the folder "libs" within "vendor-libraries" from the "vendor-libraries.zip".
Click "Finish" to proceed.
If everything is correct, the tab "Problems" whithin Eclipse should now be empty.
Step 6: Hacking the Library
Note: "*.1wire" (as shown within the screenshots) will not be a valid name. Use ".onewire" instead.
ST code for your vendor blocks needs to be placed within the folder "iecst".
The C-Code for the vendor-blocks must be edited within the folder "code".
Step 7: Use Refactoring for Renaming the Library
Make sure to change the library name at all occurrences as shown within the screenshots.
Use "Rename/Recfactor" (Alt-Shift-R) to give the inernal bundles starting with "com.logicals.library" a new name.
It is very important to rename the library also within the files within "META-INF" and "OSGI-INF".
One mistake here, and the library won´t load!
Use the "Bowse" button to fix the name of the "class" within both xml-files.
The library name should also be changed within "OSGI-INF/ln10".
Step 8: Export the Library Bundle
Select a target-folder and hit "finish".
Step 9: Insert New Library Bundle to Logi.CAD3 Installation
This step need to be done every time the library is changed.
Of course the library can also be exported directly there, but make sure logi.CAD is not running while exporting the library from Eclipse.
Step 10: Activate the New Library Bundle
Insert a line for the new library bundle, example:
Make sure to use exactly the named used before when refactoring within eclipse.
Step 11: Check Library Installation
Click "installation details" and switch to the "plugins" tab.
If your new library is shown within the installed plug-in-bundles, everything is fine.
If not, have fun finding out where the mistake has been made.
Step 12: Test the New Library
At the moment, the "iecst" contents of the new library do not get copied automatically within the project.
So you need to copy the contents of the *.iecst files of your library manually to the "src" folder.
If the library with the new name can be used without showing an error within the "library pragma" (see screenshot), then everything is fine.
Use a vendor block from your new library within the program, open the "PLC" view and hit "upload".
Step 13: Troubleshooting the New Library
It is very likely the you will get compile errors.
To analyze the errors, proceed as following:
Click the small triangle right beside and select "Customize View".
Uncheck the filter for "src-gen" and "target" to make these folders visible.
Within a sub-folder of "target" you will find a file named "comile_result.txt"
Note: It may be necessary to hit F5 to refresh the folder before the contents are shown.
Open this file an find the reason for the compile errors.
At this point, you will need your experience and skill as a C programmer.
The C source code for your new vendor block should be located within the sys-gen folder.
Step 14: Fix the Library
Fix the problems which caused the compile-error, and export the library bundle .jar file again. (Step 8)
Make sure logi.CAD is not running then copying the .jar file into the "plugins" folder.
Repeat these steps until there are no more errors when hitting the "upload" button.