How to set the location of PhotoEye/Decision point on Curved Conveyor using code

How to set the location of PhotoEye/Decision point on Curved Conveyor using code

__ANON_USER__1
Not applicable
4 Views
2 Replies
Message 1 of 3

How to set the location of PhotoEye/Decision point on Curved Conveyor using code

__ANON_USER__1
Not applicable

[ FlexSim 23.1.3 ]

Hi Team,.

I have added a label on the conveyor which indicates at what % of length of the conveyor the photo eye should move.

How do I set the location of photo eye on the curved conveyor.

Attached is the model.

Thank you

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

moehlmann_fe
Observer
Observer
Accepted solution

Starting from a reference to the Photo Eye, the following code will set its location depending on the label value.

Object PE = Model.find("PE2");
Object conveyor = ownerobject(PE.find(">variables/conveyorPoint/1+")); double length = Math.fabs(conveyor.getProperty("SweepAngle")*conveyor.getProperty("Radius")*Math.pi/180); function_s(PE, "setDistAlongConveyor", length*conveyor.Sensor1/100);
Message 3 of 3

arunTTT2P
Explorer
Explorer
If curved length was a property it would have been helpful.
0 Likes