question

Łukasz E avatar image
0 Likes"
Łukasz E asked Łukasz E commented

How to edit packing method ro rotate object

How to edit the packing method to achive this result?pz-packing.fsm

36 pcs per Layer and 16 Layers up -> 576 items on 1 "pallet"

How to rotate propare item and set a space between 2nd and 3rd row?



FlexSim 20.2.3
combinerflexsim 20.2.3packing methodrotate some items
1608114196024.png (488.9 KiB)
1608114567282.png (17.2 KiB)
pz-packing.fsm (133.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

·
Patryk avatar image
3 Likes"
Patryk answered Łukasz E commented

By using "Edit packing method " in flow item bin you can create new packing method or change exsidted packing method by writing the code on " custom code".


Then you also have to change the packing method at palleta in flow item bin.


1608118937877.png (205.9 KiB)
1608119311401.png (263.2 KiB)
· 7
5 |100000

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

Łukasz E avatar image Łukasz E commented ·

But how to rotate by 180 degrees the 1st and 3rd row and make the space between 2nd and 3rd row?

0 Likes 0 ·
Patryk avatar image Patryk Łukasz E commented ·

You can try use this code.

In attached I send you the model.

element.skp

Packing method.fsm

1 Like 1 ·
1608123057080.png (69.1 KiB)
1608123105478.png (395.9 KiB)
element.skp (75.2 KiB)
packing-method.fsm (68.6 KiB)
Łukasz E avatar image Łukasz E Patryk commented ·

Great! Thank you so much, I change some locations for myself and how to flip the space? Because for me the space is between rows (and now is between columns), and z dimension. Next Layers go 0.1 to much "up". where to change those things?


Object item = i;
Object current = c;
Object lastitem = item.prev;
/**Default Packing Method*/

// Check to see if the flowitem is the first one in
if (current.subnodes.length == 1) {
item.setLocation(0.05, -0.1, current.size.z);
item.setRotation(0,0,180);
return 0;
}

//First row
double xlength = 0;
double ynumer = 0;
double xnumer = 0;
double znumer = 1;
int space =0;
for (int i = 1; i <= current.subnodes.length; i++) {
xlength = xlength+item.size.x;
if(xlength<=current.size.x){
space = ynumer/2;
if(ynumer==0&&xnumer==0&& znumer==1){
xnumer++;
}
xnumer++;
item.setLocation(xlength-item.size.x+0.1, -ynumer*item.size.y-space*0.2-0.1, current.size.z*znumer);
item.setRotation(0,0,180-180*Math.fmod(xnumer,2));
} else {
ynumer =ynumer+1;
if(ynumer<4){
xlength =item.size.x;
xnumer= 0+ Math.fmod(ynumer,2);
space = ynumer/2;
item.setLocation(xlength-item.size.x+0.05, -ynumer*item.size.y-space*0.2-0.1, current.size.z*znumer);
item.setRotation(0,0,180-180*Math.fmod(xnumer,2));
}else {
ynumer = 0;
znumer ++;
xlength =item.size.x;
xnumer= 0+ Math.fmod(ynumer,2);
space = ynumer/2;
double xnumer = 0;//pierwszy na górnej warstwie
item.setLocation(xlength-item.size.x+0.05, -ynumer*item.size.y-space*0.2-0.1, current.size.z*znumer-0.1);
item.setRotation(0,0,180);
}
}
}

0 Likes 0 ·
1608126347898.png (328.7 KiB)
Show more comments

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.