question

Devdatta D avatar image
0 Likes"
Devdatta D asked Matthew Gillespie answered

Add on resource available trigger using code

I am creating transporter object using code in the OnModelReset trigger. I would like to add logic for On Resource Available trigger when I create transporters. how to add the trigger using code?

FlexSim 22.1.1
flexscripttriggerstransporters
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

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

You can use the Object.setProperty() method. For example, this code snippet will give the transporter an OnReset trigger that sets its color to red and an OnResourceAvailable trigger that sets its color to blue:

Object obj = Model.find("Transporter1");
obj.setProperty("Triggers.OnReset", "Dispatcher current = ownerobject(c); current.color = Color.red;");
obj.setProperty("Triggers.OnResourceAvailable", "Dispatcher current = ownerobject(c); current.color = Color.blue;");
5 |100000

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

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.