question

Nicolas Mbz avatar image
0 Likes"
Nicolas Mbz asked Nicolas Mbz commented

How to set rot, loc relative to an object and depending of the direction

Hello,
There are different objects (ObjToPos) that can remain on floorspots (patient, bed, gurney, chair). There are several floorspots facing in different directions. I would like these objects

1) are properly centered on the floor spot

2) if possible, that the rotation follows the direction of travel

In the example bellow, Bed1 should be centered on the FloorSpot1 and the Man1 should be centered on the Floorspot2 with the same z rotation of the floorspot

1708341390995.png


Positionner_Patient_Bed_sur_floorspot.fsm

An idea ? Thanks in advance

FlexSim 23.2.3
visualsetlocationsetrotation
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Nicolas Mbz commented

You can add a travel to location to the floor spot rather then setting the rotation and location yourself.

Using network nodes like this you should connect between the two either side of the location using a D connection, which means it can join the network at the closest node to its onward travel.

Example attached.

positionner-patient-bed-sur-floorspot_jl.fsm


· 3
5 |100000

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

Nicolas Mbz avatar image Nicolas Mbz commented ·

Thanks a lot ! It works. That's perfect. 2 subsidiary questions

1) Assign labels
token.FloorSpot.getLocation(0.5,0.5,0).project(token.FloorSpot.up,token.ObjToPos.up)

What is the role of the underlined part ?


2) Where can I find the description of the D connection in the documentation ?
Your explanation is clear, but didn't know that it exists and could be useful to read theory about it.
1708354956209.png

0 Likes 0 ·
1708354956209.png (21.0 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Nicolas Mbz commented ·

The Vec3 project() method is used here to ensure that the coordinates are in the traveller's space. You could assume they are in the same container/hierarchy in the model but it's safer to write the code generically without that assumption.

You can read more about alternate exits here

0 Likes 0 ·
Nicolas Mbz avatar image Nicolas Mbz Jason Lightfoot ♦♦ commented ·
Thanks a lot !
0 Likes 0 ·