question

Mike avatar image
0 Likes"
Mike asked Mike commented

Customizing the location of the combining items

Hi All,

Greatly appreciated if you could help me script for the below;

I use a combiner to pack 3 pieces of square pieces (blue ones) onto a container flow item (yellow one). However, I want to customize the position of those 3 items on the container flow item panel. Please refer to the picture for further detail.

Thanks a lot.

Regards,

Mikecustomizing-the-position-of-the-combiner-joint-ite.png

FlexSim 23.0.3
combinercustomize location of items
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @Mike, was Felix or Joerg Vogel's answers helpful? If so, please click the "Accept" button at the bottom of the answer that helped you most. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Mike avatar image Mike Jason Lightfoot ♦♦ commented ·

Hello Jason,

It would be greatly helpful if you could help me with sample code. Thanks.

Regards,

Mike

0 Likes 0 ·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Mike commented

Here's an example that uses the rank (the number that you would use in "current.subnodes[rank]" to access the items inside the container object) to place the three items at different locations.

The way the offset factors in the setLocation method work can take a bit of time to get used to.

packing_logic_example_fm.fsm


· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Changed to approximate your picture's positions.

packing-logic-example-fm2.fsm

0 Likes 0 ·
Mike avatar image Mike commented ·
Awesome! Thanks a lot.
0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Jason Lightfoot commented

It is not a feature of your combiner it is a feature of your container flow item. You can change the stacking algorithm source code in Flow item bin Tool of your container.
https://docs.flexsim.com/en/23.1/Using3DObjects/WorkingWithFlowItems/UsingContainerFlowItems/UsingContainerFlowItems.html

· 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.

Mike avatar image Mike commented ·

Dear Joerg,

Thanks a lot for quick response. First of all, I should have written "pack" instead of "join". However, the question is the same.

Yes. Understood your suggestion. Anyway, I need a code example to try. I am trying to my best knowledge of coding but it doesn't work because I don't know how to refer to the content of the container flow item bin.

The panel is the container flow item. So we can refer in the code as "current.subnodes[1], right?

How to refer to the content of the container bin? Thanks.

Regards,

Mike.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Mike commented ·

In the packing method code you can see what's being used from the header at the top:

Object item = i;    // the new item that needs packing
Object current = c;  // the container which called this packing method
Object lastitem = item.prev;   // the previous item to enter providing tree rankjs have been preserved (often used to reference location)


0 Likes 0 ·