question

Joerg Vogel avatar image
0 Likes"
Joerg Vogel asked Jordan Johnson commented

Assigning spatial treenode to Table Class in Flexscript

I can explore the spatial treenode in an object modeltree as a table. When I try to get access to the same node by flexscript and evaluate it as a table I get only the row headers without any values. How can I evaluate the treenode spatial as a table by code?

FlexSim 17.1.4
tabletable classtreenode cast
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

·
Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Jordan Johnson commented

The Table class was not designed to work this one-dimensional tables. To access the nodes, you can still use bracket syntax with the subnodes object:

someNode.subnodes[3] // or someNode.subnodes["childNodeName"]

To copy the list of nodes, the createcopy() command is still the easiest way.

· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Thank you @jordan.johnson, for the answer, I was looking for a different method to copy more than one value of the offsets or spatials to another object, because the order is the same of the locations, rotations and sizes for the offsets and spatials. I was thinking the table class inherits the same functionality as exploring a treenode as a table. Maybe it is possible to use a query on the treenode structure to find only offsets or spatials? And convert the result table to an array to insert the values at a different treenode later.

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Joerg Vogel commented ·

You can make a table with those values with this query:

Table result = Table.query(
	"SELECT $2 AS Name, $3 AS Value FROM $1", 
	model().find("Operator1>spatial"), 
	$iter(1).name, 
	$iter(1).value
);

From there, I still am not sure I understand what you want to do, but a table will probably help. You can clone it to another table, or use it later in the same code.

1 Like 1 ·

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.