Sets

Functions and constants relating to Sets

Functions

Details of functions

GetItemsInSet(set_type[integer], set_id[integer]) [static]

Description

Returns an object containing the number of items in set <set_id> of set type <set_type> and also an array <list[ ]> of their internal indices. If there are no items in the set then false is returned.

Arguments

  • set_type (integer)

    A valid type code (SET_PART, etc.)

  • set_id (integer)

    The set id. If +ve, the internal number starting at 1. If -ve, the external label of the set. Internal numbers will be many times faster to process.

    Returns

    Object with the following properties:

    Name Type Description
    list array of integers Internal entity indices
    nn integer Number of entities in list

    Return type

    object

    Example

    // Get a list of parts in the 5th SET_PART
    if(a = GetItemsInSet(SET_PART, 5))
    {
        var nparts = a.nn;
        for(var i=0; i<nparts; i++)
        {
            Message("Part: " + GetLabel(PART, a.list[i]));
        }
    }
    


    GetSetInfo(set_type[integer], set_id[integer]) [static]

    Description

    Returns information about a set in the current model

    Arguments

  • set_type (integer)

    A valid type code (SET_PART, etc.)

  • set_id (integer)

    The set id. If +ve, the internal number starting at 1. If -ve, the external label of the set. Internal numbers will be many times faster to process.

    Returns

    Object with the following properties:

    Name Type Description
    label integer The label of the set
    name string The name of the set
    nn integer Number of items in the set

    Return type

    object

    Example

    // Print the name of the first *SET_PART in the current model
    var info = GetSetInfo(SET_PART, 1);
    Print("Set name = " + info.name + "\n");