question

Hao Zhou avatar image
1 Like"
Hao Zhou asked Hao Zhou commented

buildall() cannnot be called in reset trigger

I recently noticed that buildall() command cannot be called in reset trigger. I am using 17.1.1 engine. I guess we have the problem since 17.0 engine. In some of my old models, I was trying to overwrite some trigger scripts in model reset trigger, that is why I need to call buildall() command after script updating.

The problem can be duplicated by two ways:

1. Create a brand new model. Open model on reset trigger. Write code buildall() and click apply. Then hit reset. FlexSim will try to compile the model even there is no any C code in the model. See attached image.

2. Create a brand new model. Drag a random object. Open object's on reset trigger. Write code buildall() and click apply. Then hit reset. You can obverse the same problem.

Could you provide suggestions of fixing this problem?

Thanks, Hao

FlexSim 17.1.1
reset trigger
1.png (10.1 KiB)
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

Logan Gold avatar image
2 Likes"
Logan Gold answered Hao Zhou commented

It looks like no matter where you call the buildall() command, FlexSim needs to compile the model. My guess is FlexSim is using some uncompiled C++ code when it tries to execute the buildall() command, so I bet this is a bug. I will pass it along to the developers and it should hopefully get resolved in our next bug release.

In the meantime, you can try using the buildnodeflexscript() command. It is similar to the buildall() command, except you need to pass in a reference to a specific FlexScript node for it to build. It sounds like you are already changing specific nodes in your code, so you just need to call buildnodeflexscript right after changing a FlexScript node and pass in a reference to that node.

· 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.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

buildnodeflexscript() is also recursive, so you can pass model() to build all the FlexScript code in the model:

buildnodeflexscript(model());
2 Likes 2 ·
Hao Zhou avatar image Hao Zhou Phil BoBo ♦♦ commented ·

Thanks for the suggestion Phil.

0 Likes 0 ·