question

Robin Brunner avatar image
0 Likes"
Robin Brunner asked Robin Brunner commented

Count Subtreenodes by Code

Hello Community,

my question is: How can I count treenodes by code? I want to count the connections in, out and center by code and save them into an integer.

int conin;
int conout;
int concenter;
conin = ??; //Number of Connections in.
conout = ??; //Number of Connections out.
concenter = ??; //Number of Connections center.

Does anyone know how to do this?

Regards, Robin

Choose One
treenodecounting
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
6 Likes"
Matthew Gillespie answered Robin Brunner commented

The Object class has inObjects, outObjects, and centerObjects properties for accessing objects connected to the object with port connections. These properties also have a length property so you can look up how many objects are connected with each type of port connection.

Object obj = model().find("Queue1");
int conIn = obj.inObjects.length;
int conOut = obj.outObjects.length;
int conCenter = obj.centerObjects.length;
· 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.

Robin Brunner avatar image Robin Brunner commented ·

Thank you very much :)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.