Builtin Constants and Functions

In addition to Sketchup's Ruby modules and classes, SuPy provides the following additions to the Python builtin namespace.

Unit Vectors

X_AXIS, Y_AXIS, Z_AXIS

Conversion Factors

Multiply by these to convert from the named unit to Sketchup's internal units.

cm, degrees, feet, inch, km, m, mile, mm, radians, yard

Modifier Key Constants

For use by custom tool classes.
CONSTRAIN_MODIFIER_KEY, CONSTRAIN_MODIFIER_MASK,
COPY_MODIFIER_KEY, COPY_MODIFIER_MASK,
ALT_MODIFIER_KEY, ALT_MODIFIER_MASK

Status Bar Constants

For use with Sketchup.set_status_bar().
SB_PROMPT, SB_VCB_LABEL, SB_VCB_VALUE

Functions

Array(sequence)
Converts the given sequence to a Ruby array.

to_length(s)
Parses the given string as a length and returns a number, or raises ValueError. Equivalent to the Ruby to_l method.
keep(name, ...)
For each name, if keep has been called before from the same module with the same name, replaces the value of the name in the calling module with the value it had at the time of the previous keep call.

This function is used to preserve the values of module-level variables across calls to Py.refresh. It should be called from the module's top-level code immediately after the code that initialises the variables being preserved.

keep_init(name, initializer)
Like keep(name) except that on the first call the initializer is called with no arguments, and the returned value is used as the initial value. The name need not be bound in the calling module before the first call.
clear_keep(module)
clear_keep(module, name...)
Discards values previously saved using keep()for the given module. With no arguments, clears all values being kept for the specified module. With arguments, clears only the specified names.