Uploading a custom library.

Uploading a custom library.

martin_k5
Not applicable
80 Views
14 Replies
Message 1 of 15

Uploading a custom library.

martin_k5
Not applicable

[ FlexSim 23.2.3 ]

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

0 Likes
Accepted solutions (1)
81 Views
14 Replies
Replies (14)
Message 2 of 15

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

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.

Message 3 of 15

martin_k5
Not applicable
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
Message 4 of 15

Jeanette_Fullmer
Community Manager
Community Manager

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
Message 5 of 15

martin_k5
Not applicable
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
Message 6 of 15

jason_lightfootVL7B4
Autodesk
Autodesk
Can you upload the library? We'll take a look a the paths and dropscript.


0 Likes
Message 7 of 15

martin_k5
Not applicable

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
Message 8 of 15

jason_lightfootVL7B4
Autodesk
Autodesk

I tend to put everything in newmodelinstall since that is always called.

After you've scripted your global variable creation, call refreshglobalvariables();

You can also put your global variable tree somewhere in your library and iterate through the subnodes, copying them into the model global variables - it's easier to set up a large number that way (using the model GUI interface).

0 Likes
Message 9 of 15

martin_k5
Not applicable

Thanks, but when I put everything in newmodelinstall and open an empty model by opening FlexSim and clicking on a New Model button, then I have to load the user library by the dedicated command. However the global variables are not installed even if I add the refreshglobalvariables();

0 Likes
Message 10 of 15

jason_lightfootVL7B4
Autodesk
Autodesk

Sorry - maybe openmodelinstall needs to also fire the dropscript.

You can ensure the library is always loaded by listing it for startup install in Global Preferences.

0 Likes
Message 11 of 15

martin_k5
Not applicable
And how can I fire the dropscript by openmodelinstall?


Yes, I know that I am able to make the autoload of the library in Global Preferences, but the problem is still the same. I can't import it while not having set the global variables that are used in the User Library.

0 Likes
Message 12 of 15

jason_lightfootVL7B4
Autodesk
Autodesk

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
Message 13 of 15

martin_k5
Not applicable
Great, thank you for the provided example. Just to clarify, when I l theoad user library by the "loaduserlibrary()" command, no global variables nor global tables are installed. To have them install, I have to click on the little arrow next to the loaded user library and hit the "Install Library's Auto Install Components" button. Is this the proper way?
0 Likes
Message 14 of 15

jason_lightfootVL7B4
Autodesk
Autodesk

You can run with the option to autoinstall using the user command:

loaduserlibrary(modeldir()+"/exampleuserlibinstaller.fsl",0,0,0,1);


0 Likes
Message 15 of 15

Jeanette_Fullmer
Community Manager
Community Manager

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