Example: Creating library with blocks incl. help files

If you are creating a custom library with blocks, you might want to include the external HTML block help within this library as well, When a user needs information on a block from the library, the user will be able to open the local HTML help for the block . Conditions for successfully opening the block help are:

  1. creating the external block help

  2. defining the files for the external block help within the library configuration – by using the statement FILE := ...

  3. correctly filing these help files within the library – This is achieved by the keyword SOURCEPATH within the library configuration. See "Declaration of the contents of the library", if you need details on this keyword.

The following example of a library configuration illustrates the required filing of the help files.

Example for a libary configuration with external block help

The following example results in a created library:

LIBRARY com.CompanyA.Controller (* The library is created with the name 'com.CompanyA.Controller__1.1.0-SNAPSHOT.zip'. *)
VERSION := 1.1.0-SNAPSHOT;
PACKAGETYPE := zip;
FOLDER "Motors" (* The library contains the folder 'Motors' and the sub-folder 'Testing'. Hence, the ZIP-file contains: FOLDER\Motors\Testing *)
IEC := com.CompanyA.Controller.Motor1; (* 'Motors" will contain the files 'com.CompanyA.Controller.Motor1' and 'com.CompanyA.Controller.Motor2'. *)
IEC := com.CompanyA.Controller.Motor2;
FILE := ".olh\com.CompanyA.Controller.Motor1.EN.html", SOURCEPATH := "src/"; (* The files for the external block help for 'Motor1' and 'Motor2' - in English. *)
FILE := ".olh\Motor1.png", SOURCEPATH := "src/";
FILE := ".olh\com.CompanyA.Controller.Motor2.EN.html", SOURCEPATH := "src/";
FILE := ".olh\Motor2.png", SOURCEPATH := "src/";
FILE := ".olh\style.css", SOURCEPATH := "src/";
FOLDER "Testing" (* 'Testing" will contain the files 'com.CompanyA.Controller.Test1' and 'com.CompanyA.Controller.Testr2'. *)
IEC := com.CompanyA.Controller.Test1;
IEC := com.CompanyA.Controller.Test2;
FILE := ".olh\com.CompanyA.Controller.Test1.EN.html", SOURCEPATH := "src/"; (* The files for the external block help for 'Test1' and 'Test2' - in English. *)
FILE := ".olh\Test1.png", SOURCEPATH := "src/";
FILE := ".olh\com.CompanyA.Controller.Test2.EN.html", SOURCEPATH := "src/";
FILE := ".olh\Test2.png", SOURCEPATH := "src/";
FILE := ".olh\style.css", SOURCEPATH := "src/";
END_FOLDER
END_FOLDER
BINARY_LIBRARIES FOR BuiltInPlc (* Moreover, the library will contain some binaries, include and source files as well. *)
FILE := "libs\mathlib.lib";
END_BINARY_LIBRARIES
BINARY_OBJECTS FOR BuiltInPlc
FILE := "libs\mathlib.o";
END_BINARY_OBJECTS
INCLUDES
FILE := "h\mathlib.h";
END_INCLUDES
SOURCES
FILE := "code.c" , SOURCEPATH := "c";
END_SOURCES
END_LIBRARY

Details, why the files for the external block help have been specified as above:

  • Each statement FILE := ... that is following one of the statements IEC := ... in the above example is specifying a file for the external block help. These files are the HTML-files, PNG-files and CSS-files that have been generated when the external block help has been created.

  • These files have been generated within the project folder .olh that is located in parallel to the object containing the block and is not visible within the project explorer by default .
    Example: If the object containing the block is located within the project folder src, the files have been generated within the project folder src\.olh. When the library is generated, the files from this folder src\.olh should be used.

  • However, the files for the external block help must not be filed under the folder Motors\src\.olh within the generated library, but under the folder Motors\.olh\ – Thus, the keyword SOURCEPATH with the additional path src is used. Now the respective file is searched for within the folder src\.olh of the current project, but it is filed within the folder .olh in parallel to the object containing the block regarding the library.,

    Good to know

    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg If you are using the statement FILE := "src\.olh\com.CompanyA.Controller.Motor1.DE.html";, the HTML-file would be searched within the project folder src\.olh\ (and found), but it would be filed within the folder Motors\src\.olh\ regarding the library. As the object containing the block is located within the folder Motors, the files for the external block help are not located within a folder .olh that is located in parallel to the object containing the block . Subsequently, the block help would not be opened at all.