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

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");