question

Sergio V6 avatar image
0 Likes"
Sergio V6 asked Sergio V6 commented

Set Spatial attributes with C++


Hello.

I'm trying to set the spatial attributes of an object using c++ code, i can access the treenode and change the name, but i don't know how to change these values. how i can do it?


1625775149729.png1625775133630.png


FlexSim 21.0.2
spatialcode c+
1625775133630.png (2.3 KiB)
1625775149729.png (4.9 KiB)
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
1 Like"
Matthew Gillespie answered Sergio V6 commented

The setLocation method is on the ObjectDataType class, so you have to cast the treenode to ObjectDataType:

obj->objectAs(ObjectDataType)->setLocation(0, 0, 0);

Alternatively you can use the setloc() command which just takes a treenode:

setloc(obj, 0, 0, 0);
· 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.

Sergio V6 avatar image Sergio V6 commented ·
It Worked, thank you!
0 Likes 0 ·