Function Entry: SETVAR

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: SETVAR

Name

setvar

Class

Host Interaction Function

Syntax

(setvar varname value)

Arguments and Values

  • varname: system-variable name designator
  • value: new value

Autodesk documents:

  • varname as a string
  • value as an integer, real, string, list, T, or nil

Description

Sets an AutoCAD system variable to a specified value.

The per-sysvar entries in §16 System Variables document every varname recognized by AutoCAD 2026 or BricsCAD V25, with the declared type, default, read-only flag, scope, accepted-value range, vendor divergence, and source URLs. The normative rules at the head of that chapter (name case-insensitivity, integer clamping to [-32768, +32767], type-coercion policy, read-only error behaviour, angular-units convention for ANGBASE / SNAPANG) apply uniformly to every setvar call.

Return Values

Returns value if successful.

Side Effects

Mutates host drawing/session state.

Exceptional Situations

Errors if the variable is read-only, absent, or rejects the supplied value.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.

Source Notes

Notes

  • Autodesk documents that for integer-valued system variables the supplied value must lie between -32768 and +32767.
  • Autodesk documents that changes made with setvar during an active command may not take effect until the next command.
  • Autodesk documents special angular semantics for ANGBASE and SNAPANG: setvar interprets the values in radians, unlike the interactive SETVAR command.

Compatibility

Supported on Windows, macOS, and Web in current Autodesk documentation.