UpdateProductPosition
Called to position product at a certain distance along the transfer path of an equipment instance, the system will locate the correct product instance based on the identifier
field
🔁 Function
Product UpdateProductPosition(
target: Object,
distance: Number,
identifier: String);
⚙️ Parameters
Name | Type | Description |
---|---|---|
target |
Object | The transporter that the product will be moved to. NOTE, the transporter Tracking Mode will need to be set to the Tracking state for it to accept tracking product placement |
distance |
Number | The position the product will be moved to, this refers to the leading edge of the product. Value is in metres. |
identifier |
String | An unique string value that identifies the product, if the product cannot be found then a new instance will be created |
↩️ Return Value
The return value is an instance of the Product that has been positioned at the desired location, this may be a new instance or one that already existed, this is determined by the identifier
, a null
value indicates the product positioning failed, this may be due to the transporter not being in the correct tracking state.
📝 Example
function OnSimulationStart() {
SetComponentKey("LocationID");
}
function ProductTracking(msg, hdr) {
var product = UpdateProductPosition(GetComponentByKey("LocationID", msg.locationid), msg.distance, msg.BC);
if (product != null) {
product.Text = msg.BC;
product.Length = msg.l;
product.Width = msg.w;
product.Height = msg.h;
product.Direction = msg.d;
}
}