Physics Conveyor: GetProductInArea
Called to get an array of Product objects within the specified range along the physics conveyor.
🔁 Function
Array GetProductInArea(start: double, end: double)
⚙️ Parameters
Name | Type | Description |
---|---|---|
start |
Double | The (inclusive) start distance of the area to check in the units chosen when the project was created (metres or feet) |
end |
Double | The (inclusive) end distance of the range to check in the units chosen when the project was created (metres or feet) |
↩️ Return Value
An Array object that contains Product object references or null if no products are found
📝 Example - Print the names of all the products between distance 3 and 4 on a conveyor.
let conveyor = GetComponentByNameAndType(conveyorName, "Physics Conveyor");
let products = conveyor.GetProductInArea(3, 4);
if (products != null) {
for (let i = 0; i < products.length; ++i) {
LogDebug(`product: ${products[i].Name}`);
}
}