Use AutoLISP Variables
You can use AutoLISP variables within arithmetic expressions. The variables
must be one of the following types: real, integer, or 2D or 3D point (vector).
This example defines a point positioned 5 units in the X direction and 1 unit
in the Y direction from the point stored in AutoLISP variable
A
.
A+[5,1]
If you enter an AutoLISP variable with a name containing a character with
special meaning in CAL, such as +, –, *, or /, enclose the variable name in
apostrophes ('), for example:
'number-of-holes'
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
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.
Use AutoLISP Variables | 193
Summary of Contents for AUTOCAD 2006
Page 1: ...February 2005 AutoCAD 2006 Command Reference ...
Page 24: ......
Page 30: ...6 ...
Page 212: ...188 ...
Page 448: ...424 ...
Page 554: ...530 ...
Page 584: ...560 ...
Page 588: ...564 ...
Page 660: ...636 ...
Page 750: ...726 ...
Page 760: ...736 ...
Page 960: ...936 ...
Page 1194: ...1170 ...
Page 1244: ...Undo Reverses the most recent change made by TRIM 1220 Chapter 21 ...
Page 1310: ...1286 ...
Page 1328: ...1304 ...
Page 1354: ...Zoom Window Zooms to display an area specified by a rectangular window 1330 Chapter 26 ...
Page 1490: ......