question

Allyson avatar image
0 Likes"
Allyson asked Jason Lightfoot edited

How to check whether a treenode pointer reference is an object or a flowitem?

I have a model where I have messages being sent to a FR object, where the message sender is either a flowitem or another FR object. The FlexScript code that is triggered by the message will need to have two different execution paths depending on whether the sender is a flowitem or an object. Is there a way to know this? I know of the isclasstype() command, but I'm not sure if it's possible to use this command to check for reference to a flowitem (since flowitems don't have a class attribute node). I'm assuming not. If not, I'm not sure what I can use.

I'm doing this in FlexScript so I'm looking for the specific command reference if possible.

Thanks in advance!

FlexSim 23.1.0
flexscriptitemobjecttypeclass
· 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.

1 Answer

Jason Lightfoot avatar image
2 Likes"
Jason Lightfoot answered Jason Lightfoot edited

The correct way to test for a flowitem is to check the existence of the 'itemtype' node.

  1. objectexists(itemtype(object))

Since taskexecuter flow items have a class node, testing for the class alone isn't strictly enough.


If you do want to test for an object being classless you can use:

  1. object.getProperty("Class")==NULL;
· 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.