Selecting

Functions and constants relating to Selecting

Functions

Details of functions

IsSelected(type_code[integer], item[integer]) [static]

Description

Checks whether an item has been selected with Select()

Arguments

  • type_code (integer)

    The type of item to select (SOLID, etc.)

  • item (integer)

    If +ve, the internal item number starting at 1. If -ve, the external label of the item.

    Returns

    boolean

    Return type

    Boolean

    Example

    // Returns JS_TRUE if the 1st PART in the model was selected.
    if(IsSelected(PART, 1))
    {
        ....
    }
    


    Pick(type_code[integer], number[integer]) [static]

    Description

    Allows the user to interactively pick a specified number of items

    NOTE: If you are using the WINDOW type code, the function should be seen as "Pick item/model and return it's WINDOW ID" i.e. if you try and use the pick function and click somewhere away from the model, the function will return null. On the other hand, if you click the model then it will return the WINDOW ID in which the model resides.

    Arguments

  • type_code (integer)

    The type of item to select (SOLID, etc.)

  • number (integer)

    The number of items to pick.

    Returns

    Array of integers

    Return type

    Number

    Example

    // Pick 4 PARTS and return the internal index of each one in array (a)
    var a = Pick(PART, 4);
    
    // Pick 3 NODES and return the external labels of each one in array (b)
    var b = Pick(NODE, -3);
    


    Select(type_code[integer]) [static]

    Description

    Allows the user to interactively select items using the mouse or from a menu.

    Arguments

  • type_code (integer)

    The type of item to select (SOLID, etc.)

    Returns

    integer, >0 the number of items selected, -1 user cancelled the operation, -2 model doesn't contain any of the type requested

    Return type

    Number

    Example

    // Select PARTS interactively and return the number selected.
    var a = Select(PART);