MAXScript Language Reference > Values >

# PrintAllElements Variable and Context

| Values and Collections - Quick Navigation

In versions prior to 3ds Max 7, printing or coercing Array, MeshSelection, BigMatrix, and BigMatrixRowArray values to string would convert only the first 20 elements.

In 3ds Max 7 and higher, a MAXScript variable and a new context are available. They control whether the above mentioned value types are fully printed / coerced to string, or just their first 20 elements.

The variable is:

    options.printAllElements

When set to true, all elements of Array, MeshSelection, BigMatrix, and BigMatrixRowArray values are printed or coerced to string. If false, only the first 20 elements of these value types are printed.

The context is:

    with printAllElements <bool> <expr>

If <bool> is true, <expr> is run with printAllElements true. This is exception safe - if an exception occurs in <expr>, printAllElements is returned to its initial value.

EXAMPLES
    a = for i = 1 to 30 collect i
    --> #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...)

    with printAllElements off (print a #nomap;ok)
    --> #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...)
    --> OK

    with printAllElements on (print a #nomap;ok)
    --> #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
    --> OK

    with print AllElements off a as string
    --> "#(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...)"

    with printAllElements on a as string
    --> "#(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)"

    (
    -- note that the following is not exception safe!
    local oldPrintAllElements = options.printAllElements
    options.PrintAllElements = true
    print a #nomap
    options.printAllElements = oldPrintAllElements
    ok
    )
    --> #(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
    --> OK