question

Morgan Ulesich avatar image
0 Likes"
Morgan Ulesich asked Matthew Gillespie edited

Object Reference to Object Connected to Output Port Using Port Number

I have an object with many different output ports. Is there a way to get the object reference in the tree by using the output port number?

I tried executing the following string to get object that is connected to Queue1's output port 132, but it does not give me the proper tree reference. "model.find("Queue1>connections/connectionsout/132")"

FlexSim 17.0.3
output porttree access
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
0 Likes"
Matthew Gillespie answered Matthew Gillespie edited

Use the object's outObjects array:

Object queue = model().find("Queue1");
Object connectedObject = queue.outObjects[132];

Or as a single line:

model().find("Queue1").as(Object).outObjects[132];

Often you'll use this code in an object's trigger and can just use current (since Object current is defined in the header):

current.outObjects[132];
· 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.

Morgan Ulesich avatar image Morgan Ulesich commented ·

@Matthew Gillespie Worked like a charm! Thank you!

0 Likes 0 ·