question

Jon Abbott avatar image
2 Likes"
Jon Abbott asked Jon Abbott edited

How to get an object's reset position using code

I would like to get the reset position for an object using code, but I don't see a "getresetposition" command. Is there a shorter (and/or more elegant) way to do this than the following code?

[getvarnode(Model.find("Object1"), "resetposition").subnodes[1].value, getvarnode(Model.find("Object1"), "resetposition").subnodes[2].value, getvarnode(Model.find("Object1"), "resetposition").subnodes[3].value]

Thanks in advance for any assistance you can provide.

FlexSim 20.0.0
flexscriptcodeobjectreset position
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 Jon Abbott edited

There's no getresetposition() command. This is the code I would use:

treenode object = Model.find("Object1");
var pos = getvarnode(object, "resetposition").subnodes;
return [pos[1].value, pos[2].value, pos[3].value];
· 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.

Jon Abbott avatar image Jon Abbott commented ·

Thanks @Matthew Gillespie! This works, and I've made it into a user command getresetposition.fsl that I've attached. I'll also send a request to dev@flexsim to consider adding getresetposition() and/or Object.resetposition to FlexSim.

2 Likes 2 ·

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.