question

Jay K9 avatar image
0 Likes"
Jay K9 asked Jay K9 commented

How to add trigger to 3D object created with flexscript?

I am creating a list of 3D object Queue with flexscript using createinstance() function. For each of it I want to set trigger on enter and exit while I create them to avoid adding them later manually. How can I achieve it?

FlexSim 23.0.15
flexscripttriggerautobuild
· 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 ·
Compare object tree with and without specified triggers. Analyze trigger nodes in tree about datatype and data node.

Alternatively create a template with activated triggers and use this later. You can also put customized objects in a custom library and load it later to a new model.

perhaps you can edit a property table or do a query about a property table to insert missing triggers.

0 Likes 0 ·

1 Answer

Arun Kr avatar image
1 Like"
Arun Kr answered Jay K9 commented

Use setproperty() to add triggers by code. This will work in future versions also.

Object Queue =Model.find("Queue1");
string y ="Object current = param(1);";//code as string
Queue.setProperty("Triggers.OnEntry",y);
· 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.

Jay K9 avatar image Jay K9 commented ·
Exactly what I was looking for. Thank you!
0 Likes 0 ·