Creating a Large Number of Objects in Model

Creating a Large Number of Objects in Model

morgan_ulesich
Not applicable
158 Views
3 Replies
Message 1 of 4

Creating a Large Number of Objects in Model

morgan_ulesich
Not applicable

[ FlexSim 17.0.2 ]

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!

Accepted solutions (1)
159 Views
3 Replies
Replies (3)
Message 2 of 4

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

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;
}


Matthew Gillespie
FlexSim Software Developer

Message 3 of 4

matt_long
Not applicable

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

Message 4 of 4

Ben_WilsonADSK
Community Manager
Community Manager

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

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