question

Martin K5 avatar image
0 Likes"
Martin K5 asked Jason Lightfoot commented

Uploading a custom library.

Hi,

I would like to ask regarding the custom library upload. My custom library is dependent on various global variables and global tables that are set in the current model. When uploading this library in a new model, collisions appear (undefined variables). Is there a way to prepare these variables before uploading the custom library but not doing it separately? If I can for example encapsulate this settings script into the custom library that will be triggered before the upload? I know that there is the possibility to do some post settings by a dropscript. In worst case scenerio, I can do it set up the model manually and then upload the library but it devaluates the efficiency of a custom library.


Thank you,


Martin

FlexSim 23.2.3
codeuser libraryimport
· 8
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Hi @Martin K5, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·
Martin K5 avatar image Martin K5 commented ·
I was able to use the newmodelinstall node including the Custom object with the dropscript node. At this point I have defined some auto install components (adding global variables) and I have also included the Global Table to auto install as well (using the dedicated icon).


When I navigate through File -> New Model, from the existing one, where the user library is loaded, the user library is initially loaded as well but only the Global Table is automatically installed without the global variables.


Am I missing anything?


Thank you,

Martin

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Martin K5 commented ·
Can you upload the library? We'll take a look a the paths and dropscript.


0 Likes 0 ·
Martin K5 avatar image Martin K5 Jason Lightfoot ♦ commented ·

Yes, of course. Here is the sample user library.

I have managed to do the autoinstall when creating a new model from an existing one, but when I would like to autoinstall the specified components by simply loading the user library (with the "loaduserlibrary" command) in a new model and dragging the dedicated object on the ground, which command should I use from these: startupinstall, loadinstall, openmodelinstall?

testLib.fsl

0 Likes 0 ·
testlib.fsl (2.3 KiB)
Show more comments

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot commented

You can add global tables to your user library for automatic install easily since they have the icon for it in their properties: 1715093589318.png

The rest you can install using the newmodelinstall folder dropscript on a dummy object. I will try to find an example to upload to make this simpler for you.

In the meantime you might find the documentation on Custom Libraries helpful.

Edit: If you're adding global variables in the dropscript call 'refreshglobalvariables()' afterwards.


1715093589318.png (1.1 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Martin K5 avatar image Martin K5 commented ·
Great, thank you for the provided information. I will try to use the dedicated icon for adding global tables in the user library.


As for the example, I would really appreciate it as I have already tried the "newmodelinstall" node (not in the combination with dropscript) and unsuccessfully.

Thank you.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Martin K5 commented ·

Here's an example that autoinstalls a global table, global variable and macro to a new model or one that your open, or one that is already open when you load the library.

ExampleUserLibInstaller.fsl

It seems you need a duplicate table under openmodelinstall - the way around this would be to put a custom node GlobalTables into the libstruct node and use the dropscript to refer to any tables under that node instead.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.