GetComponents
Called to get an array of all the components used within the project of the specified type
You can use this function to get all products: GetComponents(‘Product’)
Function
Array GetComponents(typeName: string);
Parameters
Name | Type | Description |
---|---|---|
typeName | String | The name of the component type required |
Return Value
Array of requested type
Example
// typeName can be one of the following:
//
// 'Barcode Scanner'
// 'Basic Shape'
// 'Cam Pusher'
// 'Chute'
// 'Conveyor'
// 'Conveyor Controller'
// 'Cross Belt Sorter'
// 'Divert Rule'
// 'Diverter'
// 'EStop'
// 'Free Roller Conveyor'
// 'Grid'
// 'Handler Group'
// 'High Speed Diverter'
// 'Label'
// 'Path'
// 'PE Sensor'
// 'Polyline'
// 'Product'
// 'Product Generator'
// 'Product Schedule'
// 'Rack'
// 'Screening Operator Group'
// 'Shoe Sorter'
// 'Tilt Tray Sorter'
// 'Vertical Sorter'
// 'X-Ray Machine'
// 'Physics PE Sensor'
var conveyors = GetComponents("Conveyor");
ListEquipment("Conveyor", conveyors);
function ListEquipment(type, list) {
LogDebug("List of all '" + type + "':")
// loop through each equipment
for (var i=0; i<list.length; i++) {
LogDebug(" " + list[i].Name);
}
}
My Equipment
When accessing ‘My Equipment’, utilize the inherited component type if it inherits from an existing type. For instance, to retrieve a ‘Box’ that inherits from ‘BasicShape’, you should use the inherited type ‘Basic Shape’.
var boxes = GetComponents("Basic Shape");