2013

Table Of Contents
Assigning Values to AutoLISP Variables
To assign a value to an AutoLISP variable, precede the arithmetic expression
with the variable name and the equal sign (=). Later, you can use the value of
this variable for other calculations.
This example saves the values of two expressions in AutoLISP variables P1 and
R1.
Command: cal
>> Expression: P1=cen+[1,0]
>> Select entity for CEN snap: Select a circle or an arc
Command: cal
>> Expression: R1=dist(end,end)/3
>> Select entity for END snap: Select an object with an endpoint
This example uses the values of variables P1 and R1:
Command: circle
Specify center point for circle or [3P/2P/Ttr (tangent tangent
radius)]: 'cal
>> Expression: P1+[0,1]
Specify radius of circle or [Diameter] <last>: 'cal
>> Expression: R1+0.5
See also:
Use the Command Prompt Calculator
Use System Variables in Calculations
You can use the getvar function to read the value of a system variable.
The syntax is
getvar(variable_name)
The following example uses getvar to obtain the point that is the center of
the view in the current viewport.
getvar(viewctr)
With this method, you can also access the user system variables, USERI1-5
and USERR1-5. For example, to retrieve the value stored in USERR2, enter the
following:
C Commands | 171