#1
09-23-2015
|
Guest
|
|
Posts: n/a
Downloads: 22
Uploads: 0
|
|
Moving folders with user commands when installing from a user library
Hi,
If anyone would want to import the folder structure of their user commands when importing the user commands from a user library then see the answer and the attached .fsl file from Logan at Flexsim support below which explains how to do it.
Axel
Quote:
It is possible to keep the folder structure of the User Commands in the Toolbox, but it's not an automatic process like clicking on the button in the User Commands GUI to add commands to a library for auto install. Instead, it takes some manual coding in the User Library tree to make this happen.
I am attaching a User Library (a .fsl file) to this email as an example of how to do this. To open it, create a new model (so you don't accidentally mess up another model), click on File and then Open User Libraries.
To see the auto installing components of the AutoAddUserCommands library (there are no drag and drop components), click on the arrow next in the AutoAddUserCommands header (or right-click anywhere on the AutoAddUserCommands header) and choose Explore Tree. You should see the newmodelinstall node with 6 subnodes. The first five are the User Commands that are auto installed with each new model and the sixth is the called OrganizeUserCommands.
The OrganizeUserCommands node has an attribute called dropscript that contains the code to auto install the folder structure of the User Commands. If you click on this node, you can see the logic that is used. The first 33 lines are comments on how to use the code and how to use the tree structure of another attribute in the OrganizeUserCommands node called UserCommands. Read over these lines to get a good idea of how to setup something similar with your User Library. I have also included a number of comments with the logic if you want to learn more about the code.
The gist of what is happening is the UserCommands node contains the structure that will be set up in the Toolbox, with nodes like All, A, and B being the folders and the other nodes being which User Commands should be in a particular folder. If you read the comments of the dropscript node you'll get a good idea of how to set up the different folders you want to incorporate into the Toolbox. In the example library, you see a couple of commands in the A folder, a command in the B folder, and both folders contained in the All folder. There is also a fourth command that is part of the All folder. A fifth command is not contained in a folder, so it's not included in the UserCommands structure.
If you wanted to add this functionality to another User Library, you should simply copy over the OrganizeUserCommands node with all its subnodes into the same location of your User Commands in the new User Library. The example has all the User Commands and the OrganizeUserCommands nodes in the newmodelinstall node which means the User Commands and the structure for those commands will be implemented in all new models. If you are using a different way to move your commands to a new model, you may need to do something different with the OrganizeUserCommands library. After copying over this node, you just need to set up the UserCommands tree structure in the way you want the Toolbox to look with your User Commands. Again, reading the dropscript comments should give you a good idea on how to set up the tree structure.
|
|