question

Nicolas Mbz avatar image
0 Likes"
Nicolas Mbz asked Nicolas Mbz commented

how to evenly distribute objects of different sizes on a line


Is there a function to distribute objects equaly along a space (like in PowerPoint :) )?

1690447154674.png


Before developping it, I prefere to ask. Thanks in advance

FlexSim 23.1.1
objectsspacesdistributing
1690447154674.png (126.3 KiB)
· 1
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

@Nicolas M25, to get them on a line is done by Edit Selected Object tool:

https://answers.flexsim.com/questions/97067/network-node-auto-alignment-option.html

But to distribute them evenly is a matter of coding a custom command.


0 Likes 0 ·
Jason Lightfoot avatar image
2 Likes"
Jason Lightfoot answered Nicolas Mbz commented


Here's an example using the ports to determine the sequence.

arrangeinline.gif



Object obj=Model.find("Source1");
Vec3 gap=Vec3(1,0,0);  //The gap in each direction
Vec3 rot=Vec3(0,0,0);
Vec3 sizeFactors=Vec3(1,0,0);   // control the direction 
Vec3 loc=obj.location+obj.size*sizeFactors+gap;
while (obj.outObjects.length){
    obj=obj.outObjects[1];
    obj.location=loc;
    obj.rotation=rot;
    loc=obj.location+obj.size*sizeFactors+gap;
}

Script_arrangeInLine.fsm


· 1
5 |100000

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

Nicolas Mbz avatar image Nicolas Mbz commented ·
Nice, it's exactly my need, thanks !
0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Nicolas Mbz commented

If they are items, then you can send them into a queue. A queue has a stacking option horizontal line. Then you can evaluate their location and project this data into a diferent object if you want to keep this assembly.

· 1
5 |100000

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

Nicolas Mbz avatar image Nicolas Mbz commented ·

No, it's more about resources (fixed)

0 Likes 0 ·

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.