question

Michael O'Connell avatar image
0 Likes"
Michael O'Connell asked Michael O'Connell edited

Setloc not executing correctly

FlexSim 16.1

I have a task executer that I'm moving into another using moveobject. After the move, I use setrot and setloc to orient and position the object just moved. I have simple code in the script console. After all commands, the moved task executer is not positioned correctly. The setloc should put it at 7.7, -1.2, 0. Instead it shows at 9.45, -8.95, 0. I can manually enter the correct coordinates and it works and remains correctly positioned.

offsets.fsm

FlexSim (other - please specify)
FlexSim (other)
moveobjectsetloc
offsets.fsm (16.4 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

·
Jacob Gillespie avatar image
3 Likes"
Jacob Gillespie answered Michael O'Connell edited

The object is being positioned correctly.

setloc() positions the object relative to it's origin which is in the corner of the object.

If you click this then the coordinates will match:

Use this to position the object centered on the x-y plane:

setloc(so, 7.7, -1.2, 0, 0.5, 0.5);

position.png (64.7 KiB)
· 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.

Mischa Spelt avatar image Mischa Spelt commented ·

If you want to set the position of the center of the object, use setcenter instead.

0 Likes 0 ·
Michael O'Connell avatar image Michael O'Connell commented ·

@Jacob Gillespie

I had Mid-Planar location defined for lower surface and thought that would handle it. When it didn't, I thought the corner origin might be affecting, but I would have expected this:

I wasn't aware of the Direct Spatials and now see that setloc accurately positions. So setloc parameters are always Direct Spatial unless the additional parameters (e.g. 0.5, 0.5, 0.0) are included in the command. GUI X,Y,Z are based on selected measurement point (corner, mid-edge, mid-planar,etc).

0 Likes 0 ·
rqybm.png (61.6 KiB)

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.