Setloc not executing correctly

Setloc not executing correctly

michael_oconnell
Not applicable
66 Views
3 Replies
Message 1 of 4

Setloc not executing correctly

michael_oconnell
Not applicable

[ FlexSim (other) ]

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

0 Likes
Accepted solutions (1)
67 Views
3 Replies
Replies (3)
Message 2 of 4

Jacob_Gillespie
Autodesk
Autodesk
Accepted solution

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:

6172-position.png

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

setloc(so, 7.7, -1.2, 0, 0.5, 0.5);
Message 3 of 4

mischa_spelt
Advisor
Advisor

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

0 Likes
Message 4 of 4

michael_oconnell
Not applicable

@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:

6187-rqybm.png

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