Load a new Library

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
Chiara
Posts: 30
Joined: Thursday 20 September, 2012 - 09:40

Load a new Library

Post by Chiara »

Hello,
I'm working on my model with a new library I created, but when I change the .lbr file I have to make attention on the sequence I tell ED to laod amtoms, in order to avoid loading errors on opening ED. If ED loads an atom that refers to functions written on an other atom I receive a message on the error monitor and atoms are loaded but don't work properly. So, the question is: there's a way to make not important the loading order of the atoms in the library? This is very important for me because I have many atoms that refer to other atoms to which they refer.

Regards,
Chiara
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: Load a new Library

Post by MatthijsJongboer »

Hello Chiara,
For the loading of your own created atoms, we have created a special user file where you can add them to the library.
Be advised: the library (.lbr) files we supply with the software are subject to change so you might loose your modifications with the next update.
The user file is located here: pDir\Apps\ED.usr
Simply put a line with the format

Code: Select all

library,execfile(pdir([atoms\myatom1.atm]))
in the {{startup section}}.

Now, when your atoms still give problems, consider if your functions are implemented on the correct location. When possible, create the functions on the atom it is used.
If this still gives problems, there is way to prevent declaration problems. The 4DScript word to use is 'PreregisterFunction'.
Note that it only registers the function into the language system before they are implemented. In case of multiple (or even library wide) functions, you can use the 'create preregister file' button that creates a file containing all functions from the library.
The 'create preregister file' button:
Will create a preregister function file of all functions in the library (in the oninit as well as the ones on atoms).
The user will be asked for the name of the library. From this a file is created: libraryName_Preregister.4ds.
The file is saved in:
  • - Pdir([Libs]) if the workdir is set to pdir([Work]).
    - Else in WorkDir([Libs]).
I hope this helps to solve your problems.
Post Reply