Skip to content

Linking libraries

If a subsystem is located in a different model file (“library”) and referenced from the current one, itemis Model Viewer must know where to find the library in order to display that subsystem correctly or to navigate to it. itemis Model Viewer supports an automatic lookup mechanism plus a manual one for those cases not covered by the automatic library lookup.

Automatic library lookup

Typically, your library files will reside somewhere “near” your model file, for instance in the same folder, or in a child folder. itemis Model Viewer will search directories “near” your model directory automatically. By default, it does so by searching all subfolders of the model directory for the needed library, up to a depth of two directory levels.

Let’s consider an example and assume your model is in some/cool/devices/soapbox/brakes.mdl and references an object in MyLibrary, which has to be resolved. Starting here, itemis Model Viewer searches this directory and all its descendant directories for the files MyLibrary.mdl and MyLibrary.slx. For example, if there is a file some/cool/devices/soapbox/libraries/MyLibraries.mdl, itemis Model Viewer will find it. However, if MyLibraries.mdl resides in __some/cool/devices/soapbox/libraries/a/b/c/d/e_, it won’t be found, because the subdirectory depth is limited to two; at least that’s the default.

You can change the default settings in the preferences. For example, to instruct itemis Model Viewer to restrict the subdirectory search to a depth of three, do the following:

  • In the main menu, select Window → Preferences. The Preferences dialog appears.
  • In the navigation area on the left, select itemis Model Viewer.
  • Enter the value 3 into the Number of sub-directories searched for libraries field.
  • Click on the OK button.

Setting the library search preferences

Setting the library search preferences

Setting the field to 0 restricts the automatic library search to the directory the model resides in.

Manual library lookup

If your library is out of the range of the automatic library lookup mechanism and you can’t or won’t change the preferences, you can still manually point itemis Model Viewer to the library file or to a folder.

Figure "Manual library lookup [1]" shows a model that references a subsystem named RefSubsystem. This subsystem is defined elsewhere, denoted by the chain symbol in the lower left of the subsystem rectangle. However, the subsystem definition cannot be found. It is thus represented by a red, dashed rectangle that is labeled “Bad Link”.

Manual library lookup [1]

Manual library lookup [1]

To resolve the “bad link”, double-click on RefSubsystem. A file or folder selection dialog will appear (not shown here). Navigate to the library file or folder and select it.

Please note: By default, the file selector looks for a library file with the extension .mdl. If your library is an .slx file, you might have to toggle the settings in the file selection dialog in order to be able to see and select that file.

After selecting the library file, itemis Model Viewer loads the element and displays it in the main view:

Manual library lookup [2]

Manual library lookup [2]

Going up one level again, the model no longer shows a bad link, but rather the resolved element:

Manual library lookup [3]

Manual library lookup [3]