trigger for source

trigger for source

francisco_t
Not applicable
19 Views
2 Replies
Message 1 of 3

trigger for source

francisco_t
Not applicable

Hello everyone! I would like to know what trigger or label I should use so that my source first generates a type 1 resource, then one of type 2 and so on, because if I use the duniform or any of the statistical distributions that appear the resources are generated with values of 1.42, 1.58, etc. and I want them to have exact type values such as 1 or 2. And I also need to know how to make the source give it a specific color according to the type, I know it is a very general question but I can't get it and I already saw All the videos about that on the internet. Thank you!

0 Likes
Accepted solutions (1)
20 Views
2 Replies
Replies (2)
Message 2 of 3

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

On the source add an On Creation trigger and then use the Set Item Type and Color pickoption. This option defaults to using duniform(1,3) which will randomly set the item’s Type label to 1,2, or 3. It then sets the color according to its Type value.



Matthew Gillespie
FlexSim Software Developer

Message 3 of 3

joerg_vogel_HsH
Mentor
Mentor

The statistical distributions starting with a "d" character in there name indicate, that they return integer values (discrete values).

  • duniform( ..)
  • dempirical(..)

if you open a trigger in one of 3D objects' properties, you can add by the green cross icon picklist options. They are predefined source code templates.

22137-basic-item-type-and-color.jpg

One of them is the option "Set Label and Color".
Earlier version called this "Set Type and Color". The default setting sets the Label Type and assign a color to the Object item by the result of Value

duniform(1,3,getstream(current))   

The statistical distribution duniform returns an integer value from the range [1..3] randomly choosen by random generator with seed values of getstream(current).

This integer value will be the value of the label and chooses a color of default array [red, green, blue, yellow, ..] by the index number.

Maybe you try to watch basic FlexSim videos, even if they outdated by now, they still give you a grip on the mechanisms in this simulation tool.

0 Likes