Question on module

Question on module

kevin_a2
Not applicable
206 Views
2 Replies
Message 1 of 3

Question on module

kevin_a2
Not applicable

[ FlexSim 17.2.5 ]

After developed a module, when I open FlexSim (before opening a model), the compiler console shows some Flexscript errors. This is because in an edited node of my module I referred to some objects of a model, which FlexSim sees them as "Undefined" when I am not opening the model. Is there a way to make FlexSim not to "read" the module until I open a model, so that these errors won't pop out when I first open FlexSim?

And here is an unrelated question: I want to clear up the output console everytime I press the reset model button, how can I do that? Thank you very much.

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

mischa_spelt
Advisor
Advisor

There is a Model Open trigger that you can attach your own logic to by creating subnodes (and storing those in the module).

Also you may want to make sure that the code that gets executed is programmed defensively, e.g. checking if the objects exist first and exiting with a return -1 when they don't.

0 Likes
Message 3 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

Don't reference model objects from a module. Modules customize the application. They aren't model-specific. If you want to read a value from within a model, you need to assert it with a default value. You can't assume that the object is there.

In the toolbox, add Modeling Logic > Model Trigger > On Reset with the following code to clear the output console:

clearconsole();


Phil BoBo
Sr. Manager, Software Development