question

Morgan Ulesich avatar image
2 Likes"
Morgan Ulesich asked Ben Wilson commented

Creating a Large Number of Objects in Model

I am trying to create a very large number of queues (> 5,000) within a model to represent floor storage locations throughout a warehouse.

Is there a good way to automate this process of creating, renaming, and placing the queues? I am aware of creating groups and manipulating that way; however, I am wondering if there is a more automated process of doing this.

Thanks!

FlexSim 17.0.2
create objectlarge model
· 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.

Matt Long avatar image Matt Long commented ·

Is there a reason you don't want to use a Rack?

3 Likes 3 ·

1 Answer

·
Matthew Gillespie avatar image
7 Likes"
Matthew Gillespie answered Ben Wilson commented

You can do this through script. The createinstance command will create an instance of a library object:

Object obj = createinstance(library().find("?Queue"), model());

Here is a script that will create the specified number of queues in a grid and will rename them:

int number = 100;
int yGridSize = 10;
double xSpacing = 3;
double ySpacing = 3;

for(int i = 1; i <= number; i++) {
	Object obj = createinstance(library().find("?Queue"), model());
	obj.name = "Queue" + numtostring(i);
	obj.location.x = floor((i - 1) / yGridSize) * xSpacing + 1;
	obj.location.y = ((i - 1) % yGridSize + 1) * ySpacing;
}
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

@Arun KR created a similar script for programmatic generation of a rack:

https://answers.flexsim.com/questions/36319/automatically-create-rack.html#answer-36355

1 Like 1 ·

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.