question

Wang Z2 avatar image
0 Likes"
Wang Z2 asked Joerg Vogel answered

create rack with code in user command

user-command.fsm

I use the code to create racks in script console,and it works.

But when I use the same code in User command,it doesn't work.

I don't know why.

/**Custom Code*/

int number = 60;// 列数
int numBays = number/3;
int numLevels = 12;// 层数
double bayWidth = 0.54; // 单列宽
double levelHeight = 0.5;// 单层高
treenode libraryRack = library().find("?Rack");
Object firstRack = createinstance(libraryRack, model());//创建货架

function_s(libraryRack, "BasicRefreshTable", firstRack, numLevels, numBays,  levelHeight, bayWidth);//创建规定尺寸的货架

for(int i = 2; i <=3 ; i++) {   
	Object obj = createcopy(firstRack, model(), 1, 0, 1, 0); // 复制货架
	obj.name = "Rack1" + numtostring(i);
	obj.location.x = 1*(i-1)+(i-1)*numBays*bayWidth;
	obj.location.y = 0;
}
    
FlexSim 18.2.2
user command
user-command.fsm (16.4 KiB)
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

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

It took me some time but it is so obvious:

command1();

and not just

command1; 
5 |100000

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