question

Alexander Swinarew avatar image
0 Likes"
Alexander Swinarew asked Jason Lightfoot edited

Setting Number of Bays and Levels in Racks

Hi,

is it possible to change the number of bay, levels etc. in a rack via code? In the previous version, I used the code below. However, since the update to 19.2, it does not work anymore.

Thanks in advance
Alex

//set parameters of racks

Group racks = Group("InputRacks");

int memberCount = racks.subnodes.length;

for (int i = 1 ; i <= memberCount; i++){

Object groupMember = racks[i];
int numBays = 1;
int numLevels = 7;
double bayWidth = 0.5;
double levelHeight = 0.3;
function_s(node("/?Rack", library()), "BasicRefreshTable", groupMember, numLevels, numBays, levelHeight, bayWidth);

}

FlexSim 19.2.0
racks
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

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jason Lightfoot edited

You can use a script like the following:

//set parameters of racks

Group racks = Group("InputRacks");
int memberCount = racks.subnodes.length;
for (int i = 1 ; i <= memberCount; i++){
	Object groupMember = racks[i];
	int numBays = 2;
	int numLevels = 7;
	double bayWidth = 0.5;
	double levelHeight = 0.3;
	double depth = bayWidth;
	
	function_s(groupMember, "setNumBays", numBays);
	function_s(groupMember, "setBaySize", bayWidth);
	function_s(groupMember, "setNumLevels", numLevels);
	function_s(groupMember, "setLevelSize", levelHeight);
	function_s(groupMember, "setNumSlots", 1);
	groupMember.size.y = depth;
}

In 2019 Update 2, we totally changed how the rack object works, so the old script won't work anymore.

· 2
5 |100000

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

Alexander Swinarew avatar image Alexander Swinarew commented ·

Thanks for the reply! This helps a lot.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Alexander Swinarew commented ·

In later versions to avoid function_s calls you can refer to this post.

0 Likes 0 ·