question

Gilles avatar image
0 Likes"
Gilles asked Felix Möhlmann commented

create diverts on sorter in flexscript

Hello team,

Using flexscript, I want to create a system of conveyors which looks like the image below. it is a sorter with multiple diverts. as you can see here are the specificities which I have no clue how to do that in flexscript.

- diverts on both sides of the sorter

- some diverts are are 90 degree connected to the sorter and some are not

- the sorter itself is not along the x axis neither the y axis

I know how to create a conveyor using flexscript. now I don't know how to position the divert on the left or right at a specific orientation (90d or 60d)

sorter-with-divertsatdifferentangle.png


I really appreciate any help with this.

FlexSim 23.1.0
conveyorsflexscript coding
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

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

Transfer are automatically created between intersecting/touching conveyors. All you need to do is position the end points of the conveyors accordingly.

FlexSim provides a vector class (Vec3 class) that can make some operations (like finding a vector in a 90° angle though the corss product) easier.

The rest would be scaling of the vectors and multiplying them with a rotation matrix.

// Example of how to set the end points of a conveyor
Object conv;
conv.setProperty("StartLocation", Vec3(0, 0, 1)); conv.setProperty("EndLocation", Vec3(10, 10, 1));
· 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.

Gilles avatar image Gilles commented ·

thank you Felix, I did not know about this class Vec3. it looks like, I can achieve my goal with this. my question now is what if conv is not an Object but a treenode? because I tried the line of code below but flexsim does not like it.

  1. conv.setProperty("StartLocation", Vec3(0, 0, 1));
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Gilles commented ·
As long as "conv" does refer to the conveyor node you can cast it as an object. Either as a separate variable or like below.
conv.as(Object).setProperty(...)
0 Likes 0 ·