question

Rich G6 avatar image
0 Likes"
Rich G6 asked Rich G6 commented

How can I write the name and rank of an object into a global table?

For example, on a simple model that only contains a Source1 and Queue1, how can I write the name and rank of the object seen in the Model tree into a global table? In the model tree, the rank of Source1 is 3 and the rank of the Queue1 is 4 (which come after 'FlexsimModelFloor' in the Model tree).

What custom code can I write using the User Commands interface to write the name and rank of an object?

FlexSim 21.1.5
name and rank
5 |100000

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

1 Answer

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Rich G6 commented

You use the .name and .rank properties on a treenode or Object. For example, this script will print the names and ranks of all objects in the model level:

Table table = Table("GlobalTable1");
int numObjects = model().subnodes.length - 1;
table.setSize(numObjects, 2);
for (int i = 1; i <= numObjects; i++) {
    Object obj = model().subnodes[i + 1];
    table[i][1] = obj.name;
    table[i][2] = obj.rank;
}
· 1
5 |100000

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

Rich G6 avatar image Rich G6 commented ·
Thank you Matthew! This worked. This is going to help me out on my other models.
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.