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.

  1. int conin;
  2. int conout;
  3. int concenter;
  4. conin = ??; //Number of Connections in.
  5. conout = ??; //Number of Connections out.
  6. 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.

  1. Object obj = model().find("Queue1");
  2. int conIn = obj.inObjects.length;
  3. int conOut = obj.outObjects.length;
  4. 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.