Вы находитесь на странице: 1из 577

* -

681.3.06

AutoCAD
Autodesk, , , , , . AutoLISP, DIESEL, DCL Visual LISP.
-
ActiveX. . AutoCAD 2000
AutoCAD 2000L


AutoCAD
:

.

:
:

.




,

,


. .
Visual LISP AutoCAD. .: -,
2001.-576 : .
ISBN

5-94157-020-1

. . , 2001
, "-", 2001
02429 24.07.00. 22.03.01.
70x100 Vie. . . . . 46,44.
5000 . 155.
"-", 198005, -, ., 29.
, , 77.99.1.953..950.3.99
01.03.1999 . .


,

198005, -, ., 29.

17

1. AutoCAD

19

1.1.
1.2.
1.3.
1.4.
1.5.
1.6.
1.7.
1.8.

20
25
31
41
44
47
48
51

acad.pgp
AutoCAD
AutoCAD

AutoCAD

2. AutoLISP

53

2.1. AutoLISP
2.1.1.
2.1.2. setq
2.1.3.
2.2.
2.2.1.
2.2.2.
2.2.3.
2.2.4. load
2.2.5. vl-load-all
2.3. AutoCAD AutoLISP
2.3.1. command
2.3.2. vl-cmdf.
2.4.
2.4.1. +
2.4.2.
2.4.3. *
2.4.4. /
2.4.5. /+
2.4.6. /
2.4.7. ~
..,.
2.4.8. abs

53
54
55
56
57
57
59
59
60
61
61
61
64
64
64
65
65
66
66
67
67
67


2.5.
2.5.1. =
2.5.2. / =
2.5.3. <
2.5.4. <=
2.5.5. >
2.5.6. >=
2.5.7. and.
2.5.8. or
2.5.9. not
2.5.10. null
2.5.11. //
2.5.12. progn
2.5.13. cond
2.5.14. minusp
2.5.15. zerop
2.5.16. numberp
2.5.17. listp
2.5.18. vl-consp
2.5.19. atom
2.5.20. vl-symbolp
2.5.21. boundp
2.5.22. eq
2.5.23. equal
2.5.24. while
2.5.25. repeat
2.6.
2.6.1. fix..
2.6.2.
2.6.3. max
2.6.4. min
2.6.5. gcd
2.6.6. angle
2.6.7. distance
2.6.8. sqrt
2.6.9. sin
2.6.10. cos
2.6.11. atan
2.6.12.
2.6.13. expt
2.6.14. log
2.6.15. logand
2.6.16. logior
2.6.17. Ish
2.6.18. Boole
2.6.19. inters
2.6.20. polar
2.6.21. textbox
2.6.22. vports
2.6.23. vl-symbol-value
2.6.24. set.

68
68
68
69
69
70
70
71
71
72
72
73
73
74
76
76
76
77
77
78
78
78
79
79
79
80
81
81
82
82
83
83
83
84
84
84
85
85
85
86
86
86
87
87
88
89
89
90
90
92
93


2.7.
2.7.1. type
2.7.2. float
2.7.3. itoa
2.7.4. rtos
2.7.5. atoi
2.7.6. atof.
2.7.7. angtof
2.7.8. angtos
2.7.9. distof
2.7.10. trans
2.7.11. cvunit
2.8.
2.8.1. chr.
2.8.2. ascii
2.8.3. read
v 2.8.4. strcase
2.8.5. strcat
2.8.6. strlen
2.8.7. substr
2.8.8. wcmatch
2.8.9. vl-string->list
2.8.10. vl-list->string
2.8.11. vl-string-elt
2.8.12. vl-string-left-trim
2.8.13. vl-string-right-trim
2.8.14. vl-string-trim
2.8.15. vl-string-mismatch
2.8.16. vl-string-position
2.8.17. vl-string-search
2.8.18. vl-string-subst
2.8.19. vl-string-translate
2.8.20. vl-symbol-name
2.8.21. ( ending)
2.8.22. ( strcaser)
2.9.
2.9.1. list
2.9.2. append
2.9.3. nth
2.9.4. reverse
2.9.5. car.
2.9.6. cdr.
2.9.7. caar, cadrw
2.9.8. cons
2.9.9. vl-list*
2.9.10. member
2.9.11. assoc
2.9.12. apply
2.9.13. mapcar
2.9.14. vl-every
2.9.15. foreach

'.

93
93
94
94
95
96
96
96
97
98
98
100
101
101
101
102
103
103
104
104
105
106
106
107
107
107
108
108
108
109
109
110
110
111
111
112
112
113

114
114
114
115
116
116
117
118
118
119
119
120


2.9.16. eval
2.9.17. quote
2.9.18. acad_strlsort
2.9.19. last
2.9.20. subst
2.9.21. length
2.9.22. vl-list-length
2.9.23. vl-member-if.
2.9.24. vl-member-if-not
2.9.25. vl-position
2.9.26. vl-remove
2.9.27. vl-remove-if.
2.9.28. vl-remove-if-not
2.9.29. vl-some
2.9.30. vl-sort
2.9.31. vl-sort-i
2.9.32. vl-catch-all-apply
2.9.33. vl-catch-all-error-message
2.9.34. vl-catch-all-error-p
2.10.
2.10.1. initget
2.10.2. getfcword
2.10.3. getint
2.10.4. getreal.
2.10.5. getdist
2.10.6. getangle
2.10.7. getorient
2.10.8. getpoint
2.10.9. getcorner
2.10.10. getstring
2.10.11. getvar.
2.10.12. setvar
2.10.13. getenv
2.10.14. setenv
2.10.15. getc/g
2.10.16. setcfg
2.10.17. getcname
2.10.18. getfiled
2.10.19. acadcolordlg
2.11. ,
2.11.1.
flndfile
2.11.2. open
2.11.3. close
2.11.4. read-line
2.11.5. write-line
2.11.6. princ
2.11.7. phnl
2.11.8. print
2.11.9. read-char.
2.11.10. write-char
2.11.11. prompt

120
120
121
121
121
121
122
122
123
123
123
124
124
125
125
126
126
127
127
127
128
130
131
132
132
132
133
133
134
134
134
135
135
136
136
136
136
137
138
139
139
140
140
141
141
141
142
142
142
143
143


2.11.12. alert
2.11.13. terpri
2.11.14. vl-directory-ftles
2.11.15. vl-flle-copy
2.11.16. vl-file-delete
2.11.17. vl-file-directory>-p
2.11.18. vl-file-rename
2.11.19. vl-file-size
2.11.20. vl-file-systime
2.11.21. vl-filename-base
2.11.22. vl-filename-directory
2.11.23. vl-fdename-extension
2.11.24. vl-filename-mktemp
2.11.25. vl-princ-to-string
2.11.26. vl-prini-to-string
2.11.27.
2.12. AutoCAD
2.12.1. entlast
2.12.2. entnext
2.12.3. entsel
2.12.4. entdel
2.12.5. entget
2.12.6. entmake
2.12.7. entmakex
2.12.8. entmod
2.12.9. entupd
2.12.10. handent
2.12.11. nentsel
2.12.12. nentselp
2.12.13.
2.12.14. ssget
2.12.15. ssadd
2.12.16. ssdel.
2.12.17. sslength
2.12.18. ssmemb
2.12.19. ssname
2.12.20. ssnamex
2.12.21. sssetftrst
2.12.22. ssgetfirst
2.12.23. AutoCAD
2.13.
2.13.1.
2.13.2. tblsearch
2.13.3. tblnext
2.13.4. tblobjname
2.13.5.
2.13.6. setview
2.13.7. snvalid
2.14. ,
2.14.1.
2.14.2. regapp

143
144
144
145
146
146
146
147
147
148
148
148
149
150
150
151
152
153
153
154
155
155
157
157
158
158
158
158
159
160
160
162
163
163
163
164
164
166
167
167
170
170
170
171
171
172
172
174
175
175
177


2.14.3.
2.14.4. xdsize
2.14.5. xdroom
2.15. , -
2.15.1.
2.15.2. namedobjdict
2.15.3. dictsearch
2.15.4. dictnext
2.15.5. dictadd
2.15.6. dictremove
2.15.7. dictrename
2.15.8. layoutlist
2.15.9. -
2.16.
2.16.1. lambda
2.16.2. defun
2.16.3. AutoCAD

2.16.4. defun-q
2.16.5. defun-q-list-ref.
2.16.6. defim-q-list-set.
2.16.7. function
2.16.8. vlisp-compile
2.16.9. exit
2.16.10. quit
2.16.11. *error*.
2.16.12. vl-acad-defun
2.16.13. vl-acad-undefun
2.16.14. vl-exit-with-error.
2.16.15. vl-exit-with-value
2.16.16. atoms-family
2.16.17. trace
2.16.18. untrace
2.17. , Windows
2.17.1. ver
2.17.2.
2.17.3. alloc
2.17.4. expand
2.17.5. ^
2.17.6. vl-registry-read
2.17.7. vl-registry-write
2.17.8. vl-registry-delete
2.17.9. vl-registry-descendents
2.17.10. arx
2.17.11. arxload
2.17.12. arxunload
2.17.13. autoload.
2.17.14. autoarxload
2.17.15. vl-arx-import
2.17.16. vl-doc-export.
2.17.17. vl-doc-import

177
178
179
179
179
180
180
181
183
184
184
185
185
187
188
188
192
192
194
194
195
195
196
196
196
197
198
198
198
199
199
200
200
201
201
201
202
202
202
203
203
204
204
205
205
206
206
207
207
207


2.17.18. vl-list-exported-functions
2.17.19. vl-list-loaded-vlx
2.17.20. vl-vlx-loaded-p
2.17.21. vl-unload-vlx
2.17.22. vl-get-resource
2.17.23. vl-vbaload.
2.17.24. vl-vbarun
2.17.25. vl-bb-set
2.17.26. vl-bb-ref
2.17.27. vl-doc-set
2.17.28. vl-doc-ref.
2.17.29. vl-load-all
2.17.30. vl-propagate
2.17.31.
2.17.32.
2.17.33.
2.18.
2.18.1. osnap
2.18.2. redraw
2.18.3. graphscr
2.18.4. textscr
2.18.5. textpage
2.18.6. grtext
2.18.7. grdraw

2.18.8. grvecs
2.18.9. grclear
2.18.10. grread
2.18.11. initdia
2.18.12. tablet
2.19.
2.19.1. acad.lsp
2.19.2. acaddoc.lsp
2.19.3. ACADLSPASDOC
2.19.4. sr.startup

208
209
209
210
210
211
211
211
212
213
213
214
214
215
217
218
219
219
220
221
221
221
221
224
224
225
225
228
229
230
230
231
232
232

3. Visual LJSP

233

3.1. Visual LISP


3.1.1.
3.1.2.
3.1.3.
3.1.4.
3.1.5.
3.1.6.
3.1.7.
3.1.8.
3.2. Visual LISP
3.2.1.
3.2.2.
3.2.3.
3.2.4.
3.2.5.

234
234
235
236
237
244
246
250
251
251
251
252
252
253
254

10

3.3. Visual LISP


3.3.1.
3.3.2.
3.4.
3.4.1.
3.4.2.
3.4.3. VLX-
3.4.4.

254
255
255
256
257
259
262
267

4.

269

4.1.
4.1.1.
4.1.2.
4.2.
4.2.1.
4.2.2.
4.3. AutoLISP,
4.3.1. menugroup
4.3.2. menucmd
4.4.
4.4.1.
:
4.4.2.
4.4.3.
4.5.
4.5.1.
4.5.2.
4.5.3.
4.5.4.
4.5.5.
4.5.6.
4.5.7.
4.5.8.
4.5.9.
4.5.10.
4.6.
4.6.1.
4.6.2.
4.6.3.
4.6.4.
4.7.
4.7.1.
4.7.2.
4.8.
4.9.
4.10.
4.10.1.
4.10.2.
4.10.3.
4.10.4.
4.11.
4.11.1.
4.11.2.

269
270
271
273
275
277
279
279
280
282
283
284
286
287
287
288
288
289
289
290
290
290
291
292
293
293
295
297
298
299
299
301
301
302
302
302
305
305
308
309
310
310

1J_

4.12. HELPSTRINGS
4.13. ACCELERATORS
4.14. DIESEL
4.14.1.
4.14.2.
4.14.3. ,
4.14.4.
4.14.5. DIESEL AutoLISP
4.15. MNL-

312
313
314
314
314
315
315
316
316

5.

320

5.1. DCL
5.1.1.
5.1.2.
5.2.
5.2.1. ioadjiialog
5.2.2. unloadjiialog
5.2.3. new dialog
5.2.4. startdialog
5.2.5. done jiialog
5.2.6. term jiialog
5.2.7.
5.3.
5.3.1.
5.3.2.
5.3.3.
5.3.4.
5.3.5.
5.3.6.
5.4. ,
5.4.1. actionjile
5.4.2. modejile
5.4.3. set tile
5.4.4. getjile
5.4.5. getjjttr
5.4.6. clientjJatajile
5.4.7.
5.5. ,
5.5.1. startJist
5.5.2. addjist
5.5.3. endjist
5.6. ,
5.6.1. startjmage
5.6.2. endjmage
5.6.3. fdljmage
5.6.4. slidejmage
5.6.5. vector image
5.6.6. dimxjMe
5.6.7. dimyjile
5.7.
5.7.1.

320
320
324
328
328
328
329
329
330
330
330
331
332
336
342
344
345
346
347
348
349
350
354
355
355
355
357
357
357
358
358
358
359
359
360
360
361
361
361
361

12

5.7.2.
5.7.3.

363
365

6.

366

6.J. HELP- Windows


6.1.1. HELP-
6.1.2. CNT-
6.1.3. help
6.1.4. WIN-
6.1.5. WIN- startapp
6.2. HTML-
6.2.1. HTML- CNT-
-.
6.2.2. HTML-
6.2.3. HTML- startapp
6.3. AutoCAD
6.3.1. acad_helpdlg
6.4. -
6.4.1. setfunhelp
6.4.2. setfunhelp

366
367
:...370
371
373
373
374
374
374
374
375
375
375
375
376

7. ActiveX

377

7.1. AutoLISP
.1.
.2. vl-load-com
.3.
.4. vlax-get-acad-object
.5. vla-get-activedocument
.6. vla-get-modelspace
.7. vla-get-paperspace
.8. ActiveX
.9.
.10. VLA-
.11. \iax-ename->vla-object
.12. vlax-vla-object->ename
.13.
.14.
.15. vlax-make-variant
J 6 . vlax-variant-type
.17. vlax-variant-vahte
.18. vlax-variant-change-type
.19. vlax-3D-point
.20.
.21. vlax-make-safearray
.22. vlax-safearray-put-element
.1.23. vlax-safearray-fill
1.24. VLA-
1.25. vlax-dump-object
1.26. ActiveX
7.2.
7.2.1. vlax-add-cmd
7.2.2. vlax-remove-cmd

377
377
379
379
380
380
381
381
381
382
382
383
383
383
384
384
385
386
386
386
387
387
388
389
389
389
391
391
391
392

7.3.

7.4.

7.5.

7.6.

7.7.

7.2.3. vlax-invoke-method
7.2.4. vlax-product-key

7.3.1. vlax-erased-p
7.3.2. vlax-method-applicable-p
7.3.3. vlax-typeinfo-available-p
7.3.4. vlax-object-released-p
7.3.5. vlax-release-object
7.3.6. vlax-read-enabled-p
7.3.7. vlax-write-enabled-p
7.3.8. vlax-create-object
7.3.9. vlax-get-object
7.3.10. vlax-get-or-create-object
7.3.11. vlax-import-type-library
7.3.12. vlax-map-collection
7.3.13. vlax-for

7.4.1. vlax-ldata-put
7.4.2. vlax-ldata-get
,
7.4.3. vlax-ldata-list
7.4.4. vlax-ldata-delete
7.4.5. vlax-ldata-test

7.5.1. vlax-safearray-get-dim
7.5.2. vlax-safearray-get-1-bound
7.5.3. vlax-safearray-get-u-bound
7.5.4. vlax-safearray-get-element
7.5.5. vlax-safearray-type
7.5.6. vlax-safearmy->list
7.5.7. vlax-tmatrix

7.6.1. vlax-get-property
7.6.2. vlax-put-property
7.6.3. vlax-property-available-p

7.7.1. vlax-curve-getArea
7.7.2. vlax-curve-getStartPoint
7.7.3. vlax-curve-getEndPoint
7.7.4. vlax-curve-getPointAtDist
7.7.5. vlax-curve-getDistAtPoint
7.7.6. vlax-curve-getStartParam
7.7.7. vlax-curve-getEndParam
7.7.8. vlax-curve-getParamAtPoint
7.7.9. vlax-curve-getPointAtParam
7.7.10. vlax-curve-getParamAtDist
7.7.11. vlax-curve-getDistAtParam
7.7.12. vlax-curve-isClosed
7.7.13. vlax-curve-isPeriodic
7.7.14. vlax-curve-isPlanar
7.7.15. vlax-curve-getClosestPointTo
7.7.16. vlax-curve-getClosestPointToProjection

13_
393
393
393
393
394
394
394
394
395
395
395
395
395
396
396
397
397
397
397
398
398
398
399
399
399
399
399
400
400
400
400
401
401
401
402
402
402
402
402
403
403
403
403
404
404
404
404
404
405
405
405

14
7.7.17. vlax-curve-getFirstDeriv
7.7.18. vlax-curve-getSecondDeriv
7.8.
7.8.1.
7.8.2. vlr-types
7.8.3. vlr-reactors
7.8.4. vlr-type
7.8.5.
7.8.6. vlr-reaction-names
7.8.7. vlr-beep-reaction
7.8.8. vlr-trace-reaction
7.8.9.
7.8.10. vlr-acdb-reactor
7.8.11. vlr-docmanager-reactor
7.8.12. vlr-linker-reactor
7.8.13. vlr-object-reactor
7.8.14. vlr-editor-reactor
7.8.15. vlr-command-reactor.
7.8.16. vlr-deepclone-reactor
7.8.17. vlr-dwg-reactor
7.8.18. vlr-dxf-reactor
7.8.19. vlr-insert-reactor
7.8.20. vlr-lisp-reactor
7.8.21. vlr-miscellaneous-reactor.
7.8.22. vlr-mouse-reactor
7.8.23. vlr-sysvar-reactor
7.8.24. vlr-toolbar-reactor.
7.8.25. vlr-undo-reactor.
7.8.26. vlr-wblock-reactor
7.8.27. vlr-window-reactor
7.8.28. vlr-xref-reactor
7.8.29. vlr-readion-set.
7.8.30.
7.8.31. vlr-reactions
7.8.32. vlr-remove
7.8.33. vlr-remove-all
7.8.34. vlr-add
7.8.35. vlr-added-p
7.8.36. vlr-current-reaction-name
7.8.37. vlr-data
7.8.38. vlr-data-set
7.8.39. vlr-owner-add
7.8.40. vlr-owner-remove
7.8.41. vlr-owners
7.8.42. vh-notiflcation
7.8.43. vlr-set-notification
7.8.44.
7.8.45. vlr-pers
7.8.46. vlr-pers-release
7.8.47. vlr-pers-p
7.8.48. vlr-pers-Iist

406
406
406
406
408
408
409
409
409
410
410
410
411
412
414
..414
416
418
419
420
421
422
423
424
425
425
426
427
428
430
431
436
436
436
437
437
437
437
437
438
438
438
438
438
439
439
439
440
440
440
440

15

7.8.49.
7.8.50.

440
441

8. AutoCAD 2000i

444

1. ,

449

2. acad.pgp

452

.'.

3. acad.unt

464

4. acad.mnu

468

5. AutoLISP

488

6. ending

508

7. divpts

510

8. strcaser

513

9.

515

10. xdapp

520

11. setlout

522

12. al_vps

527

13. vl_fs

535

14.

ffp^flp

538

15. DXF- AutoCAD

544

16. DIESEL

559

563


-..
!!!

Get ReGet!
Re Get - ,
FTP- HTTP-.
, ReGet
-.
, ReGet

.
ReGet 1.7- MS Internet Explorer 5.5,
Windows 2000 .
ReGet -


. ,
, .

ReGet - .

!
yinniw.reget.com


AutoCAD

, , , . AutoCAD .
, , ,
, , ,
, , .
, AutoCAD
(, Mechanical Desktop, AutoCAD Architectural Desktop
Autodesk Cadmech ""), AutoCAD , , , (,
). .
AutoCAD, , , ,
,
. 1 , , .
AutoLISP
AutoCAD.
AutoLISP 2, 3 Visual LISP, .

18

Visual LISP AutoCAD

,

, ( ) . 4.
Windows ,

.
AutoLISP 5.
6
.
7 ,
AutoLISP ActiveX, 8 AutoCAD 2000i.

AutoCAD 2000, ,
. ,
, .

AutoCAD.
, , - - .
, : . . , . . ,
. . , . . . , .
,
AutoCAD, ,
"-": " AutoCAD 2000" " AutoCAD 2000
Visual LISP". , , (
, . .).

AutoCAD
, AutoCAD
- , :
(, );
DWG- , ;
, , ,
;
:
;
,
;
, AutoLISP, Visual Basic, C++ AutoCAD;
,
, AutoCAD, AutoCAD (, -
).

AutoCAD.
, AutoCAD, 1.

). 1.1,
acad.pgp
. 1.2. 1.3 1.4 AutoCAD , . 1.51.7
.

20

Visual LISP AutoCAD

. 1.8 , AutoCAD. ,
, . (. . 1.4, 1.7).

1.1.
AutoCAD, ,
(Startup) (. 1.1).

D


* (
(*

01

OK

. 1.1. ,

, , AutoCAD.
(OPTIONS) (Options) (System),
(Show Startup Dialog).

:
(Open a Drawing)
( AutoCAD dwg);
(Start from Scratch) () , , , ,

21

1. AutoCAD

, , , , , (), , , , ,
() ;
(Use a Template) ;
(Use a Wizard) , -, , , .
, , (Startup) .
AutoCAD , , . AutoCAD
(Start from Scratch).
(Use a Template) ,
. 1.2.
\&

Dn
i a4 ta
imed plot -tyle dw\
Generi; 24ri* - j-in title bo
l ck coo
l r dependent plot 1- d<t'
Generc
i 24m > 32m title bo
l ck named po
l t Jvfe* d 't
l.o aO coo
l r dependent po
l t Me' d\ >t
1-
I i o 1
150 a\
2
"0 a l
'.o a j

nanied plut styl^ d"-rt


-J\O\ deper ider it plot ttylp- d^ 't
named plot <iyle-^ dwt
tolor dependetit plot * ^ l e * d> <t
named plot ;tyle; dwt
color dependent plut ctyle- dvt

Iso a4 color depetident plof T M e . d^'t


ho a4 narned plot styles dwt


IbO ^3

^- t . a ^ o n

. 1.2. ,

(Select a Template)
54 AutoCAD 2000 , dwt d:\AutoCAD 2000
\Template. , AutoCAD AutoCAD 2000 d;

Visual LISP AutoCAD

,
Template. , :
Acad named plot styles.dwt
Acad.dwt
Acadiso named plot styles.dwt
Acadiso.dwt
Ansi a (portrait) color dependent plot styles.dwt
Ansi a (portrait) named plot styles.dwt
Ansi a color dependent plot styles.dwt
Ansi a named plot styles.dwt
Ansi b color dependent plot styles.dwt
Ansi b named plot styles.dwt
P Ansi color dependent plot styles.dwt
Ansi named plot styles.dwt
Ansi d color dependent plot styles.dwt
Ansi d named plot styles.dwt
Ansi e color dependent plot styles.dwt
Ansi e named plot styles.dwt
Ansi layout templates.dwt
D Architectural, english units color dependent plot styles.dwt
Architectural, english units named plot styles.dwt
Din aO color dependent plot styles.dwt
Din aO named plot styles.dwt
Din al color dependent plot styles.dwt
Din al named plot styles.dwt
Din a2 color dependent plot styles.dwt
Din a2 named plot styles.dwt
Din a3 color dependent plot styles.dwt
Din a3 named plot styles.dwt
Din a4 color dependent plot styles.dwt
Din a4 named plot styles.dwt
Generic 24inx32in title block color dependent plot styles.dwt
Generic 24inx32in title block named plot styles.dwt
Iso aO color dependent plot styles.dwt

1. AutoCAD

23

Iso named plot styles.dwt


Iso al color dependent plot styles.dwt
Iso al named plot styles.dwt
Iso a2 color dependent plot styles.dwt
Iso a2 named plot styles.dwt
Iso a3 color dependent plot styles.dwt
Iso a3 named plot styles.dwt
Iso a4 color dependent plot styles.dwt
Iso a4 named plot styles.dwt
Jis aO color dependent plot styles.dwt
Jis aO named plot styles.dwt
Jis al color dependent plot styles.dwt
Jis al named plot styles.dwt
Jis a2 color dependent plot styles.dwt
Jis a2 - named plot styles.dwt
Jis a3 color dependent plot styles.dwt
Jis a3 named plot styles.dwt
Jis a4 (landscape) color dependent plot styles.dwt
Jis a4 (landscape) named plot styles.dwt
Jis a4 (portrait) color dependent plot styles.dwt
Jis a4 (portrait) named plot styles.dwt
Metric layout templates.dwt
. (color dependent
plot styles) (named plot styles).
(Template
Description) (. 1.2) , , , acadiso.dwt AutoCAD:
" () .
".
(Browse)
AutoCAD,
(
(Select Template File)).

(Startup). -

24

Visual LISP AutoCAD

AutoCAD (, , . .), . ,
, (SAVEAS)
(Save As)
(File) (Save
Drawing As), (Save as type)
AutoCAD (*.dwt) (AutoCAD Drawing Template
(*.dwt)), (File name) , 2. Template, .
, (Save)
AutoCAD (Template Description), (Description), (Units) (. 1.3).
111

2: (534x12 n 4

. 1.3.

Jis a1 -color dependent pluf Jyle dwt


Jis a1 -named plot '/le- 1> >i
Jis a2 -color dependent plot styles.dvvt
Jis a2 -named plot style;: dvvt
Jis a3 -color dependent pfot slyles.dwt
Jis. a3 -named plot styles.dvvt

.4 (landscape) -coloj dependent plot styles, dwt


4 [land dpr| f r-d pj i tile d i
d-llr; rtrait| LI d ^ p n i d c r i t f l U t v l ^ d*\r
a4 [jn.rlrdt| r d n e d p L ^ M M d t
lri i uffeiiFlal d t

...

blE 1 "^TJ t Y - -1

. 1.4.

OK

1. AutoCAD

25_

2 Template,

(. 1.4).

1.2. acad.pgp
acad.pgp,
Support
AutoCAD (, d:\AtitoCAD 2000\Support).
AutoCAD (
. . 1.3 1.4),
AutoCAD ( . . 1.3),
acad.pgp , .
iv

AutoCAD, MS DOS ( 13- ), ACAD,


.

acad.pgp , , (aliases) (, ). 2
acad.pgp ,
AutoCAD. ,
, .
acad.pgp, 2,
:
Autodesk ;
;
;
;
;
13- AutoCAD ( AutoCAD 2000 );
14- AutoCAD;
;
.
acad.pgp .

26

Visual LISP AutoCAD

(. . , MS DOS Windows) acad.pgp :


-KGM.!ri,i:a~-, [<>] , <>[, [*]<>, [<>] ]

( <>
:: ;> , ),
, .

( , <> ).
:
<> (
, ),
AutoCAD ;
<)> ,
;

- , , 0 1 (.
);
<> , ;
; , ^
* ( 8,
* );
,3 <> (1,2 3; . ).

acad.pgp (. 2)
Notepat ()
Windows:
NOTEPAD,

START NOTEPAD,

I, "^ :,

( )
AutoCAD :
:
(File to edit:)
, (Notepad), , e:\Temp\begin.txt.
AutoCAD (START NOTEPAD e:\temp\begin.txt), , (. 1.5).
, acad.pgp,

27

1. AutoCAD

acad.pgp (
, , START c:\Windows\notepad.exe).

begin. IHI -

_^j j

15, 16, - 1 . 9 9 7 , 7 9 8 . 1 1 ,
12, MSt, 2 8 . 1 8 2 , 8 8 , 1 0 7 , )

/
( notepad

{

JJ

03955,0 3949 0 0000*

07. - |- |0

. 1.5. (Notepad)

acad.pgp START
,
Windows. AutoCAD :
:

(Application to start:)
,
Windows (, winword,
MS Word). . , ( , . 1.5 (Notepad)).
.
DOS
(SHELL). -

28

Visual LISP AutoCAD

AutoCAD 2000 1 SH, SH.


(SHELL) :
:
(OS Command:)
,
c:\nc\nc Norton Commander (. 1.6).
(, Norton
Commander <F10>)
.
(SHELL)
Windows. START DOS
.
, (SHELL)
<Enter>.
Windows AutoCAD Shell Active MS DOS (. 1.7),
DOS- (, c:\nc\nc Norton Commander).

i
D

4s

D *

/ ..

.
U
D

I - j ] |

~3

acadscar arx acisobi arjacadvba arx aetflatcn ar>


acasetup arx acmted ar>
acbiock arx acopni ar>
acbrowse arx acorbit ar>
acdccJ1*-l arx acoscale &n

*f*

'-

Q,

j'SAuloCAD Shell Active - NCMAIN


j i

. to

iTES

cdal

SAMPLE :
acdcii~i arx
SUPBT
acdcsy-vi arx
TEMPLATE
acdcte^-l arx

acdcxr-i arx
TUIXWIAL
acdun
arx
!
acdorcler arx
viide
ds acepiotx arx
aceidapp arx achlnkMi arx
acadps
or?< acisffiui arx

acder

acsiofcg
acsiui
acsoiids
appload
ase
asHisp
attedit
condlg
dv^aids

.
i
.

.
ii23v1ew
k372ans1
!8502ansi
'e33nsi
I8652ans1
I8662ansi
:ansi243?
ansi285Q
ansi2S63
ansisses
ansiiSee
-i

<3r a w '
exe drw^wmf
set ev-
set faces
set f t s h
set f l i p
set 1co26ib'
set mouse
set msptdib
set nc
set nc
set nc
e x e nc
exe nc
jbug . . tiss RC .
b
S

- '
exe nc :
r!$
exe n c e x i t
cwnii

55
nss
nss
ti5s
exe
nss
exe
cfg
exe
ext
fil
hip
ico
in$
irH
trag

nc_exit doc
ncciean exel
ncciean 1~

nCdd
msg
ncedit
exe
ncedit
ext
ncedit
msg
nctf
"""
ncff
ncff
nclabel
ncmain
ncnet
ncnet
msgji
ncpscrip \\

* 19.iO.99

10:O5

H X 1 I 2 /
4

tic nc

404.5523; 2,3646 ,

~ 1
: ' ; -| :|- |

. 1.6. DOS (SHELL)

29

1. AutoCAD

rt Q* Q, C Ib if U

ia Mi

"IF

_j

462 4503,2701063,0 0000

A'
. 0: fOTC- |

. 1.7. AutoCAD Shell Active

,
c:\nc\nc
<Fl0>.
(Close) .
AutoCAD EXIT.
<> ,
, 1 () 0 (
) ( 2):
1: , AutoCAD ;
2: ,
;
4: , "";
8: , (,
) .

_30

Visual LISP AutoCAD

2 4 . ,
2.
:
;
1 ;
3 ;
5 .
2 4 , AutoCAD
.
8 , (, "Heating Ventilation Air Conditioning.dwg").

, .
8 .
( <>) , . AutoCAD
:
1 DXB- $cmd.dxb;
; (DXBIN);
2 ( , ) DXB-, Scmd.dxb; (,
);
AutoCAD (INSERT); Scmd.dxb .
, 1, 2, , 3. 1
3 .
, AutoCAD

. . 1.3.
, acad.pgp
AutoCAD. , . :
<>,*<>

1. AutoCAD

31

, ,
. , .
2 ,
AutoCAD 2000 ,
, LA
LAYER, PEDIT . .
, acad.pgp AutoCAD.
, AutoCAD,
(REINIT). (Reinitialization) (. 1.8) PGP- .

ijcrpoifcfe
" -1:; ; ' : '--.,> '\-\' :;;. .
" PGP-

|[ il:

;'
.:" ' .

."':-.''

; I

. 1.8.

acad.pgp RE-INIT 16.

1.3. AutoCAD

(OPTIONS) AutoCAD
,
. , ( , , . .). AutoCAD ( arg), AutoCAD.
AutoCAD 2000
(,
, AutoCAD).
. 1.9 (
. . 1.4).
(OPTIONS)
(Options) (. 1.10).

32

Visual LISP AutoCAD

-,lQlx(
mm

I S AutoCAD 2D00
~M

_| , , IIIDOV'S1 AufuCnD 2000

GenHH
ulS

P
T
fM
i topnc-j 15
28
,3,' g

-15

.
1.9.
, AutoCAD 2000
:
3

Ter-

4<Unriamed Pfohle>>

~\

Drawingl.dwg

''] ] ] & | ] |

, -
^ ^ f f i ^ r i i j T b ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^

-.

+ IJ*j -ti
...

+ 5-*, 11
+.
='+ | j , .
+. (J ,

,'

.+ '\ ,
'+' U
,+; 1^| ObjectARX
'

::-;'.

':+\- 1 ^ |
:+, ^
'+ ^*|
+ Ijfi;
+ I ^ i

_XJ

; , AutoCAD , , ,
, , .

. 1.10. ,

(Options) : (Files),
(Display), / (Open and Save), (Plotting),
(System), (User Preferences), (Drafting), (Selection), (Profiles). (Current profile) (Unnamed Profile ), (Current
drawing) dwg (Drawingl.dwg
).
, (Profiles/

1 AutoCAD

33_

(Files)
:
(Support File Search Path)
(Working Support File Search Path)
(Device Driver File Search Path)
(Project Files Search Path)
, . (Menu, Help, and Miscellaneous File Names)
, (Text Editor, Dictionary, and
Font File Names)
, (Print
File, Spooler, and Prolog Section Names)
(Printer Support File Path)
ObjectARX (Search Path for ObjectARX Applications)
(Automatic Save File Location)
(Data Sources Location)
(Drawing Template File Location)
(Log File Location)
(Temporary Drawing File Location)
(Temporary External
Reference File Location)
(Texture Maps Search Path)
, ,
. . ,
- , .
, . ,
.
(Files).
(Support File Search
Path) , , ,
, , ( (INSERT)).
acad.pgp,
.
2

. 155

Visual LISP AutoCAD

34

, ,

(. 1.11).
, , .
, (Remove),
(Options).

'"**^^

- D:\AUTOCAD2000\support

,|

- * D:\AUTOCAD2000\support

D:\AUTOCAD2000\lonts

- , D:\AUT0CAD20CI0\fonts

D:\AUTOCAD2000\help

- D:\AUTOCAD2000\help

-- D:WJTOCAD2000\enpiess

i- DMUTOCAD2000\ezpiess

. 1 . 1 1 .

. 1.12.

,
(Add). (. 1.12).

, ( )
(Browse) (Browse for Folder)
. , AutoCAD ,
(Move Up). .
. . 1.13
D:\Paktl5, (Support File Search Path).
P - " ^ ^
j

- D:\AUTOCAD2000\supporl

- D:\AUTOCAD2000\font*

| - D:\AUT0CAD2000\help
i - D:\AUTOCAD2000\express

. 1 . 1 3 .

(Move Down) .
(Options) (Apply)
.

,
(, %MYPATH%, -

1. AutoCAD

35_

MYPATH autoexec.bat
, ). AutoCAD 2000.
(Working Support

File Search Path) , , AutoCAD.


.
(Support File Search Path) ,
.

,
. , autoexec.bat SET MYPATH=c:\bdr
\111076;d:\plans.
(Working Support File Search Path) : c:\bdr1\111076
d:\plans.

(Device Driver File Search Path)


, AutoCAD , ,
. .
(Project Files Search Path)
, .
. AutoCAD PROJECTNAME .
, . (Menu, Help, and Mis-

cellaneous File Names) (: , AutoCAD 2000 d:\AutoCAD 2000):


(Menu File) d:\AutoCAD 2000\support\acad
( mnu);
(MENU);
(Help File) d:\AutoCAD 2000\help
\acad.hlp;
(Default Internet Location)
d:\AutoCAD 2000\home.htm; , (BROWSER); AutoCAD INETLOCATION;
(Configuration File) d:\AutoCAD 2000
\acad2000.cfg;
AutoCAD; / (. );

36

Visual LISP AutoCAD

(License Server) AutoCAD 2000; ACADSERVER.


, (Text Editor, Dictionary,
and Font File Names) (Files) :
(Text Editor Application) , , ( AutoCAD MTEXTED);
(Main Dictionary) , (
DCTMAIN);
(Custom Dictionary File) , ( DCTCUST);
(Alternate Font File) , AutoCAD ,
acad.fmp ( );
FONTALT;
(Font Mapping File)
( acad.fmp); FONTMAP.
,
(Print File, Spooler, and Prolog Section Names) :
(Plot File Name For Legacy
Plotting Scripts) ,
AutoCAD; AutoCAD 2000 : _-_.11:;
(Print Spool Executable)
(
, );
%s, ;
PostScript (PostScript Prolog Section
Name) acad.psf,
(PSOUT) ;
PSPROLOG.

1. AutoCAD

37_

(Printer Support File Path) , :


(Print Spooler File Location) , ;
(Printer Configuration Search Path)
( );
(Printer Description File Search
Path) ( );
(Plot Style Table Search Path)

( stb ctb).
ObjectARX (Search Path for ObjectARX
Applications) ,
C++ ObjectARX (
. . 1.7).
AutoCAD .
(Automatic Save File Location)
(
SAVEFILEPATH).
(Data Sources Location)
, .
AutoCAD.
(Drawing Template File Location)
,
(. 1.1).
(Log File Location) , / (Open and Save).
LOGFILEPATH.
(Temporary Drawing File Location)
AutoCAD,
.
AutoCAD. TEMPPREFIX, . ,
,
CD-ROM.
(Temporary External
Reference File Location) ,
(Enabled with Copy)

38

Visual LISP AutoCAD

(Demand Load Xrefs) / (Open and Save)


(Options). XLOADPATH.
(Texture Maps Search Path)
( ).
AutoCAD 2000
(Profiles) (Options) (. 1.14).
1
f4Pliii**'npMttK:.i

<fUrnamtdfiqtie

, "'.

:
:

Dtawirjgt.oVyg

,'

) ] / |; j ) ! ] ! ;1|
:

: :
<<Unnamed Profile

..,
..-.- :

...
'*

;Ttie default profde name:; ;

0:

. 1.14. ,

, , , arg ( , ) , , arg.
(Profiles) (Options) (Available Prifiles) , AutoCAD.
. <<Unnamed Profile>>.
, -

1. AutoCAD

39_

. (Available Prifiles) (), .



:
(Set Current)
;
(Add to List) AutoCAD
;
(Rename) ;
(Delete) ( ,
);
(Export)
arg;
(Import)
arg;
(Reset) ,
AutoCAD 2000 .

(Add to List), (Add Profile) (. 1.15).
\

:
]CAD -profile 1
:, .
1

. 1.15.

(Profile name)
, (Description) .
(Accept) , (Profiles) (Options) (. 1.16).
(Set Current) ,
(Available profiles).

(Options) (Current profile).
(Export),
(Export Profile) (. 1.17).

Visual LISP AutoCAD

40
j k

J ]. 0

) &1.|':;| j;Bbi6op I

; ;
Unnamed Profile

,: -'.:

':.";);

^ 1

"

. 1.16.
(
g: a
_ J Data Links
2JD(V
I J Express
J Fonts
_JHelp
_J Plot Styles

AutoCAD2000
L_J Plotters
CJ Sample
CJ Support
D Template
CI3 Textures
CJ Tutorial

|] Temp.arg

:
1 : ( (".ARG)

. 1.17.

arg .
(Profiles)
(Options) , , .

41

1. AutoCAD

AutoCAD
" AutoCAD 2000", .
. , AutoCAD
acad.pgp,
(, AutoCAD . . 1.4), (
, ).
,
.
(acad.lsp, acaddoc.lsp, acad.lin . . . I).

1.4. AutoCAD
,
AutoCAD 2000.
, - (. . 1.9).
Windows
AutoCAD (Properties),
(Shortcut)
(Program)1 (. 1.18).
: AutoCAD 2000
|

.Jfc

AutoD.2Q00::

> : .:; ':

1lD:\AutoCAD2000\acadexe"

. : J"d:NAutoCAD 2000"
= : ]
]

'" !.'.: . ...:'.' " 1'.' j1


' '.. .; . * '' " '*:
,:.. | ^. |

...1

..!

. 1.18.
: AutoCAD 2000

(Program) DOS-. .

42

Visual LISP AutoCAD

(Start in) ,
AutoCAD . , , (Support File Search
Path), . ,
, , AutoCAD 2000.

AutoCAD, MS DOS, .

(Cmd file)
acad.exe, , AutoCAD.
, .
:
/ , cfg;
/s ;
/ ;
/ ;
/t ;
/noiogo AutoCAD;
/ ;
/ .
, /noiogo,
( ). acad.exe, . , , , ( , ).
.
/ AutoCAD
, cfg.
AutoCAD. acad2000.cfg, cfg .
, AutoCAD
( , , acad2000.cfg).
/ , AutoCAD 2000 AutoCAD, -

1. AutoCAD

43

, ACADCFGW ACADCFG.
/:
"d:\AutoCAD 2000\acad.exe" / "e:\New_conf\my_confl"

AutoCAD
my_confl.cfg, e:\New_conf.
/s , (, , ,
,
Auto LISP). , , . 15.
, AutoCAD
, (Options).
/s:
"d:\AutoCAD 2000\acad.exe" /s "f:\User
fonts;f:\myhatch;d:\Programs\LISP"

AutoCAD ACAD. ,
ACAD, .

/ (
scr), AutoCAD.
, AutoCAD . /
define.scr ( , , ):
"d:\AutoCAD 2000\acad.exe" / "f:\User\define"

/ AutoCAD
. ( acad2000.cfg), cfg
bak.
/t AutoCAD
, , ( dwt) (
dwg). . 1.1. , -
. :
"d:\AutoCAD 2000\acad.exe" /t "f:\User\Templates\Back"

Visual LISP AutoCAD

/noiogo AutoCAD 2000 , .


/v , . :
"d:\AutoCAD 2000\acad.exe" Housel20 /v plan
/v ,
.
House 120,
plan (. ).
/ , AutoCAD.
(Options).
. . 1.3.
arg, . , ( ). :
"d:\AutoCAD 2000\acad.exe" / "Ship model profile"


AutoCAD, AutoCAD .
,
. dwg . , , , . ,
: acad.exe f : \ P l a n s
\DrawinglO8 /b d e f i n e .

1.5.

,
( ) dwg, . . ,
. . ,
, (
, ),

! ,(JNSERT).

1. AutoCAD

45

,
(INSERT)
. . . 4. , ,
. 1.7.
15- (. . AutoCAD 2000) , AutoCAD , .
(Preview) (Choose Drawing
File) (. 1.19) ,
.

:

1 ^ (".d

. 1.19.

.
(Preview). AutoCAD 2000.

,
, . AutoCAD
ActiveX. ,
. 1.20.
AutoCAD 2000
. . 1.20
: Drawingl, Electrical Power Drawing2. (Electrical

46

Visual LISP AutoCAD

Power) .
, , , , , Drawing 1. Electrical Power
, ,
Drawing 1, .
,
ActiveX. ,
. ,
.
A AutoCAD 2000 -
!
:
--'
".
":::;'! P^^^U'^'ty&vi&i^^ ^^^I'J:^ '':.-::-i
,' ,

1 {
;
oia:

[:

|
1' 0430/9 0192,0 0000

. 1.20.


Windows. (Edit),
(CUTCLIP), (COPYCLIP),
(COPYBASE), (PASTECLIP), (PASTEORIG),
(PASTEBLOCK), " AutoCAD
2000" . 7.1.

AutoCAD (AutoCAD DesignCenter), .

47

1. AutoCAD

1.6. AutoCAD
(, ,
. .) (,
. .), .
AutoCAD 2000
(DesignCenter) (. 1.21).
I

*, _j HELP
V]
_1 Po
l t Stye
ls
_J PLOTTERS
- ._] SAMPLE
+ _J ACTV
IEX
| Database Connectvitiy
'
- +.|DAnalog
esg
i nCeIntegrated
nter Circuits dwg

I'lBattery

Capacitor

--^

Li

Circuit Breaker

Diode

Diode-Zener

Full Wave Bridge

* AutoCAD 2000 Textstyles and L


- FJ5 Basic Electronics.dwg

E^il
[51
[|

^
^
^ \
rrrri
CMOS Integrated Dtcuits-dwg
^ Electrical Power.dwg
?J Fasteners Metric dwg
TU Fasteners US dwg
^ Home Space Planner.dwg
^ House Designer dwg
"3 HVAC - Heating Ventilation Air
1
!

Fuse

Generao
tr-AC
J

D.\AutoCAD2000\SAMPLE\DesignCentef\Basic Electronics.!\ {: 24)

. 1.21.

(ADCENTER)
AutoCAD (AutoCAD DesignCenter) [].
(DesignCenter) AutoCAD (AutoCAD
DesignCenter), (ADCCLOSE),
.
, ,
:
;
;

_4S

Visual LISP AutoCAD

;
;
;
;
;
, (IMAGEATTACH).
. 1.21 , Basic Electronic.dwg, AutoCAD 2000, , .
- , (
. 1.21 ).
.
, ,

AutoCAD. To , .
.

1.7.

, .
AutoCAD. sld,
( sib).
AutoCAD
(MSLIDE). , ,
, (
()
, , ). , , , 3:2.
(MSLIDE), (Create Slide File) (. 1.22).
, sld.

1. AutoCAD

49

AutoCAD2000 Eng

iJiData Links!
j'Drv
,,..1 Express
I j Fonts
I ! Help
2i Plot Styles

L J Plotters
L 3 Sample
C j Support
G j Template
:_J T extures
C j Tutorial

jDrawingi

1 :; | p.tld)

tpijpaHwf ^ I
;

. 1.22.

AutoCAD (VSLIDE).
1.1 , .
! 1.1.
;
;
_VSLIDE PARTI
;
_VSLIDE *PART2
; 10 .
_DELAY 10000
;
_VSLIDE
;
_VSLIDE *SECTION
; 20 .
_DELAY 20000
;
_VSLIDE
; 30 .
_DEIAY 30000
;
_RSCRIPT
(
scr). , AutoCAD
(. . ). ,
, .

50

Visual LISP AutoCAD

,
( , AutoCAD).
, present.scr, , (SCRIPT)
(Choose Script File)
present.scr. .

partl.sld part2.sld section.sld (
parti part2).
_VSLIDE PARTI partl.sld (
,
AutoCAD).
_VSLIDE *PART2
part2.sld .
.
_DELAY 10 . (DELAY),
.

(DELAY) 1
32 767. (DELAY) .

_VSLIDE
( , . . , ).
(_VSLIDE ^SECTION _DELAY 20000) section.sld
20 .
(VSLIDE) 30 (_DELAY ).
RSCRIPT
. (RSCRIPT)
"" , , , . ,
<Esc>.

,
.

1. AutoCAD

51_


slidelib.exe, Support AutoCAD.
AutoCAD (
Windows):
s l i d e l i b <

( sib
), (, list.ts),
( sld). ( <)
slidelib.exe ( Windows), :
slidelib exhibition<list.ts
l i s t . t s slidelib exhibition.
(VSLIDE) ,
, :
exhibition(parti)
exhibition , a parti .

1.8.
AutoCAD :
Visual LISP LISP;
Visual Basic for Applications Basic;
ObjectARX C++.
,
AutoCAD, LISP (,
AutoCAD AutoLISP). AutoCAD 2000
Visual LISP,
. AutoLISP 2, Visual LISP 3.
, AutoCAD, Basic, Microsoft Visual Basic for Applications ( AutoCAD 2000). ObjectARX,
C++.
.

52

Visual LISP AutoCAD

4 (
AutoLISP ), 5 ,
.

,
AutoCAD. , (, . .) ( - , ):
1. <Enter>,
AutoCAD ;
, AutoCAD (HELP).
2. AutoCAD. ,
.
3. .
4. , acad.pgp.
5. , .
6. .
(SETVAR) .
7. , acad.pgp. AutoCAD.
8. ,
.

AutoLISP
AutoLISP LISP,
,
AutoCAD. LISP ,
(,
, . .). , ,
. . AutoLISP
,
AutoCAD. AutoCAD AutoLISP.
AutoLISP
. 4 5 .
AutoLISP AutoCAD 2000 Visual LISP, 3. , Visual LISP
AutoCAD.
AutoLISP, ,
AutoCAD 2000. , AutoLISP 1014.

2.1. AutoLISP
AutoCAD AutoLISP, ,
: (Command:)
(. AutoCAD

54

Visual LISP AutoCAD

Auto LISP, , . . ,
. ,
:
(+

223.75

16.002

89.899)

<Enter>,
AutoCAD (. 2.1):
329.651 (,
).

A \ #

i M /j 1 2 :
.,'

( + 22

75

16.002

89.899)

,329.651
.

. 2 . 1 .
AutoLISP

AutoLISP .
AutoLISP
Isp, AutoCAD l o a d (.
. 2.2.4).

2.1.1.
,
: (+),
, . . (223.75, 16.002 89.899).
AutoLISP:
(<>

[<1>

<>

[<2>

...

[<>]...]])
<1>,

<2>,

...,

<> , , ,
. . . , . AutoLISP
5.
AutoLISP , ,
, ' .

2. AutoLISP

S5_

AutoLISP , . . . AutoCAD,
(,
), (. 2.2).

|
AV
' < ' > I Hl\ ! X
iBbiSepume

^ (+ 223 75 16 002.89 899


1(_>
_

. 2.2.

, . 2.2,
<Enter>.
. Visual LISP (.
. 3)
.
, , AutoLISP
( . . 2.2).
AutoLISP , , . .
,
,
(
. . 2.2).
:
(-

(+

56.022

78.11)

(+

123.77

78.0))

(), , (. .
+). AutoLISP
(
134.132 201.77),
(- 134.132 201.77), -67.638 ( ).

2.1.2. setq
AutoLISP AutoCAD. . 2.1 ,
329.651. , ,
,

56

Visual LISP AutoCAD

. 2.1.1 (
), (, , , )
setq, :
(setq <1> <1> [<2> <2> ...
[<> <1> ] ... ] )

setq , . <1>, <2> . .


() AutoLISP, . . 2.2. <1>,
<2> . . AutoLISP, (, ).
setq , . :
( s e t q myd

(-

(+ 5 6 . 0 2 2 78.11)

(+ 123.77 7 8 . 0 ) ) )

, . 2.1.2,
myd.
myd ! ( ). AutoCAD
: (Command:) !myd, AutoCAD
myd ( : 329.651).

2.1.3.
, , ,
. ,
; ( ), |
( ), . .
, ; |, | ;
( ).
;
(setq two_pi (+ pi pi))
;
(setq md (+ 56.022;I
|;78.11))
(command "_CIRCLE" '(0 0) 50) ;

2. AutoLISP

57_

2.2.
AutoLISP , -
,
. AutoLISP , ,
, . (), , (),
; ( ), ' (), / ( ), \ ( ).
(, ).
, ,
(. . 2.2.2).
AutoLISP 5.

^)

AutoLISP ( ) .

setq, SETQ, SETq, Setq, sETQ setq.

2.2.1.
AutoLISP :
;
;
;
;
;
;
, ;
AutoCAD;
;
VLA-.

^
type (. . 2.7.1).

AutoLISP (
AutoLISP
FORTRAN). : , , .

58

Visual LISP AutoCAD

,
. 2,147,483,648 +2,147,483,647
( ;
).
(

~)

g e t i n t , ,
-32 768 +32 767.
AutoLISP .

, . ,
(+ -).
, , .
, ,
. (+ -).
10 ( ). (,
.5 0.5).
( ) ,
, . . , , . \,
(,
\). "" .
, : \ , \t .
,
(, , ). AutoCAD ,
.
:
57
-100092
12.98207
"string(2) for printing"

"52\\_1" ( ,
; , 52\_i)

2. AutoUSP

' ( 1 5

100

'("" ""

'(""

59_

-2)
"" " " ""
15

"online"

"")

90.22

"")

setq , ,
(<>), .
,
(, atoi, fix, float, rtos .). . 2.7.

2.2.2.
, , , :
, "";
nil (
""); 0
("");
pi ,
(3.14159...);
pause ,
AutoCAD ( command).
.

, ,
, n i l (, ,
. .).

2.2.3.
(),
. setq, :
(setq rl 15.33 s24 9)
r l s24, , ,
15. () 9 (). -

60

Visual LISP AutoCAD

, , , . nil, , AutoLISP.
(

( AutoCAD ) .
(. . 2.17.33).

, :
( s e t q 2 (+ 20.56 ) )

2.2.4. load
AutoLISP ,
AutoLISP lsp ( ,
;
),
load. :
(load <>

[<>])

<> , <>
, ,
. ,
(. defun). ,
, .
:
(load "longwid.lsp" " ")

<> , AutoCAD. <>


,
(. . 1.3).
, "f:/Dis/Progs/longwid.lsp"
"f :\\Dis\\Progs\\iongwid.isp".
,
(.
. 2.2.1).

2. AutoLISP

61_

, AutoCAD
, :
vlx
fas
lsp
vlx VLX-, fas LISP- FAS-, lsp LISP.
lsp, . . vlx fas
. ( fas)
( fas vlx) . 3.

2.2.5. vl-load-all
AutoCAD 2000 (). ,
lsp . load
.
LISP- AutoCAD
, vi-ioad-aii:
(vl-load-all

<>)

<> (
, load). , .
.
. . 2.17.29.

2.3. AutoCAD
AutoLISP
command, AutoCAD .
vi-cmdf ( . 2.3.2).

2.3.1. command
:
(command

[<1>

[<2>

nil.

...

[<>]

...

]])

62

Visual LISP AutoCAD


<Esc>, . , . , <Enter>.

(~

command
AutoLISP, ( g e t i n t , g e t r e a l , g e t p o i n t . . . . 2.10). ,
.
command.

, 210
297 ( (0,0)
(210,297)). , AutoCAD
(LINE). , AutoCAD,
( _LINE).
.
, :
_LINE

0,0

210,0

210,297

0,297

AutoCAD _LINE,
(0,0), (210,0),
(210,297), (0,297), _ ( (Close)) ( ). , , , 2.1.
i 2.1. ( 1)
(command "_LINE" "0,0" "210,0" "210,297" "0,297" "_")

(
command).

2. AutoLISP

63_

\ 2.2. ( 2)

(command "_LINE" "0,0" "210,0")


(command "210,297" "0,297")
(command "_C")

2.2 command,
.
, ( 2.3).
\ 2.3. ( 3)
(command "__LINE"

' ( 0 0)

' (210 0)

' (210 297)

' (0 297)

"_")

, (210 0) 210 .
, ,
command , - , : :
(command "_COLOR" "I")
(command "_COLOR" 1)
(
, 1),
, .
command
AutoCAD, :
(command "_COLOR" I "_ZOOM" " _ E " )

(COLOR)
(ZOOM)
(EXTENTS).
,
<Enter>, command (""). , , 2.1, _LINE _
( ), <Enter> (
), :
(command " _ L I N E "

"0,0"

"210,0"

"210,297"

"0,297"

"")

7, 9, 11, 12 ,
command.

64_

Visual LISP AutoCAD

2.3.2. vl-cmdf
vl-cmdf :
(vl-cmdf

[<1>

[<2>

...

[<>]

...

]])

, AutoCAD ( . . , , , AutoLISP . .). command,


vl-cmdf AutoLISP,
(getint . .).
<Esc>.
, ,
, , nil .
vl-cmdf command ,
AutoCAD
.
- , vl-cmdf AutoCAD, .
AutoCAD
(. . , ).
command ,
AutoCAD .
, 2.12.3, command vl-cmdf.

2.4.
,
.
. ,
. , , .
, , .

2.4.1. +
.
(+ [<1> [<2> ... [<>] ... ]])

: .

2. AutoLISP

65_

: , ; , .
, ().
1, ,
.
:
( + 1 3 ) 4
( + - 2 2 )
(+ 12 7 11.00) .

2.4.2. .
(- [<1> [<2> . . . [<1>] ... ] ] )

: .
: , ; , .
, (). 1, , 0 (. . <1>
). 2 ,
.
:
(-3) -

(- -2 i . i 0.3) -3.4

2.4.3. *
.
(* [<1> [<2> ... [<>] ...]])

: .
: , ; , .
, ().
1, .
2 ,
.
:
(* 3)
(* -2 1.1 0.3) -.
3 . 155

66

Visual LISP AutoCAD

,
. , (* 12345 987654)
-692313258, , . . . .

2.4.4. /
.
(/ [<1> [<2> ... [<>] ... ]])

: .
: , ; , .
, ().
1, .
2 ,
.
:

(/ 3)

( / - 2 1.10.3) -6.06061 (
, )

{/ 5 12)

, , . . , (
). , (/ 5 12) 0.

2.4.5. 1+
1.
(1+ <>)

: .
: , ; ,
.

2. AutoLISP

67_

(1+3) 4

( l + l . i ) 2.1

2.4.6. 1 I.
( 1 - <>)

: .
: , ; ,
.
:

(1-3)

( l - i . i ) . 1

2.4.7. ~
1 (. .
<> 1).
(~ <>)

: .
: .
:

(~ 3) -4

(~ 0) -i

2.4.8. abs
.
(abs <>)

: .
: , ; ,
.
:
(abs 3)

(abs -1.1) 1.1

68

Visual LISP AutoCAD

2.5.

. while repeat, .

2.5.1. =
(
).
(= <1> [<2> ... [<>]...])

: .
: (, , nil, ).
, . 2 , , nil. , . ,
, , .
:
{= -. - -.)
(=3)
(= 80 "80") nil
(=2 30) nil

(= "STR56" "str56" Mstr56") nil

(= "abcde" "abcde")

. eq equal .2.5.19 2.5.20.

2.5.2. /=
(
).
(/= <1> [<2> ... [<apryMeHTN>]...])

: .
: (, - , nil, ). ,
.

2. AutoLISP

69_

(/= 3)

(/= -1.0 -1) nil

(/= 2 30)

(/= "STR56" "str56" "str56")

(/= "abcde" "abcde") nil

2.5.3. <
, .
(< <1> [<2> . . . [<1>3>] . . . ] )

: (, ) .
: (, , n i l ).
, 1.
, .
:

(< 3)

(< ~1. 0)

(< 2 2 30) nil

(< "" "" "")

(< "abcde" "abcde") n i l

(< "q" "qa")

(< "qa" "q") n i l

2.5.4. <=
, .
(<= <1> [<2> ... [<>]...])

: (, ) .
: (, , nil ).
1

, . .
. .

70

Visual LISP AutoCAD

, .
, .
:

(<= 3)

(<= -1.0 0)

(<= 2 2 30)

{<= "" "" "")

(<= "abcde" "abcde")

(<=

{<= "qa" "q") nil

,.q.- q a ")

2.5.5. >
, .
(> <1> [<2> ... [<>]...])

: (, ) .
: (, , nil ).
, .
, .
:
(> 3)

(> -1.0 0) nil


(> 2 2 30) nil
,,j nil
( >
k

(> "abcde" "abcde") n i l


" q a .i) n i l

(>

(> "qa" "q")

2.5.6. >=
, .
(>= <1> [<2> . . . [<>]...])

: (, ) .

2. AutoLISP

71_

: (, , nil ).
, .
, .
:

(>= 3)
(>-- -1.0 0) nil

(>= 2 2 30) nil

(>= " "b" "") nil

(>= "abcde" "abcde")


.. q a ") nil

( > = q.,
(>= " q a " "q")

2.5.7. and
.
(and [<1> [<2> . . . [<>] ...-]])

: .
: (,
, nil ). , ,
(, . .), nil.
, .
:

(and 3)

(and nil ) nil

(and 2)

(and "a" "b" "")

2.5.8. or
.
(or [<1> [<2> . . . [<.>] ...]])

: .
: (,
, nil ). , ,
(, . .), nil.

72

Visual LISP AutoCAD

, .
:
(or 3)
(or nil )

(or 2)
( k,,j
(or nil nil) nil

2.5.9. not
.
(not <>)

: .
: (,
nil, nil ).
:
(not T) nil
(not nil)
D
(not 15.88) nil
(not "Tram") nil

2.5.10. null
nil.
(null <>)

: .
: (,
nil, nil ).
not. null ( nil), a not .
:
(null ) nil

(null nil)
(null '()) ?
(null "Tram") nil

2. AutoLISP

73_

2.5.11. if
if-then-else (--).
(if <> <1> [<2>])

: .
: <1>,
<> nil (, n i l
"");
<2>, <> nil (
<2> , nil).
.
:

(if (> ) 1 ) 1, >,

(if (= hi h2) (+ 15) (* hi 2.5))


(+ hi 15), hi h2 ;
(* hi 2.5)

(if (< a b) "a<b") "a<b" nil (. . <2>


)

(if n i l "Point") nil (. . <> )

if , , progn ( ,
if).

2.5.12.
( ) , AutoLISP ( if).
(progn <1> <2> ... [<">])

: .

(>
(setq d (- a b)) (* d
(setq 2), (setq

progn .
) (setq -1),
b),
d (* ) ) (* d ) .

1 2.4. if progn
(if

(>

(progn

b)

74

Visual LISP AutoCAD


(setq -1)
(setq d

(-cab))

(* d b)
); progn
(progn
(setq 2)
( s e t q d (* a b) )
(* d c)

); progn
); if

, , .
, (. . 2.1.3).

2.5.13. cond
( case - ) .
(cond

(<1>

[<1>

...

])[(<2>[<2>

...

])]

...)

: , , , (), .
:
. (
),
<>. cond , nil.
:

(cond) nil

(cond (14)) 14

, cond
.
: mycoior AutoCAD ("",
"", "", "", "")
, 1, 2, 3, 4, 5. , mycoior
"" ( ).

2. AutoUSP
; 2.5. 1 cond

75_
;

(setq mycolor
(cond
((= 1) "")
((= 2) "")
( (= 3) "")
( (= 4) "")
( (= 5) "")
( "")
); cond
); setq

setq mycolor cond. , cond, . ,


((= 1) "") ,
. , 1 ,
, "",
cond , "".
"", . . , , (. . "" ),
1, 2, 3, 4, 5, cond
( ).
, <> .
| 2.6. 2 cond
(cond
((= 1)

) ; = cc 1
((= cc 2)

( s e t q abc "")
(command "_PLINE" " - 5 0 , 1 2 0 . 4 5 " " 9 7 . 6 6 , 2 3 . 1 2 4 " " 4 5 . 7 , 8 0 0 "
"_C")
( s e t q abc "")
(command "_CIRCLE" " - 5 0 , 1 2 0 . 4 5 " "100")

) ; = cc 2
); cond

cond .
1, setq abc "",
AutoCAD .
2, setq abc
"", a AutoCAD 100. ,

76

Visual LISP AutoCAD

1, 2, cond nil,
abc
AutoCAD. command
, cond,
nil (nil
command . . 2.3.1). cond
, abc .

2.5.14. minusp
.
(minusp <>)

: .
: , <> , nil
.
:
(minusp 0) nil
(minusp -7.1230)
(minusp (- 52 24 39))

2.5.15. zerop
.
(zerop <>)

: .
: , <> , nil
.
:
n

(zerop 0)

(zerop .)
(zerop 1) nil
(zerop -21.82) nil

2.5.16. numberp
.
(numberp <>)

2. AutoLISP

77_

: .
: , <> , n i l .
:

(numberp 0)

(nuirberp - . )

(numberp "1") n i l

(numberp ' (-21.82)) n i l ( )

2.5.17. listp
.
(listp <>)
: .
: , <> n i l (. .
' nil), n i l .
:

( l i s t p 0) n i l

( l i s t p -.) n i l

(listp "1") n i l

(listp '(-21.82))

(listp nil)

2.5.18. vl-consp
, <> ( listp).
(vl-consp <>)
nil.
:

(vl-consp '(15.0 66.109))

(vl-consp ' ( ) ) n i l

(vl-consp 50) n i l

78

Visual LISP AutoCAD

2.5.19. atom
, <> (. . ).
(atom <>)
nil.
:
(atom nil)
(atom '(12 3)) nil
(atom '())
(atom i)

2.5.20. vl-symbolp
, <> .
(vl-symbolp <>)
nil.
:

(vl-symbolp )

(vi-symboip nil) n i l

(vi-symboip i) n i l

(vl-symbolp - )

2.5.21. boundp
, .
(boundp <>)
: .
: , <> ,
( nil), n i l , n i l (
AutoLISP ).
.
:

(boundp '+) ?

(boundp 'and)
(boundp "1") nil

2. AutoLISP

79_

2.5.22. eq
( =).
(eq <1> <2>)

: .
: (, , nil, ).
:

(eq -. -)

(eq 3) n i l

(eq "g80" "g80")


(eq "abc" "ABC") n i l

2.5.23. equal
( ).
(equal <1> <2> [<>])

: .
: (, <>, nil,
; <> , ). , ,
<> .
:

(equal -. -)

(equal . 3.002 0.002)

(equal "font" "font")

(equal ' ( 1 . 0 0 2.13 2.99)

' ( 1 2 . 1 3 3.0)

0.1)

(equal ' ( 1 . 0 0 2 . 1 3 2.99)

' ( 1 2.13 .)

o . o o o i ) n i l

2.5.24. while
.
(while <> <1> [<2> . . .

: .

[<>]...])

80

Visual LISP AutoCAD

while ,
<> nil. , while, .
: <>,
<> , nil.
<> nil, while n i l .
. ! (), . . 1 . .
i 2.7. while ( ) \
(setq i I factorial 1)
(while (< i n)
(setq i (1+ i) )
(setq factorial (* factorial i))
}; while

, 11 (. . 11!).
i ( )
factorial ( , ). , 1
1 ( 1! 1).
while (< i ) i,
nil,
( setq). ,
i 1, (< i n)
("") while i 1 ( i=2)
factorial i: factoriai=i*2 ( , 2!).
( i=2).
"", i 3 (2+1),
a factorial 6 (2*3). , i (11) , . :
n=ii factoriai=39,9i6,800 ( ).

2.5.25. repeat
.
(repeat <>

[<1> . . . ] )

: <> ( ), <1> .

2. AutoLISP

81_

<1> ,
.
: .
<> 0
<> , repeat nil.
(. 2.7) while repeat.
2.8. repeat
( )
(setq i I factorial 1)
(repeat (1- n)
(setq i (1+ i))
(setq factorial (* factorial i))
); repeat

i=i factoriai=i!=i,
factorial 2, 3, ..., . -i, AutoLISP (i-). ,
.

2.6.

AutoLISP.

2.6.1. fix
( ).
(fix

<>)

: .
: .
:

(fix -10.083) -10

(fix 37) 37

(fix 0.0)

(fix 40.45) 40

82_

Visual LISP AutoCAD

2.6.2. rem
<1> <2>,
<> . .
(rem

[<1>

[<2>

...

[<>]...]])

: .
: , , , .
, . '
<1>, .
:

(rem)

(rem 7) 7

(rem 14 2)

(rem 15 6.0) .

(rem 12.9 3.5) 2.4

(rem so 17 3) 1

(rem - -3) -1

(rem -3) i

(rem -10 3) - i

6 ending, rem .

2.6.3. max
.
(max [<1> [<2> ... [<>] ... ]])

: .
: , , , .
, . <1>, .
:
D

(max -2 -12)

(max 7 3.4 2.0092) 7. 0

2. AutoLISP

83_

2.6.4. min
.
(min [<1> [<2> ... [<>] ... ]])
: .
: , , , .
, 0.
<1>, .
:

(min -2 -12) -12

(mir; 7 3 . 4 2 . 0 0 9 2 ) 2 . 0 0 9 2

2.6.5. gcd

.
(gcd <1> <2>)
: ..
: .
:
(gcd 42 12)
(gcd 7 34) 1

2.6.6. angle
X ,
, <1>, ,
<2>. , X ,
, .
(angle <1> <2>)
: (. . -
).
.
:

(angle '(0 0) '(250.0 .)) .


(angle ' ( l o o 0) ' ( l o o .)) 1.5708 (AutoCAD
1.5708,

84_

Visual LISP AutoCAD

15
)

(angle

'( 0)

' ( 5 0 . 0 50.0)) 0.785398

2.6.7. distance
, <1>,
, <2>. ,
X ,
, .
(distance <.1> <2>)

: (. . -
).
. ( ),
. , .
:
D

(distance

'(0 0)

'(250.0 0.0)) 250.0

(distance

'(-1.0

0.413 2.002)

'(25.1

34.5

6.0)) 43.1175

2.6.8. sqrt
.
(sqrt <>)

: .
.
:

(sqrt 25) 5.0

(sqrt 1.88) 1.37

2.6.9. sin
.
(sin

<>)

: ( ).
.

2. AutoLISP
:

(sin -1) -0.841471

(sin .) .

2.6.10. cos
.
(cos <>)
: ( ).
.
:

(cos -l) 0.540302

(cos 0.0) l.o

(cos (* pi 0.5)) . 123- ( 0)

2.6.11. atari
.
(atan <1> [<2>])
: .
( ).
, <1>.
,
(<1>/<2>). <2> ,
+pi/2 -pi/2 (
<1>).
:

(atan 1) 0.785398

(atan -1 0) -1.5708

2.6.12.
(2.71828).
( <>)
: .
.

Visual LISP AutoCAD


:
0

(exp 1) 2.71828

(exp o.o) i .

(exp pi) 23.1407

2.6.13. expt
.
(expt <> <>)
: .
: , , , . <>
, <> .
:

(expt 2 2) 4

(expt -2 2.0) 4.

(expt 4 -1) ( )

(expt 2 -1.0) . 5

(expt -1 -1.0) -1.

2.6.14. log
.
(log <>)
: .
: .
:

(log 1) .
(log 2.205) 0.790728

2.6.15. logand
.
( l o g a n d [ < 1 > [ < 2 > ... [ < > ] . . . ] ] )
: .
: .

2. AutoUSP

.
( , 2, 2 0 1; 0
2
0 30). : 5 = 12 +02'+12 =
= 1012, 3 = 12+12> = 112.
31- () (
1, 0). , () :
(logand 0 0)= (logand 10)= (logand 0 1) = 0; (logand 11) - 1
, . <1>, .
:
(logand 5) 1
(logand 2) 2
(logand)

2.6.16. logior
.
(logior [<1> [<2> . . . [<!>] ...]])

: .
: .
:
(logior 10)= (logior 0 1)= (logior 11)= 1; (logior 0 0) = 0
, . , <1>.
:
a

(logior 5) 7

(logior 2) 2

2.6.17. Ish
.
(Ish

[<>

[<>]])

: .
: .

88

Visual LISP AutoCAD

( . . 2.6.15). ,
<> , , <> .
32 ( 0 31 ), 31- , .
.
, . <> 0, <>.
:

(ish 2 1) 4

(Ish 3 30) -1073741824

(ish 15 -1) 7

(ish 15 -2)

(ish 15 -3) 1

(ish i s -4)

2.6.18. Boole
.
(Boole <> <1>

[<2>

...

]])

: .
<> 0 15,
16- .
.
: .
( , . . , 0 1) :
1,

1 = 2";
(1 0) 1, 2 = 2';
(0 1) 1, 4 = 2 2 ;
(0 0) 1, 8 = 2 3 .
logand logior 1 7.

2. AutoLISP

89_

<1> <2>,
<> . .
(<> <1>),
<!>.
:
(Boole is - 45) -1
(Boole 8 16 ) -18

2.6.19. inters
inters :
(inters <1> <2> <> <4> [<>])

,
, <1> <2>,
, <> <4>.
<> nil, , , , .
: , ; <>
( , nil ).
: nil,
.
(. . ),
,
, .
,
.
:

(inters

"(6.20

4.77)

(-0.0185357

(inters '(.
(2.0 2.0)

4.0)

'(-5.13

2.49)

'(1-38

2.19)

'(-1.0

-1.0)

'(.

'(-2.22

5.61))

3.51861)
'(4.0

.)

.)

nil)

2.6.20. polar
, ,
<>, ,
<>. ,

90

Visual LISP AutoCAD

,
X , <> ( ).
(polar <> <> <>)

: <> , ; <>
, , , X ; <>
.
:
( p o l a r ' ( 1 5 . 6 6 33.2)

(polar
6.812)

'(-2.421

2.32

- 0 . 6 5 9 3.6689) (18.5607 30.9534)


6.812)

1.45

12.53)

(-0.9111

14.7587

2.6.21. textbox
, , TEXT.
(textbox <>)

<>
TEXT ( AutoCAD . . 2.12).
, .
DXF- 1 (. . ).
:

(textbox '((1 . " "))) ((0.0 0.0 0.0)

(33.75

2.5 .)) ( , , , )

2.6.22. vports
( ).
(vports)

. TILEMODE.
TILEMODE 1,
(Model), , (0.0 0.0), (1.0 1.0).

91

2. AutoUSP
, TILEMODE = 1:

((2 (. .) (1.0 1.0))) ;


( ( 2 (0.5 0.0) (1.0 1.0)) ( 3 (0.0 0.5) (0.5 1.0)) ( 4 (0.0 0.0) (0.5
0.5))) ( , ; 2 , . 2.3).
i#AutoCAD 2000 IDiawingll
0 " > Q"

__JU_J__J

DO
:' DD

>_

ft

: < '

'\ I 1 i 2 /

______
______
1 ( 0 , 5 .0,0.! ... _...OJ.) (.3 (, .0.0,5) ( . ...S... 1. ...2J (..1..I0. 0 ...0 0) 0....S... 0. .5.).).)
{

_ _

. 2.3.
, 1
.
TILEMODE 0, ,
.
, vports TILEMODE=0:
((1 (0.0 0.0) (535.487 297.0)) (2 (26.67 20.32) (240.03 1 8 2 . 8 8 ) ) )
( );
((2 (26.67 20.32) (240.03 182.88)) (1 (-72.5709 -12.6111) (339.271

215.811))) ( );
((5 (134.711 10.1631) (259.285 195.756)) (1 (-72.5709 -12.6111)
(339.271 215.811)) (4 (10.1378 10.1631) (134.711 102.96))

92

Visual LISP AutoCAD


(3 (10.1378 102.96) (134.711 195.756) ) ) -

( , ; 5, . 2.4).
\&AutoCAD 2000 - - [Drawing!)
. Express
O

ft)

rf

j ^ J=5

J J B 3 I

; t ^

BS SO

2J I

- |flj xj

< Q* Q < K : ! > ^


'

~\\\

~3

oigg3

J.EJ]

O ; /'.?

'-I P f
W i r ij
Ei'j-Tii
A-i/1

L.

!< i i ' > , ,\ j ! [2 /

-12.6111) (339 271 21S.811)) (4 (10.1378 10.1631) (134 711 102.96)) (3 (10.1378
102 46) (134 711 195 756)))

{ : I

.46 3459.624 2043.00000

-iLJ -if

OPTQ - - ,|

. 2.4.

, 1
.

2.6.23.vl-symbol-value
, .
(vl-symbol-value '<>)

(!) AutoCAD (. . 2.1.2).


:

(vi-symboi-vaiue ")

(vl-symbol-value "pi) 3.14159

(vl-symbol-value 'load) #<SUBR @01dll0cd0 LOAD>

2. AutoLISP

93_

2.6.24. set
,
( setq . . 2.1.2).
(set '<> <>)

( s e t 'newrad 45.5) 4 5.5

(
pw):

(set

'pw 1)

(setq pw 1)

(set (read "pw") 1)

2.7.
,
type, . fix,
,
. 2.6.1.

2.7.1. type
.
(type <>)

: ( ).
<>
, nil. :
ENAME AutoCAD;
EXRXSUBR ObjectARX;
FILE () ;
INT ;
LIST ;
PAGETB ;
PICKSET ;
REAL ;
SAFEARRAY ;
STR ;
SUBR AutoLISP;

Visual LISP AutoCAD


SYM ;
VARIANT ;
USUBR AutoLISP;
vLA- Visual LISP, ActiveX.

.
, Visual LISP, . 2.2.1.
:
(type 15)

(type i+) S U B R

(type "15") S T R

(type '(15 16 17)) L I S T

2.7.2. float
.
(float <>)

: .
<> , . <> , float.
:
(float 15) 15.0

(float -15) -15.0

(float 15.3) 15.3

2.7.3. itoa
.
(itoa <>)

: .
,
<> .
:

(itoa 16) "16"

(itoa -29031) "-29031"

(itoa 0) "0"

2. AutoLISP

95_

2.1 . rtos
.
(rtos <> [<> [<>]])
: <> ; <>
( ); <> .
<> <> ,
LUNITS LUPREC. <>
<> , LUNITS LUPREC. UNITMODE.
<>:

1 - ;

2 ;
3 ( );
4 ( );
5 .
,
<> .
:
D

(rtos, 10.9453 1 3) "1.095+01"

(rtos 10.9453 2 3) ".945"

(rtos .9453 3) '-.945\"" (


, ,
, )

(rtos .9453 4 3) " 0 ' - i i \ " " ( )

(rtos .9453 2 0) "11"

(rtos 2 3) "11"

(rtos . 2 3) "10", DIMZ1N 8 12 ( ); "." DIMZIN


(rtos pi 2 10) "3.1415926536"

( 2).

96

Visual LISP AutoCAD

2.7.5. atoi
.
(atoi <>)
: .
, <> .
:
(atoi "14") 14

(atoi "-29031") -29031


(atoi "1234324674568458") 2147483647 (
,
;
atof, )
(atoi "-290.821") -290 ( )

2.7.6. atof
.
(atof <>)
: .
, <> .
:
(atof "14") 14.0

(atof "-29.031") -29.031


D

(atof "1234324674568458") 1.23432+015

2.7.7. angtof
, , , . angtof angtos.
(angtof <> [<>])
: <> , <> .
<>
AUNITS. <> , AUNITS.

2. AutoLISP

97_

<>:
1 ;
2 , , ;
3 ;

4 - ;

5- .

,
<> (,
). <> ,
nil.
:

(angtof "30" 0) . 523599 ( )


(angtof "334.365g" 2) 5.25219

(angtof "33d27'54\"" 1) 0.584074


(angtof "_N 89d54'31\" __W" 4) 3.14

2.7.8. angtos
, ( angtos angtof).
(angtos <> [<> [<>]])
: <> ;
<> <> .
<> AUNITS,
<>
AUPREC. <>" <> ,
AUNITS AUPREC.
<>,
. UN1TMODE.
ANGBASE.
:
(angtos l.oo 0) "57.296"
(angtos 1 0) "57.296"
D

(angtos 3.14000 0) "179.909"

(angtos 3.14000 1) "17 9d54'31\""

(angtos 3.14000 2) "199.899"


4

. 155

98

'

Visual LISP AutoCAD

(angtos 3.14000 3) "3.140r"


(angtos 3.14000 4) 89d54'3i\" "
AutoCAD ( "N 89d54'3i\" w" )

2.7.9. distof
,
, . distof rtos.
(distof <> [<>])
: <> , ;
<> , LUNITS (. . 2.7.4). <> ,
LUNITS.
: . <> , nil.
:
D

(distof "i" 2) l.

(distof "1.0945E+01" 1) . 945

(distof "'-1.945\"" 3) 10. 945

2.7.10. trans
() .
(trans <> <-> <-> [<>])
: <> ( , ); <-> ,
<> (. . , ),
AutoCAD; <-> ,
, AutoCAD. <>, nil (, ),
<>:
, .
<-> <-> :
( ,
ssname, entsel, nentsel, entnext, entlast);

2. AutoLISP

99_

( );
0 3 ( ).
:
0 ()
1 ()
2 ()
3 ()

<-> <-> ( , <-> <-> ).
0 1 <-> <-> . , <-> = 0, <-> ( 0 3), , ; <-> = 0, <->
( 0 3), , .
2 ,
. 0 1,
( 2) .
3, ( 2)
.
3 () 2
(. ).
<-> ,
, (, , , . .), ()
. (,
entmake)
<->.

(, )
.

,
<-> <~> (,
). ,
.

100

Visual LISP AutoCAD

trans ( ) . <->
<-> , n i l (,
trans , 3, , ).
, <>
. AutoCAD
, Z .
<> nil (. .
<> , ), Z 0.
nil, Z <-> . 2.1.
2.1. trans 2
-

0.0

( ELEVATION)

0.0

(. .
)

(. .
)

. , , ,
=10, Y=10, Z=10. :

(trans

' ( i l l )

o i ) (-9.0 - . -9.0)

(trans

' ( i l l )

1 ) ( l . o l . o 1.0)

2.7'.11. unit
.
(cvunit <> <-> <->)

: <> ; <->
, <>; <-> , <>.
( ), <>. , nil.

2. AutoLISP

1_01_

, <-> <->,
acad.unt (. 3).
:
(cvunit I "minute" "second") 60.0
(cvunit 1 "" "") 60.
(cvunit 1 "" "") 60.0
'D (cvunit I'"minute" "hour") 0.016667
(cvunit '(1.0 2.0) "" "") (2.54 5.08)

2.8.
, ( ).
ending strcaser.

2.8.1. chr
- (
) .
(chr <>)

: 1 255. , chr .
: .
:

(chr 192) "" ( )

(chr 224) "" ( )

(chr 32) " " ()

(chr 48) "0"

"

() 192223, ()
224255.

2.8.2. ascii
.
(ascii <>)

102

Visual LISP AutoCAD

: .
: .
:

(ascii "") 192 ( )

(ascii "") 65 ( )

(ascii "ABCDEFGH") 65 ( - , , )

(ascii "")

(ascii "\"") 34 ( )

2.8.3. read
, , ( ,
) AutoLISP
(.. . ).
(read <>)
,
. - ,
-
. - , -
.
- ,
- , .
- , nil.
: .
: , ,
.
:

(read "") ( . 2.6.24)

(read "

(read " D E F")

")

(read "23.55") 23. 55

(read "10 ") 10

(read " ") nil

(read "(li 13 15 17)) (11 13 15 17)


D

(read "\"\" \"\"") ""

2. AutoLISP

1_03_

2.8.4. strcase
.
(strcase <> [<>])
<> , . <> nil, strcase
-
. <> nil,
.
, (, , ) .

s t r c a s e AutoCAD
( , ), . "" . . . 2.8.10.
:

(strcase "AbcdE FGh-38") "ABCDE FGH-38"

(strcase "AbcdE FGh-38" nil) "ABCDE FGH-38"

(strcase "AbcdE FGh-38" T) "abcde fgh-38"


(strcase "AbcdE FGh-38" 79) "abcde fgh-38" (
<> 7 9, nil,
)

2.8.5. strcat
() .
(strcat [<1> [<2> ... [<>] ... ]])
: .
, ("").
:
(strcat "Happy N" "ew " "Year") "Happy New Year"
(strcat (itoa 12) "- ") "12- "
(strcat "") ""

(strcat) ""

104

Visual LISP AutoCAD

2.8.6. strlen
- (
' ).
(strlen [<1> [<2> ... [<>] ... ]])
.
, .
:
(strlen "Happy N" "ew " "Year") 14
(strlen (itoa 12) "- ")
(strlen "") 9
(strlen)

2.8.7. substr
, .
(substr <> <> [<>])
: <> , ;
<> - ,
; <> ,
. <> ( 1); 1 <>.
<> ; <> , ,
<>, <>
.
- , substr "".
:
(substr "Happy New Year" 7 3) "New"
D

(substr "Happy New Year" 7) "New Year"

(substr "Happy New Year" 7 23) "New Year"

(substr "Happy" 7 ) ""

(substr "Happy" 0) ""

( ). .

105

2. AutoLISP

2.8.8. wcmatch
().
(wcmatch <> <>)

: <> , ;
<> (), . <> - , (wild-cardcharacters), . 2.2. <>
, <>
; .
2.2. ,

. ()

, ,
, ; <>

, <>,
", <>"
,
,

, ()

" (
)

, . \
, ,
. 2.2.1.
: <> , n i l
.

106

Visual LISP AutoCAD

(wcmatch "Happy New Year" "*") , . .


(wcmatch "Happy New Year" "h*") n i l (


h )

(wcmatch "Happy New Year" "??ppy*, *New*, * * *") , . .



(wcmatch "Happy New Year" "*#*") nil, . .

(wcmatch "Happy New Year" "H[adgt]*")

(wcmatch "Happy***day" "Happy4*"*4**")

(wcmatch "Year 2000" "@ea@ [1-6J000")

2.8.9.vl-string->list
- .
(vl-string->list <>)
: .
nil, <> .
:

( v l - s t r i n g - > l i s t "AutoCAD'1) ' (65 117 116 111 67 65 68)


( v l - s t r i n g - > l i s t "") ' (192 226 242 238 234 224 228)
(vi-string->iist "") nil

2.8.10.vl-list->string
- .
(vl-list~>string <>)
: (
256).
, -
, <>. ("")
:
( v l - l i s t - > s t r i n g '(210 224 240 224 241 32 193 243 235 252 225 224))
" "

( v i - i i s t - > s t r i n g n i l ) ""

2.

7_

2.8.11. vl-string-elt
- ,
( 0).
(vl-string-elt <> <>)
: <> , <> .
( -
).
:

( v l - s t r i n g - e l t "" 5) 237 ( "")

( v l - s t r i n g - e l t "" 0) 210 ( "")

2.8.12.vl-string-left-trim
.
(vl-string-left-trim <> <>)
: .
<>,
, <>.
- , , , ,
.
:

(vl-string-left-trim "" "") ""

(vl-string-left-trim " " " ") ""

2.8.13.vl-string-right-trim
.
(vl-string-right-trim <> <>)
: .
<>,
, <>.
- , , , ,
.

108

Visual LISP AutoCAD

:
0

(vl-string-right-trim "" "") ""

(vl-string-right-trim " year" "commentary

") "comment"

2.8.14. vl-string-trim
.
(vl-string-trim <> <>)
: .
<>,
, <>.
vl-string-left-trim vl-stringright-trim.
:

( v l - s t r i n g - t r i m "" "") ""

(vl-string-trim " " "

comment

") "comment"

2.8.15. vl-string-mismatch
, ,
- .
(vl-string-mismatch <1> <2> [<1> [<2>
[<>]]])
." <1> <2> , <1> <2>
( ; 0); <> ( n i l
nil). <1> <2> 0, <> .
:

(vl-string-mismatch "" "") 1

(vl-string-mismatch "" "" 7 6) 3

(vl-string-mismatch "Merry Christmas" "MER" 0 0 T) 3

2.8.16. vl-string-position
- ,
( ).
(vl-string-position <> <> [<> [<>]])

2. AutoLISP

: <> ( ), - ; <> ;
<> , ( 0); <> -
( nil, ).
,
<> . , nil.
:

(vl-string-position 49 "1111" 0)

(vl-string-position 4 9 "1111" 1) 1

(vi-string-position 49 " n i l " 1 )

(vl-string-position 48 "1111") n i l

(vl-string-position (ascii "t") "Autodesk") 2

2.8.17. vl-string-search
- ()
, .
(vl-string-search <> <> [<>])

: <> <> ; <> , <> ( 0).


0.
, <> <>.
<> , nil.
:

(vl-string-search "ain" "Training") 2


(vl-string-search "ain" "Training" 4) n i l

2.8.18. vl-string-subst
-
, .
(vl-string-subst <> <> <> [<>])

: <>, <> <> ; <>


<>,

110

Visual LISP AutoCAD

( 0).
0.
, <>. <> <>
, .
:

(vl-string-subst "" "" "") ""

(vl-string-subst "12" "a" "a para" 0) "12 para"

(vl-string-subst "12" "a" "a para" 2) " 12"

(vl-string-subst "12" "a" "a para" 5) " 12"

(vl-string-subst "12" "b" "a para" 0) "a para"

2.8.19. vhstring-translate
.
(vl-string-translate <rpynnal> <2> <>)

: .
(
<1> <>).
<1>
<2>. ,
(, - , ).
:
0

(vl-string-translate "12" "ab" "year 1921") "year a9ba"

(vl-string-translate "abc" "w" "abca") "wcbw"

2.8.20. vl-symbol-name
.
(vl-symbol-name '<>)

AutoLISP.
.
:
D

(vl-symbol-name ' p i ) " p i "

(vl-symbol-name 'cadr) "cadr"

2. AutoLISP

1JJ_

2.8.21. ( ending)
6 ending,
(, , )
. , ,
" N "
N. N = 1, : " 1 "; N = 2 " 2
"; N = 5 " 5 " . . ( ).
.
(ending <> <1> <2> <>)
, , .
: <> , ;
<1> -, , <> = 1-,
21, 31, ...; <2> -, ,
<> = 2, , 4, 22, 23, 24, ...; <> -,
, <> = , 5, , 7, 8, 9, 11, 12, ... .
(ending n "" "" "") "" = 1, "" = 2,
"" = 5, "".
(ending n "" "" "") "" =1, ""
=2, "" =5, "".
(ending n "" "" "") "" =1,
"" =2, "" =5,
"".
(strcat "" (ending n "" "" "") " " (itoa n)

" " (ending n "" "" "") " " (ending n "" "" "") )

" N "
.

2.8.22. ( strcaser)
8 strcaser, strcase ( AutoCAD
, strcase
).
:
(strcaser <> <>)
.

112

Visual LISP AutoCAD

<> , . <> nil, strcaser


- . <> nil,
. strcase, strcaser <>
.
:
D

(strcaser " " nil) " "

(strcaser " " ) " "

2.9.

, .
( . ), .
DXF-, . cons. (. . 2.12).
.

2.9.1. list
l i s t , . :
(list [<1> [<2> ... [<>] ... ]])

.
, , , AutoLISP.
, .

.
:

( l i s t 1 2 . 1 2 0 . 3 4 5 . 8 8 ) ( 1 2 . 1 2 0 . 3 4 5 . 8 8 )

( l i s t l . i n i l ) ( i . i n i l )

( l i s t i " a d 2 " ( l i s t 0 1 2 ) ) (i " a d 2 " ( 0 1 2 ) ) ( 0, 1 2)

2. AutoLISP

1J3_

( l i s t l 'to . "LINE")) (l (0 . "LINE")) (


( . "LINE"))

2.9.2. append
.
(append

[<!>

[<2>

...

[<crracoKN>]

...

]])

. ( ). ,
, , .
,
append. , nil.
:
D

(append ' (17 200 -6) ' (-10 8 1)) (17 200 -6 -10 8 1)

(append ' (17 200 -6) ' (nil T nil)) (17 200 -6 nil T nil)

(append '(17 200 -)) (17 200 -6)

(append) n i l
(append n i l (!)) (i) ( n i l , . . ' )
( a p p e n d . 1 (17

200

-6)

'((62

11)))

(17

200

-6

(62

11))

( ,
(62 . ))

2.9.3. nth
(
).
(nth <> <>)
: <> , <> .
.
, nil.
:
(nth ' (11 12 13 14))
(nth 1 ' (11 12 13 14)) 12

Visual LISP AutoCAD

/14

(nth 2

'(li

12

13

14)) 13

(nth 3

'(li

12

13

14)) 14

(nth

'(li

12

13

14)) n i l

2.9.4. reverse
( , ).
(reverse <>)
: <> ( )
n i l .

nil.
:
(reverse '(11 12 13 14)) (14 13 12 11)
(reverse nil) nil

(reverse

' ( ) ) n i l

2.9.5. car
DXF- .
( <>)

, nil.
, ;
, DXF- (
). nil ( ), nil.
:

( ' ( 1 1 12 13 14)) 11

(car

( ' ( ) ) n i l

'(0

" L I N E " ) )

2.9.6. cdr
.
(cdr <>)

, nil.
, ,
; , -

2. AutoLlSP

U5_

( ). n i l ( ), nil.
:
(cdr '(11 12 13 14)) (12 13 14)

(cdr

'(0

"LINE"))

" L I N E "

(cdr '()) nil

2.9.7. caar, cadrv\


cdr
, AutoLlSP (
):
( <>) ( ( <>));
(cadr <>) (car (cdr <>));
(cdar <>) (cdr (car <>) )',
(cddr <>) (cdr (cdr <>) ) ;
(caaar <>) (car (car (car <>) ) ;
(caadr <>) (car (car (cdr <>) ) ) ;
(cadar <>) (car (cdr (car <>) ) );
(caddr <>) (car (cdr (cdr <>) )
(cdaar <>) (cdr (car (car <>) ) );
(cdadr <>) (cdr (car (cdr <>) )
(cddar <>) (cdr (cdr (car <>) )
(cdddr <>) (cdr (cdr (cdr <>) ) ).
(caaaar <>) (car (car (car (car <>) ) ) ) ;
(caaadr <>) (car (car (car (cdr <>) ) ) ) .
(caaaar, caaddr,
cadaar, cadadr, caddar, cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cdddar,
cddadr, cddddr).
:

(cadr ' ( i l 12 13 14)) 12

(cddr ' ( i l 12 13 14)) (13 14)

(cdddr ' ( 1 1 12 13 14)) (14)

(cadddr ' ( i l 12 13 14)) 14

Visual LISP AutoCAD

/16

' ( i i 12 13 14)) n i l

"

(cddddr

( c a d r ' ( ( i i 12 13 1 4 ) ) ) n i l

( c a a r ' ( ( i i 1 2 1 3 1 4 ) ) ) i i

(cadr '((11 12 13 14) (21 22 23 24))) (21 22 23 24)


(cddr '((11 12 13 14) (21 22 23 24))) nil
(cdadr '((11 12 13 14) (21 22 23 24))) (22 23 24)
0

(cadadr '((11 12 13 14) (21 22 23 24))) 22

(cddadr '((11 12 13 14) (21 22 23 24))) (23 24)

2.9.8. cons
.
(cons <1> <2>)
<2> , cons
<1> .
<2> (. . ), cons (<1> . <2>). cons ,
AutoCAD (. . 2.12).
:
D

(cons 67.4 '(10.3 -3.9)) (67.4 . -3.9)


(cons "Happy" '("New" "Year")) ("Happy" "New" "Year")

(cons 2 4) (2 . 4)

(cons 8 "0") (8 . "0")

(cons 62 i) (62 . i)

(cons 262 n i l ) (262) (nil , . . )

2.9.9. vl-list*
, ,
, .
(vl-list* <1> [<2> ... [<>]...])
.
, .

2. AutoUSP

117

, <2> (. . ), . , <2> ,
, <1>,
cdr
<2> (. . v i - i i s t * cons).
, <> , (. ), . , <> , , ,
, cdr <o6beKTN>.
:

(vi-iist* 77) 77

(vl-list* 77 55) (77 . 55)

( v l - l i s t * 77

' ( 5 5 ) ) (77 55)

( v l - l i s t * 77

' ( 5 5 0 ) ) (77

(vl-list*

( v l - l i s t * 12 94 77

55 0)

42 77 55) (42 77

55) ( )

' ( 5 5 0 ) ) (12 94 77 55 0)

2.9.10. member
.
(member <> <>)
: > , <> .
member > <>, , ; <>
<> , nil.
:
(member 1 ' (4 50 1 2)) (12)

(member 4 ' (4 50 1 2) ) (4 50 1 2)

(member 0 ' (4 50 1 2) ) nil

(member 80 nil) nil

Visual LISP AutoCAD

/18

2.9.11. assoc
assoc , , ( ) , .
(assoc <> <>)

<> ,
,
. assoc ,
AutoCAD , DXF- (,
, . .).
, <> <>.
:
D

( a s s o c 8 ' ( ( 8 . "Walls")
(8 . " W a l l s " )

(assoc 7 ' ( ( 8 "Walls") (6 . "ACAD_ISO05WIOO") )) n i l

(assoc

(assoc 10 ' ( ( 1 0 17.2


(10 1 7 . 2 1 3 . 5 2 . 0 9 )

62

'((62

. 4 )

(6

(6 . "ACAD_ISO05W100") ) )

13.5

"ACAD_ISO05W100") ) ) (62
2.09)

(10

612.0

45.9

23.3)))

4)

2.9.12. apply
, , ,
<>.
(apply '<> <>)

(apply * ( l i s t 2 3 5)) (* 2 5),


(apply 'max ( l i s t 2 3 5)) 5

, apply , ,
. ,
apply
.
.

2. AutoLISP

119

2.9.13.
, <>,
, (<1>, ..., <cnMcoKN>), ..; ,
.
(

'<> <1>

[<2>

. . .

[<]\1>]

...

] )

( * ' ( 2 3) ' ( 1 5 ) ) (2 15), . . (* 2 1), (* 5)

( '- ' ( 2 3) ' ( 1 5)) (1 -2), . . (- 2 i ) , (- 5;

2.9.14. vl-every
, - ( , . .).
(vl-every '<-> <1> [<2> ... [<>]...])
: <-> (-), , - vl-every,
n i l ; <1>, ..., <> , - , . . -.
(, . .)
- , vi-every .
vl-every n i l .
:

(vl-every = ' ( 5 6) ' ( 5 . 0 . 7.0)) (


,
, )

(vi-every '< '(2 l) ' ( 5 ) ' ( 5 . 0 6.5)) n i l (


< n i l )

(vi-every '< n i l ' ( 5 6) ' (5.0 6.5)) ( n i l


, 0
)

- lambda
function (. . 2.16).

120

Visual LISP AutoCAD

2.9.15. foreach
foreach ( ),
( <>) .
(foreach <> <> [<1> [<2>... [<>]...]])

.
<1>, ..., <> , foreach
n i l .

:
D
(setq si 0 s2 1)
(foreach p ' (1 2 3 4 5) (setq si (+ si p) ) (setq s2 (* s2 p) ) ) BO3 120 ( s2 );
, si

2.9.16. eval
eval
(evaluate) .
.
(eval <>)

:
(setq mylist (list 'max 1.7 9.34 6.7))
( e v a l m y l i s t ) 9 . 3 4 ( (max 1 . 7 9 . 3 4 6 . 7 ) )

2.9.17. quote
quote eval , . . . quote .
(quote <>)
:

( q u o t e 6 7 8 2 1) ( 6 7 8 2 1 )

' (16 23 90) (16 23 90)

.
. function (. 2.16).

2. AutoUSP

121

2.9.18. acad_strlsort
, .
(acad_strlsort <>)
:
(acad_strisort ' ("" "" "" "" "" "" ""))
("" "" "" "" "" "" "")

(acad_strlsort '("" "" ""))


("" "" "")

2.9.19. last
last ,
<>, nil, .
(last <>)

'

(last '()) nil

(last ' (16 23 90)) 90

2.9.20. subst
.
(subst <> <> <>)
: <> <> AutoLISP; <>
, , <> <>.
, , .
:

( s u b s t 6 5 ' (11 5 7 0 ) ) ( 7 0)

( s u b s t 5 11 ' ( 1 1 5 1 0 ) ) (5 5 7 0)

2.9.21. length
( ) .
(length <>)
( nil).
( vi-iist-iength).
.

122

Visual LISP AutoCAD

:
D

(length )

(length nil)
0

(length '(15 23 1 7 9) ) 5

2.9.22. vHist-length
( ) .
' vi-list-length <>)
, (.
v i - i i s t * . 2.9.9), nil.
: ,
m i , nil.
:

(vi-iist-iength '())

(vi-iist-iength nil)

{vi-iist-iength

'(20

40))

(vl-list-length

'(20

(vl-list-length

' ( 2 0 40

5)) n i l
.

5)) n i l

2.9.23. vl-member-if
- .
(vl-member-if '<-> <>)
: <-> , ; <> .
: <>, ,
- & , nil. <> - nil,
vi-member-if nil.
:
D

(vl-member-if ' zerop '(1.2 0.0 0.0 3.6 0.0)) (0.0 0.0 3.6
0.0)

(vl-member-if 'numberp '(T "000.000")) nil


- lambda
function (. . 2.16).

2. AutoLISP

123_

2.9.24. vl-member-if-not
, -,
, .
(vl-member-if-not '<-> <>)

: <-> , ; <> .
: <>, ,
- , nil.
<> - nil, vi-member-if-not nil.
:

(vl-member-if-not

' zerop

(vl-member-if-not

'numberp

'(0.0
' (T

0.0

3.6

0.0))

" 0 0 0 . 0 0 0 " ) ) (

(3.6

0.0)

"000.000")

- lambda
function (. . 2.16).

2.9.25. vl-position
.
(vl-position <> <>)

: <> , ; <> ,
, ( 0).
> <> , nil.
:

(vl-position

(vl-position 5

" ( 0 3 6 4 7 8 ) )
' (0 3 6 4 7 8 ) ) n i l

2.9.26. vhremove
.
(vl-remove <> <>)

: > , ; <> , <>.


<>, > , <>.

124

Visual LISP AutoCAD

(vl-remove

(vl-remove 5

' ( 0 3 6 4 4 8 ) )

'(0 3

6 4

( 0 3 6 8 )

8)) ( 0 3 6 4 7 8 ) -

2.9.27. vl-remove-if
, -.
(vl-remove-if '<-> <>)
: <-> , ; <> ,
.
<>, , <>.
:
(vl-remove-if 'minusp '(-50 3 -6 -4 4 8)) (3 4 8)
(vl-remove-if 'listp '(0 nil 6 4 (7 8))) (0 6 4)
- lambda
function (. . 2.16).

2.9.28. vl-remove-if-not
, nil .
(vl-remove-if-not '<-> <>)
: <-> , ; <> ,
.
<>, , <>.
:
0

(vl-remove-if-not 'minusp '(-50 3 -6 -4 4 8)) (-50 -6 -4)


(vl-remove-if-not 'listp '(0 nil 6 4 (7 8))) (nil (7 8))

(vl-remove-if-not 'listp '(0 () 6 4 (7 8))) (nil (7 8))


- lambda
function (. . 2.16).

2. AutoLISP

125_

2.9.29. vl-some

- .
(vl-some '<-> <1> [<2> . . . [<1>]...])
: <-> , ( , . .) ; <1>, ... <> .
, -
( ). n i l .
:

(vl-some ' = ' ( 2 4 6)

'(0 3 6)

' ( 9 5 6 ) )

(vl-some v = ' ( 2 4 6)

(vl-some '> ' (2 4 6) ' ( 0 3 6) ' ( 9 5 6 ) ) n i l

'(0 3 6)

' ( 9 5 6 ) )

-
function (. . 2.16).

lambda

2.9.30. vl-sort
, -
. .
(vl-sort <> '<->)
: <> , ; <> , .
, <>, <->.
:

(vi-sort ' ( 0 4 2 1 )

>) ( 4 2 1 0 )

(vl-sort ' ( 0 4 0 2 2 1 )

'<) ( 0 1 2 4 )

-
function (. . 2.16). ,

lambda

(vl-sort '((2.2 2.0) (4.1 3.6) (1.5 2.4)) (function (lambda (el e2)
(> (car el) (car e2)))))
( ( 4 . 1 .)- (2.2 2.0) (1.5 2.4)) ,
.

126

Visual LISP AutoCAD

2.9.31. vl-sort-i
, - .
( vi-sort).
(vl-sqrt-i <> '<->)

: <> ( ), ; <-> , . 0.
,
, <>.

(vi-sort-i

' ( 0 4 2 1 )

(vl-sort-i

' ( 0 4 0 2 2 1 )

>) 2 0 )
'<) ( 2 0 5 4 3 1 )


lambda function (. . 2.16). ,
(vl-sort-i '((2.2 2.0) (4.1 3.6) (1.5 2.4)) (function (lambda (el e2)
(> (car el) (car e2) ) ) ) )
(i 2).

2.9.32. vl-catch-all-apply
( apply, ).
(vl-catch-all-apply '<> <>)

: <> , ; <> , <>.


<> <>. <> ,
(. vl-catch-all-apply-error-message).
:

( v l - c a t c h - a l l - a p p l y '* ' (6 -2 3) ) -36


(vl-catch-all-apply ' s q r t

'(-2)) #<%catch-all-apply-error%>,

VL-CATCH-ALL-APPLY-ERROR;

2. AutoUSP

127

vi-catch-aiierror-message

2.9.33. vl-catch-all-error-message
, ,
vi-catch-aii-appiy.
(vl-catch-all-error-message <>)
VL-CATCH-ALL-APPLY-ERROR,
vl-catch-all-apply.
.
( ):

(setq em (vl-catch-all-apply
apply-error%>

' ( - 2 ) ) ) #<%catch-all-

'sqrt

(vl-catch-all-error-message em) "


: -2" ( : "function
undefined for argument: -2")

2.9.34. vl-catch-all-error-p
, , vi-catch-aiiappiy, VL-CATCH-ALL-APPLY-ERROR.
(vl-catch-all-error-p <>)
.
: , <>
VL-CATCH-ALL-APPLY-ERROR; nil, <> .
( . 2.9.32):

(setq em (vl-catch-all-apply
apply-error%>

'sqrt

' ( - 2 ) ) ) #<%catch-all-

( v l - c a t c h - a l l - e r r o r - p em)
: (type em) VL-CATCH-ALL-APPLY-ERROR

2.10.

, .
( , . .).

128

Visual LISP AutoCAD

2.10.1. initget
.
(initget [<>] [<>])

initget
getint, getreal, getdist, getangle, getorient, getpoint, getcorner,

getkword ( . 2. /^ entsel, nentsel


nentseip), .
, initget <Enter> (,
), .
initget getint, getreal . . ,
.
<> initget ,
( 0 255), (
2). . 2.3. , .
2.3. initget

(
<Enter>)

,
LIMCHECK

16

32

AutoCAD
;
POPUPS , AutoCAD

64

g e t d i s t

128

;
; , 1

(initget 1)

(initget 3) (3 = 1+2)

2. AutoLISP

129_

(initget 7) , (7 = 1+2+4)

(initget 6) ,
(6 = 2+4)

<> initget ,
, , . <> , : " ".

, <>
, : "".
: "", "",
"", " " , " " , "", "" (

,
; ); "", "", "", "".
, , :
(initget "")

"", "", "" "",


"", "".

<>
, : "," "".
(. . )
AutoCAD <>
, .
, ,
.

. : " _ S t r a i g h t

curved".
("Straight" "Curved").
initget nil. (
) , initget
.
(, getreal) , , .
initget
, . 2.4 (
).
5 155

130

Visual LISP AutoCAD


2.4. ini tget

32

getint

getreal

getdist

getangle

getorient

getpoint

getcorner

getkword

64

128

entsel, nentsel nentselp He i n i t g e t


.
getstring ,
initget.

2.10.2. getkword
.
(getkword [<>])
.
( nil)
,
i n i t g e t .
2.9 initget
getkword.
i 2.9. getkword

( i n i t g e t 1 " ")
(setq reply (getkword " ? [/]: "))
getkword " ?
[/]: " . AutoLISP reply

2. AutoLISP

131

"" "". , , .
(, ,
).

2.10.3. getint
( 32 768
+32 767) .
(getint [<>])

.
, nil.
, initget.
2.10 2.11 initget getint.
I 2.10. 1 g e t i n t

(initget 6)
(setq numb (getint " (<1>): "))

( ).
. g e t i n t "

(<1>): ". nil,


<Enter>, (, ) . (, -2) getint
.
, 2.10, , numb (l):
(if (not numb)

(setq numb 1))

2.11. 2 g e t i n t
( i n i t g e t 6 " ")
(setq numb (getint " (<1>)
[///]: "))

132

Visual LISP AutoCAD

( ),
.
numb nil,
("", "", "", "").

2.10.4. getreal

.
(getreal [<>])

.
, nil.
, initget.

2.10.5. getdist
( ) (
)
( ), <1>.
<1>, ( ) ,
,
<1>.
(getdist [<1>] [<>])

: <1> (
),
.
(
), nil.
,
initget.

2.10.6. getangle
( )
( )
( ), <1>.
<1> ,
( ) ,

2. AutoLISP

133_

, <1>;

ANGBASE ANGDIR; ANGBASE ANGDIR.
(getangle [<1>]

[] )

: <1> (
),
.
, nil.
, initget.

2.10.7. getorient
getangle,
ANGBASE ANGDIR (. .
ANGBASE=0, ANGD1R=O).
(getorient [<1>] [<>])

: <1> (
),
.
, nil.
, initget.

2.10.8. getpoint

. <1>,
, ,
<1>.
(getpoint [<1>] [<>])

: <1> (
), .
(
), nil. , initget.

134

Visual LISP AutoCAD

2.10.9. getcorner

. , , <1> (
).
(getcorner <1> [<>])

: <1> (
),
.
(
), nil. , initget.

2.10.10. getstring
.
<> nil, , ,
(
<Enter>). <> nil, <Enter>.
(getstring

[<>]

[<>])

: <> (
nil), .
(
, . . "")
getstring
initget.

2.10.11. getvar
, <>.
(getvar <>)

: ( ) AutoCAD.
( ,
nil).

2. AutoLISP

135

(getvar "ciAYER") CLAYER


( )

(getvar "PDMODE") PDMODE


( )

(getvar "CURSORSIZE")
CURSORS1ZE ( )

2.10.12. setvar
, <>. , " "
("read only").
(setvar <> <>)

: <> ( ) AutoCAD, <> , ( ).


.
.
:

(setvar "CECOLOR" "3") "3" CECOLOR ( )

(setvar "CECOLOR" 3) : ; :
AutoCAD :
setting rejected: "CECOLOR" 3)

"CECOLOR" 3 (; error. AutoCAD variable

2.10.13. getenv
, <>.
(getenv <>)

: ( ) (, , autoexec.bat).
( , nil).

136

Visual LISP AutoCAD

:
n

(getenv "TEMP") TEMP (, "C:\\WINDOWS\\TEMP")

2.10.14. setenv
, <>.
(setenv <> <>)

: .
<>.
:
0

( s e t e n v "MYJENWAR" "SPACE") "SPACE"

, "" ( getvar nil).

2.10.15. getcfg
AppData acad.cfg.
(getcfg <>)

, <> "AppData/HM#_
/_/ ... /_".
.

2.10.16. setcfg
AppData acad.cfg.
{setcfg <> <>)

<> "!/_/_
/ ... /_" ( 496 ).
<> nil (
).

2.10.17. getcname
AutoCAD.
(getcname <>)

137

2. AutoLISP

: .
nil.
".
(getcname "_JLINE") ""
(getcname "") "_LINE"

2.10.18. getfiled
.
(getfiled <> <> <> <>)
<> ; <> , ; <>
(<>, "", " * " ) ; <>
(. ).
: ( , ).
( , ) nil.
:
(getfiled " " ":\\Ritm\\GenhullW911"
"dat" 16) , . 2.5.

|
: | J 9 1 1
\ Genh_OO dat
J*\ Genh_01.dat
i^] Get*_08,dat

3 M \

:
: ".dat

2]
1

[
...

. 2 . 5 .
,
g e t f i l e d

getfiled,
(<>), ,

138

Visual LISP AutoCAD

, . , <>, ,
2, . . 2.5.
2.5. get filed

(
)

( )

1 , AutoCAD ,
<>, , ,
g e t f i l e d ; ( )

16

<> , ;
(File name) (. 2.5); , <>

32

1,

64

, URL-

128

URL-

2.10.19. acad_colordlg
, .
(acad colordlg <> [<>])

<> ,
. <> nil,
(BYLAYER)
(BYBLOCK).
: <> 0256 (0 (BYBLOCK), 256 - (BYLAYER)),
<> .
( , ). (Cancel), n i l .

139

2. AutoLISP

:
(acad_coiordig 4) (Select Color),
. 2.6.
\

2 -

. 2.6.

. 2.6 "",
4.

2.11. ,

,
(, ),
, .
vi-prini-to-string
vl-princ-to-string.

. 2.11.27 13.

2.11.1. findfile
( ).
(findfile <>)

,
AutoCAD
(. AutoCAD . 1.3). -

140

Visual LISP AutoCAD

, , nil
. .
:
0

(findfile "acad.hlp") "d:\\AutoCAD2000\\Help\\acad.hlp"


(findfile "acad.mnu") "d:\\AutoCAD2000\\Support\\acad.hlp"

, findfile
, .
.

2.11.2. open
.
(open <> <>)

: <> ; <> , , ("w"


"W" , "" "" , "" "R" ). AutoLISP .
<> "w",
"w, "" "", . ( ),
.
( )
nil ( ).
:
D

(setq

fo

(open

"Norms.txt"

"w"))

#<file

"Norms.txt">

( )
,
- .

2.11.3. close
.
(close <>)

<> , open .
close nil, ,
.
( . 2.11.2):

(close fo) nil

2. AutoUSP

U1_

2.11.4. read-line
.
(read-line

[<>])

<> , ( <Enter>).
,
.
(. .
, ). open
.
read-line . . 2.11.27.

2.11.5. write-line
, <>, ,
<>. <>
nil, AutoCAD . , <>, ( ) .
(write-line <> [<>])

<>.
:

(write-line " " fo) " "

2.11.6. princ
<>, AutoLISP ( , , ,
. .), .
(princ [<> [<>]])

<> nil, <>


. <> ,
( ) .
<>. ,
, . . , nil.

142

Visual LISP AutoCAD

:
D

(princ '(12.0 9.4) fo) (12.0 9.4)

(prin-c " " fo) " "

(princ)

2.11.7. prinl
princ. <> ,
( )
; ( , ,
. .) .
(prinl [<> [<>]])

<>.
, prinl .
:

(prinl '(12.0 9.4) fo) (12.0 9.4)


(prinl " " fo) " "

(prinl)

2.11.8. print
prinl, <> , .
(print [<> [<>]])

<>.
, .
:
n

(print '(12.0 9.4) fo) (12.0 9.4)

(print " " fo) " "

(print)

2.11.9. read-char
. , .
(read-char [<>])

2. AutoLISP

(
ascii). <Enter>
10.
. . 2.11.27.

2.11.10. write-char
- .
(write-char <> [<>])

<> , .
( ). 0.
:

(write-char 50) 50 ( 2, . . - "2" 50,


; , 250,
50)

(setq wcod (write-char 50)) 50 ( wcod, 50)

2.11.11. prompt
(
AutoCAD , ). , princ.
(prompt <>)

.
nil.
:

(prompt " ") nil

2.11.12. alert

AutoCAD.
(alert <>)

.
nil.

144

Visual LISP AutoCAD

<> ( , ) . AutoCAD .
(\).
:
(setq lines (strcat " : , ,\"
" ;\ ;\"
" ."))
(alert lines)

, . 2.7.

: ; ,'
;
;
.

[.

^|

. 2 . 7 . ,
a l e r t

, . ,
. 2.7, .

2.11.13. terpri
( ).
(terpri)

nil.
(princ "\n"),
.

2.11.14. vl-directory-files
, .
(vl-directory-files [<> <> <>])

: <> ( (),
); <> (DOS- ); <>
( ).

2. AutoLISP

1_45_

<> "" n i l , AutoCAD (. . 1.4).


<> nil,
"*.*".
<> :
-1 ;
, ;
1 .
<> .

nil, .
:

(vl-directory-files
"d:\\AutoCAD2000"
( " a c a d . t l b " "acad.xmx" " a c a d . e x e " )

"acad.*"

1)

( v l - d i r e c t o r y - f i l e s ) ( " . " " . . " "TUTORIAL"


" a c u i l 5 . d l l " " a c o p m . a r x " "AcDim.arx" "AcRefEd.arx" . . . ) ( -

2.11.15. vl-file-
- .
, , .
(vl-file-copy <> <> [<>])

: <> ( -, . . , ); <>
( , . . , );
<> ,
, ( <> nil, ;
).
. nil. , , :
- ( -
);
, ;
-;

146

Visual LISP AutoCAD

D (, );
- .
:
D

(vi-fiie-copy

"acad.isp"

"acadl.lsp")

n i l (-

(vl-file-copy "acad2000.cfg" "acad2000dup.cfg") 483

2.11.16. vl-file-delete
.
(vl-file-delete <>)

.
, ; nil,
.
( ):

(vl-file-delete "acad2000dup.cfg")

. , 13.

2.11.17. vMile-directory-p
, , , .
(vl-file-directory-p <>)

.
, , nil
.
<> ,
AutoCAD.
:
D

(vl-file-directory-p "Help")

(vl-file-directory-p "Help2") n i l

2.11.18. vl-file-rename
.
(vl-file-rename <> <>)

2.

U7_

, , nil,
.
<> , () AutoCAD.
:

(vi-fiie-rename "Heip.txt" "Heip2.txt") ,


"Heip.txt",

2.11.19. vl-file-size
.
(vl-file-size <>)

.
( ).
, nil.
<> ,
AutoCAD.
:

(vl-file-size "acad.exe") 6868992,


AutoCAD

2.11.20. vl-file-systime
.
(vl-file-systime <>)

.
:






148

Visual LISP AutoCAD

(0 , 1 , 2 . .).
:

( v l - f i l e - s y s t i m e " p l a n . d w g " ) ( 1 9 9 9 7 3 14

11 24

52 0 ) ,

14 1999 , 3- (), 11 . 24 .
52 .

2.11.21. vhfilename-base
, .
{vl-filename-base <>)

.
( ).
.
:

(vl-filename-base "d:\\Projectl2\\Resul\\valc02.1st") "valcO2"

. , 13.

2.11.22. vl-filename-directory
.
(vl-filename-directory

<>)

.
( ).
.
findfile, .
:
0

(vl-filename-directory
"d:\\Projectl2\\Resul"

"d:\\Projectl2\\Resul\\valc02.1st")

(vl-filename-directory "acad.lsp") ""

. , 13.

2.11.23. vl-filename-extension
.
(vl-filename-extension <>)

2. AutoUSP

1J9_

, . , nil.
:

(vl-filename-extension "d:\\Projectl2\\Resul\\valc02.1st")
".1st"

(vl-filename-extension "acad.lsp") ".lsp"

(vl-filename-extension "acad") nil

. , 13.

2.11.24. vl-filename-mktemp
(. .
) .
(vl-filename-mktemp [<> [<> [<>]]])
: <> ,
; <> ,
; <> , . .
.
<> , "$VL~~".
<>
, .
<> nil, ,
, , :
<>, ;
, ;
, TEMP;
AutoCAD (. . 1.4).
<> , <> ( ).
<> , .
, <>, , .

150

Visual LISP AutoCAD

(vl-filename-mk'temp) ": \\WINDOWS\\TEMP\\$VL001"

(vl-filename-mktemp "abcdefgh") ": \\WINDOWS\\TEMP\\abcde002"

(vi-filename-mktemp "xxx" "c:\\Temp" "$")


":\\\\003$"

(vl-filename-mktemp "xxx" "c:\\Temp" ".$xx")


":\\Temp\\xxx004.$"

, vl-filename-mkterrp
Visual LISP, Visual LISP.

2.11.25. vl-princ-to-string
, ,
princ .
(vl-princ-to-string <>)
.
.
:

(vi-princ-to-string 1) " 1 "

(vl-princ-to-string 'open) "open"


(vl-princ-to-string "") ""
(vl-pr.inc-to-string '(70 34 1)) " (70 34 1)

( v i - p r i n c - t o - s t r i n g '(8 . "")) " (8 . )

2.11.26. vl-prinl-to-string
, ,
prini .
(vl-prinl-to-string <>)
.

:

(vi-prini-to-string 1) " 1 "


(vl-prinl-to-string 'open) "open"

2. AutoUSP

151_

(vl-prinl-to-string "") "\"\""

(vi-prini-to-string '(70 34 1)) " (70 34 1)

(vi-prini-to-string '(8 . "")) " (8 . \"\")

2.11.27.
AutoLISP .
, (), , .
, 2.12.
I 2.12.

;
(setq ff (open ":\\test.txt" "w"))
(write-line " " ff)
(write-char 65 ff)
(write-char 67 ff)
(write-line " " ff)
(close ff)

;
( s e t q f f (open " c : W t e s t . t x t " " r " ) )
(setq si (read-char ff))
(setq s2 (read-char ff))
(setq strl (read-line ff))
(setq str2 (read-line ff))
(setq str3 (read-line ff) )
(close ff)
(setq ff nil)

(setq ff (open "c:\Ytest.txt" "w")) ff, c:\test.txt,


( open ). (write-line " " ff)
( " " 13 )
13 10,
.
(~

UNIX
10.

152

Visual LISP AutoCAD

, write-char
65 ( ) 67 ( ). write-iine
" " (13 ) 13 10,
. f f close.
,
.
read-char , si s2. s t r i . str2 .
read-line nil, c:\test.txt .
ff ( ). :
si = 207 ( )
s2 =229 ( )
strl = " "
str2 = " "
str3 = nil

princ, prini, print prompt


AutoCAD, prini print
( ).
write-iine
princ, , \, . :
(princ " \n" ff)

13,
getfiled, vl-filename-base, vl-filename-directory, vl-filenameextension, vl-file-delete, write-iine, open, close.

2.12.
AutoCAD
AutoCAD ,
, ( ) .
. .

153

2. AutoUSP

ELLIPSE

OLE2FRAME

TEXT

3DS0LID

HATCH

POINT

TOLERANCE

ACAD_PROXY_ENTITY

IMAGE

POLYLINE

TRACE

ARC

INSERT

RAY

VERTEX

ARCAL1GNEDTEXT

LEADER

REGION

VIEWPORT

ATTDEF

LINE

RTEXT

WIPEOUT

ATTRIB

LWPOLYLINE

SEQEND

XLINE

BODY

MLINE

SHAPE

CIRCLE

MTEXT

SOLID

DIMENSION

OLEFRAME

SPLINE

3DFACE

,
AutoCAD, .
, , , . AutoLISP
, , (, . .).

2.12.1. entlast
:
(entlast)

.
nil,
(, ). :
< : 144158>
(<Entity name: 144158>)
, .
, :
(setq eela (entlast))

2.12.2. entnext
().
(entnext [<>])

154

Visual LISP AutoCAD

entnext .
,
.
,
nil, (. . ).
:

(setq el

(entnext))

(setq e2 (entnext 2)) , el


(setq (entnext )) , 2
entiast .
,
(, POLYLINE),
, . . ( VERTEX),
SEQEND.
( , POLYLINE
):

(setq eela (entiast))

(setq vi (entnext eela)) ,


>
(setq v2 (entnext vi)) ,

. entnext 14.

( LWPOLYLINE) , .

2.12.3. entsel
entsel , , .
(entsel [<>])

2. AutoUSP

155_

, : , (
, , ,
). (Last) .
:
D

(setq esl (entsel " : ")) (< :


149960> (301/791 138.438 0.0))

, , , , .
. 14.

2.12.4. entdel

, .
(entdel <>)
() . , ,
,
.
:
0

(command "_LINE" '(. 56.8) '(150.3 -15.5) "") n i l

(setq ki (entdel ( e n t l a s t ) ) )
< : 4002ed58>
(entdel ki) <
: 4002ed58>

2.12.5. entget
.
(entget <> [<>])
<> ,
<> ,
(
. . 2.14 10).

156

Visual LISP AutoCAD

, ( LINE).
(setq le (entget (entnext)))

:
((-1 . < : 144158>) (0
(330 . < : 14a40f8>) (5
(410 . "Model") (8 . "0") (100 .
(11 285.148 96.5053 0.0) (210 0.0

. '"LINE")
. "2") (100 . "AcDbEntity") (67 . 0)
"AcDbLine") (10 201.536 140.622 0.0)
0.0 1.0))

,
,
DXF- (. . 2.9.11 15).
:
1 (< : 144158>);
0 ( " L I N E " ) ;
5 ( );
8 ("0");
10 (201.536 140.622 .>;

1 1

(285.148

96.5053

0.0);

210 ,
.
410 .
, , . assoc , cdr DXF-.
:
(cdr (assoc 0 le)) "LINE" ( )

(cdr (assoc 8 le)) "0" ( )

( c d r ( a s s o c 10 l e ) ) ( 2 0 1 . 5 3 6 140.622 0.0)

( c d r ( a s s o c 11 l e ) ) (285.148 96.5053 0.0)

, 62 ,
6 , 48 ,
311 ( 100).
le DXF- , : (BYLAYER) 1.
, ( CIRCLE):

2. AutoLISP

1S7_

( (-1 . < : 144160>) (0 . "CIRCLE")


(330 . < : 14a40f8>) (5 . "2") (100 . "AcDbEntity") (67 . 0)
(410 . "Model") (8 . "0") (100 . "AcDbCircle") (10 387.691 142.198 0.0)
(40 . 27.8941) (210 0.0 0.0 1.0))
DXF- 1, 0, 410, 8, 210 ,
( LINE). 40
, DXF- 10
.
:

(cdr (assoc 40 l e ) ) 27.8941 ()

(cdr (assoc 10 l e ) ) (387.691 142.198 0.0)

,
(LIST), , entget,
DXF- .

2.12.6. entmake
, ( DXF- 1),
:
(entmake <>)
, , entget. entmake
VIEWPORT.
<> n i l ,
.
:

(entmake ' ( ( 0 . "CIRCLE") (10 500.0 0.0 0.0) (40 . 50.0))) (500 0) 50;
(, . .),
, ; (( . "CIRCLE")
(10

500.0

0.0

0.0)

(40

50.0))

2.12.7. entmakex
,
entmake.
- (. . 2.15).
(entmakex <>)

158

Visual LISP AutoCAD

nil,
.
:
(entmakex '((0 . "CIRCLE") (10 500.0 0.0 0.0) (40 . 50.0)))
(500 0)
50. , : < : 4002ed70>

2.12.8. entmod
entmod entmake, , DXF- -1 (. .
) ( ,
, ):
(entmake <>)

entmod
<> nil .

2.12.9. entupd
, , , entmod.
(entupd <>)

<> , , , entiast.
nil ( ).

2.12.10. handent
.
(handent <>)
<>
, entget.
n i l ( ).

2.12.11. nentsel

, entsei.

2.

159_


(POLYLINE), (VERTEX) ,
.
(INSERT),
(. ).
(nentsel [<>])

, :
:
(Select object:)

nentsel (, INSERT)
. ,
: -, . , , , : ,
, ,
4x3 () , , ( ,
, , ).
4x3, nentsel , : ( (mOO mOl mO2) (ml mil
ml2) (m20 m2i m22) (m30 m3i m32)).
:

X'
= X*mOO -l- Y*mlO -i Z*m20 -h m30
i- Z*m21 -v m31
Y1 = X*mOl i- Y*mll >
Z1 = X*mO2 - Y*ml2 -l- Z*m22 -v m32
( Y z) , (1 Y' Z 1 ) .

2.12.12. nentselp
nentselp nentsel, (INSERT), , 4x3,
4x4 (. ).
(nentselp [] [<>])

160

Visual LISP AutoCAD

<>,
.
nentselp nentsei,
, , ,
nentsei, ,
4x4,
() . : ( (nOO nOl ()2 ) (nlO nil nl2 13) (20 21 22 23) (0.0
. . 1.0)).
:
X' = X *nOO
Y'
* n l O -I-

Y* n O l

Y*11

n'i- Z

= X * n 2 0 -h

Y*n21

-i

Z'

i_

1-7

*nO2 -v nO3
*nl2 -f- nl3
*n22 -v n33

(X Y z) (X' z ? ) , nentsei.

2.12.13.
, . ,
( , - ). (
) .
- AutoLISP,
.
.
(

")

(GROUP).
, .

128. AutoCAD ,
, (,
- ).
, ,
, nil.

2.12.14. ssget
ssget :
(ssget [<>] [<1> [-<2>] ] [<>] [<>] )

2. AutoLISP

]61_

<> ,
, (
AutoCAD _):
"" ;
"" ;
"F" ;
" I " ;
"L" ;
"" ;
"W ;
"WP" ;
"X" ,
, <> (
<> );
"" ,
;
"-." , ;
":N" (
, ); , ; , , ,
(. ssnamex);
Cl ":S" .
<1> <2> :
, <1>. <!> <2>,
(
, . . "W" ",") <> , , "F", "WP", "".
<> , , entget, , (,
, , . .).
6 . 155

162

Visual LISP AutoCAD

ssget ( n i l ,
).
:
Oelection set: 2>

,
, .
:

(ssget) :
:
(Select objects:)

(ssget

'(15.78 320.1)) ,

( 1 5 . 7 8
D

(ssget

"_C"

320.1)
'(1.57 -40.4)

'(15.78

3 2 0 . 1 ) ) ,

(1.57

-40.4)

(15.78

320.1)

(ssget "__" ' ( ( 0 . "POLYLINE") (8 . "WALLS " ) ) ) .


, POLYLINE WALLS

(ssget "_A") , "_" , . . (ssget "__" ' ()) (ssget " X " n i l )

. 9.
128 .
ssget n i l . ,
n i l , .

2.12.15. ssadd
.
(ssadd [<> [<>]])
: <> , <> . .
.
<> , <> ,
. , ( nil).

2. AutoLISP

163

(command

"_LINE"

'(250.0

35.0)

' ( 1 2 5 . 1 56.9)

" " ) -

n i l

(setq ssl (ssadd)) <Selection set: 4>

(ssadd (entiast) ssl) ssl (


LINE) <Selection set: 4>

2.12.16. ssdel
.
(ssdel <> <>)

. <> , <> ,
.
, ,
nil, .
( . 2.12.15):

(ssdel (entiast) ssl) ssl (


LINE) Oeiection set: 4>

2.12.17. sslength
, . . .
(ssiength <>)

<> .
.
:

(sslength (ssadd)) 0, .. ssadd

(sslength (ssget "_L")) 1, . . ssget


( )

2.12.18. ssmemb
, .
(ssmemb <> <>)

: <> , <> .
(. . <>),
, n i l .

164

Visual LISP AutoCAD

:
0

(setq nabor (ssget "_L")) (, <Selection set: 7>)

(ssmemb (entiast) nabor) (, <


: 4002ed58>), . . n a b o r

2.12.19. ssname
.
(ssname <> <>)

<> . <> . 0 32 767,


32 767.0.
.
nil, .
( . 2.12.18):

(ssname nabor 0) (, < :


4002158>)

(ssname nabor i) nil, . . nabor


. . 2.12.23 9.

2.12.20. ssnamex
( <> <>), (. ). <> , .
(ssnamex <> [<>])

ssname.
ssnamex , , .
<> , , <>. <> , , ,
<>. <> ,
ssnamex nil.

2. AutoLISP

16S_

:
(<> <> <>). <> ,
ssget :
("L", "", "X" . .);
1 ;
2 "W" "wp";
3 - "" "";
4 "F".
<> , (. ).
<>
, entiast.
<> 0, 0 , , 0 .
, . ( : 1, 2
. .), .
: (<_>
<!> .. . <>). 1 -1 .
(<1> . .) ( ) : (<> <> [<>]). ,
, ,
. <> (0 ,
1 , 2 ), <> , <> ,
( ), , .
, 5 ,
(7.51 16.02) ,
( s s n a m e x 5 0) :
0

(0

((1

< :

14560>

( 7 . 5 1 1 6 . 0 2 0.0) ) ) ).

ssnamex
(), :
<> 1 ( ).;
<> < : 14560>;

<> 0 (0 (7.51 16.02 0.0) ), (7.51 16.02

0.0), .

166

Visual LISP AutoCAD

, ssnamex:
({0 < : 14578> 0)) , (, "L");
((3 < : 14568> 0 -1) (3 < : 14578> 0 -1} (-1
(0 ('-147.787 129.133 0.0)) (0 (-64.2728 129.133 0.0)) (0 (-64.2728
22.3376 0.0)) (0 (-147.787 22.3376 . 0 ) ) ) ) , -

1 ( );
((1 < : 14560> 0 (0 (74.2672 64.8218 0.0))) (2 < : 14570> 0 -1) (2 < : 14568> 0 -1) (-1 (0 {-177.446
158.755 0.0)) (0 (40.3151 158.755 0.0)) (0 (40.3151 83.1407 0.0)) (0

(-177.446 83.1407 .)))) ,


(74.2672 64.8218 0.0),
, 1.
<> ,
. . .

. ssname ( ssnamex) , (: , . .).

2.12.21. sssetfirst
, ,
<1> <2>, , <2> (
).
( s s s e t f i r s t <1>

[<2>])

nil.
, .
:

(command

"_LINE"

'(250.0

35.0)

'(125.1

56.9)

" " ) -

nil

(setq ssl (ssadd (entlast))) <Selection set: 6>

(command "^CIRCLE" '(200.0 82.0) 60.0)


nil

(setq ss2 (ssadd (entlast))) <Selection set: 8>

167

2. AutoLISP

(sssetfirst ssl ss2) (<Selection set: 6> <Selection set:


8>) , , ,
ssl ss2; ,
(. 2.8)

Exptess

; ( s s s e t f i r s t ssl ss2)
(<Selection set 6> 'Selection set

3561456.1 6724, 0 0000

8>)

4. DPTO - [ - '|0

. 2 . 8 . s s s e t f i r s t

2.12.22. ssgetfirst
,
<!> <2> sssetfirst (
,
).
(ssgetfirst)

2.12.23. AutoCAD

, , . .

168

Visual LISP AutoCAD

entsei ssget. ( , . .) ssget.


entsei ,
.
n t h .

ssget , (
nil).
sslength,
ssname.
entget, , . assoc
cdr .
. , HOLES , (CIRCLE).
, ,
. 2.13.
I 2.13.
;
(setq l i s t ^ r a d

'()

list_cen

( l i s t _ r a d )

j
(list_cen)

'())

; HOLES
(setq nab_cir

(ssget "_X"

(list

(cons 8 "HOLES")

(cons 0 "CIRCLE"))))

; , nab_cir
;

( ,

(if

n i l )

(null nab_cir)

(progn
(princ "\ HOLES. " ) ;
( p r i n c ) ;
) ; progn
(progn
(setq i -1 nab_ien

(sslength nab_cir))

; nab_cir
(repeat nab__len
(setq i

(1+ i ) )

;
(setq cirlist (entget (ssname nab cir i)))

2. AutoLISP

169_

(setq radcir (cdr (assoc 40 cirlist)))


(setq cencir (cdr (assoc 10 cirlist)))
; iist_rad list_cen
(setq list_rad (append list_rad (list radcir)))
(setq list_cen (append list cen (list cencir)))
); repeat
;
(princ ": ")
(princ list_rad)
(princ ": ")
(princ list_cen)
); progn
); if

(, rcl.lsp),
:
(load "rcl.lsp")

, rcl.lsp .
, AutoCAD .
.
HOLES, ssget
: (ssget "_X" ( l i s t (cons 8 "HOLES") (cons
"CIRCLE") )). ( ) nab_cir.

, nab_cir,
(sslength nab_cir). ssname , :
(ssname nab_cir i) i i-i.
-
(entget (ssname nab_cir i ) ) .
cdr assoc (DXF 40) (DXF- 10). list__rad list_cen.
:
: (66.0916 29.1292)
: ((179.603 194.961 0.0) (43.0525 184.539 0.0))((179.603 194.961
0.0) (43.0525 184.539 0.0))

, , . 2.16.

170

Visual LISP AutoCAD

2.13.


: , , , , . . , .

2.13.1.
,
:
BLOCK ;
LAYER ;
LTYPE ;
STYLE ;
DIMSTYLE ;
UCS ;
VIEW ;
VPORT ;
APPID .
,

,
. AutoLISP, .

2.13.2. tblsearch
.
(tblsearch <> <> [<>])

: <> , >
, <> ( , nil nil).
,
( nil, ).
<> nil,
tbinext

2. AutoLISP

1_71_

( tbinext , ,
tblsearch).

(tblsearch "LTYPE" "CONTINUOUS") ((0 . "LTYPE")


(2 . "Continuous") (70 .0) (3 . "Solid line") (72 . 65) (73 . 0)
(40 . 0.0))

2.13.3. tbinext
.
(tbinext <> [<>])

: <> (.
. 2.13.1), <> ( . ).

n i l .

<> nil,
( ,
, tbinext
tblsearch, <>, , nil). (, ) , nil.
:

(tbinext "LTYPE" )
C O N T I N U O U S : ((0 . "LTYPE") (2 . " C o n t i n u o u s " )
l i n e " ) (72 . 65) (73 . 0) (40 . 0 . 0 ) )

(70 . 0)

(3 . " S o l i d

tbinext tblsearch:

(tblsearch
"LTYPE"
(2 . " C o n t i n u o u s " )
(40 . 0 . 0 ) )

(70

"CONTINUOUS"
)
. 0 )
(3 . " S o l i d

line")
(72

((0
65)

"LTYPE")
(-73 . 0 )

(tbinext "LTYPE") , CONTINUOUS

2.13.4. tblobjname
() ( ,
. .).
(tblobjname <> <>)

172

Visual LISP AutoCAD

: <> , <>
.
( )
. , nil.
:
0

(tblobjname "LTYPE" "CONTINUOUS") < : 4020>

2.13.5.
,
, .

(seta layi (tbinext "LAYER" ))


( ""), :
((

"LAYER")

(2

"")

(70

0)

(62

. 7 )

(6

"Continuous"))

DXF- ,
, 2 , 6 (. .
(BYLAYER)), 62
, 70 , . ,
DXF- , encget
.

(setq iay2 (tbinext "LAYER"))


, : . "LAYER")
(2 . "!.")
(70 . 4)
(62 . 4 0) (6 . "1"))
(setq Iay2name (tblobjname "LAYER" "!")) < :
14570>
iay2name entget
, 12 .

tbinext, tblobjname tbisearch, , , .

2.13.6. setview
VIEW:
(setview <> [<>])
.

2. AutoLISP

173_

: <> ,
tbinext tbisearch
VIEW; <> CVPORTS (0 ).
<> n i l .
,
: ISO, TOP FRONT. tbisearch :

(setq
spiso
(tbisearch
"VIEW"
"ISO"))

( ( 0 . "VIEW")
(2 . " I S O " ) (70 . 0) (40 . 6 4 6 . 0 3 5 ! (10 4 3 . 4 8 7 1 1 4 6 . 3 5 7 ) ( 4 1 . 6 2 3 . 9 6 )
ill - 1 . 0 - 1 . 0 1.0) (12 0 . 0 0 . 0 0.0) (42 . 5 0 . 0 ) (43 . 0.0) (44 . 0.0)
(50 . 0.0)
(71 . 0)
(72 . 1)
(110 0.0 0.0 0.0)
(111 1.0 0 . 0 0 . 0 )
( 1 1 2 0 . 0 1 . 0 0 . 0 ) ( 7 9 . 0) ( 1 4 6 . 0 . 0 ) )

(set
(2 .
(11
(50
(112

(setq
spfro
(tbisearch
"VIEW"
"FRONT"))

( ( 0 . "VIEW")
(2 . " F R O N T " )
(70 . 0)
(40 . 4 3 3 . 8 4 6 )
(10 2 1 0 . 0 0.0)
(41 . 842.563)
(11 0 . 0 - 1 . 0 0.0) (12 0 . 0 0 . 0 0.0) (42 . 5 0 . 0 ) (43 . 0.0) (44 . 0.0)
(50 . 0.0)
( 7 1 . 0)
( 7 2 . 1)
(110 0.0 0.0 0.0)
(111 1.0 0 . 0 0 . 0 )
( 1 1 2 0 . 0 0 . 0 1 . 0 ) ( 7 9 . 3) ( 1 4 6 . 0 . 0 ) )

sp-top
(t
"TOP")
(70
0.0 0.0 1.0)
. 0.0)
(71
0.0 1.0 0.0)

bisearch
"VIEW"
"TOP"))

( (0 . "VIEW")
. 0)
(40 . 2 9 7 . 0 )
(10 2 8 8 . 3 9 9 1 4 8 . 5 )
(41 . 576.797)
(12 0 . 0 0 . 0 0.0) (42 . 5 0 . 0 ) (43 . 0.0) (44 . 0.0)
. 0)
(72 . 1)
( 1 1 0 0 . 0 0 . 0 0.0)
(111 1.0 0 . 0 0 . 0 )
(79 . 0)
(146 . 0 . 0 ) )

, CVPORT.
CVPORT (
).
, , ,
CVPORT: 2, 3, 4, 5.
:

(setview spiso 2) 2
ISO ((0 . "VIEW") (2 . "iso") . 0) (40 . 646.035)
(10 4 3 . 4 8 7 1 1 4 6 . 3 5 7 ) (41 . 6 2 3 . 9 6 ) (11 - 1 . 0 - 1 . 0 1.0)
(12 0 . 0 0 . 0 0 . 0 )
(42 . 5 0 . 0 )
(43 . 0.0)
(44 . 0 . 0 )
(50 . 0 . 0 )
( 7 1 . 0)
( 7 2 . 1)
(110 0 . 0 0 . 0 0 . 0 )
(111 1.0 0 . 0 0.0)
(112 0 . 0 1.0 0.0)
(79 . 0)
(146 . 0 . 0 ) )

(setview sptop 5) 5

((0 . "VIEW")

(2 . "")

. 0)

(40 . 297.0)

(10 2 8 8 . 3 9 9 1 4 8 . 5 )
(41 . 576.797)
(11 0 . 0 0 . 0 1.0)
(12 0 . 0 0 . 0 0 . 0 )
(42 . 5 0 . 0 )
(43 . 0.0)
(44 . 0 . 0 )
(50 . 0 . 0 )
( 7 1 . 0)
( 7 2 . 1)
(110 0 . 0 0 . 0 0.0)
(111 1.0 0 . 0 0.0)
(112 0 . 0 1.0 0 . 0 )
( 7 9 . 0)
(14 6 . 0 . 0 ) )

174

Visual LISP AutoCAD

(setview spfro 0) (
) FRONT

( ( 0 . "VIEW")
(2 . " F R O N T " )
( 7 0 . 0)
(40 .
(10 2 1 0 . 0 0 . 0 )
(41 . 842.563)
(11 0.0 - 1 . 0 0.0)
(12 0 . 0
(42 . 5 0 . 0 )
(43 . 0.0)
(44 . 0 . 0 )
(50 . 0 . 0 )
( 7 1 . 0)
(110 0 . 0 0 . 0 0.0)
( 1 1 1 1 . 0 0.0 0 . 0 )
(112 0 . 0 0 . 0 1.0)
(146 . 0 . 0 ) )

433.846)
0.0 0.0}
( 7 2 . 1)
(79 . 3)


(. 12 ).

2.13.7. snvalid
( , , ,
. .).
(snvalid <> [<>])

: <> , <> (0 1).


, , n i l .
<> |.
<> 0, .
1, ,
(
).
. ,
, | .
snvalid , EXTNAMES.
EXTNAMES 0, , AutoCAD, AutoCAD 2000:
, ($), (_) (-).
EXTNAMES 1 ( ), snvalid . -,
, : <, >, /, \, " ( ),
: , ? , * , , (), =, ", , ( 59). .

2. AutoLISP

175

( , EXTNAMES 1):
(snvalid "chamferg")
0

(snvalid "chamfer*") nil

(snvalid "chaml.fer") nil


D

(snvalid "cham fer")

(snvalid "chamlfer" 1)

( , EXTNAMES 0):
D

(snvalid "chamfer@") nil

(snvalid "chamfer*") nil


a

(snvalid "chamlfer") nil

(snvalid "cham fer") nil

(snvalid "chamlfer" 1)

2.14. ,

, . .
, (, , , . .).

( ). .
, .

2.14.1.
,
(DXF-
2 239).
entget, ,
(. entget . 2.12.5). , entget, , DXF- (
), 1001 (
, )
DXF- 1000, 10021071. DXF-
. 2.6.

176

Visual LISP AutoCAD


2.6. DXF-

1000

255 (256- 0)

1001

, , 31 ( 1001 , DXF- 1002, , ; . DXF- 1002).


, $, -, _

1002

, "{" "}", ,
.
1002 ( 1002,
, ,
1002 ). . 1001

1003

1004

127 .
ObjectARX

1005

1010

( )

1011

, .
, , . (STRETCH),

1012

, .
, ,

1013

, .
,
,
. , 1013,
, . .

1040

1041

, .

1042

, .

2. AutoUSP

177
2.6 ()

1070

16- ( )

1071

32- ( ). AutoCAD
1071 , AutoLISP . entmake entmod
1071 , .
ObjectARX 1071

, .
APP1D (. . 2.13.1). , regapp (. . 2.14.2).

2.14.2. regapp
APP1D.
(regapp <>)

<> (
,
).
regapp ( nil ).
nil ,
.
:

(regapp "SHIPDESIGN") "SHIPDESIGN"

2.14.3.
entmake ( . . 2.12.6)
. entmod
.
, ( )
, "GENHULL":

(setq ie (entget (entiast))) 1 , : ((-1 .


< : 14578>) (0 . "LINE") (330 . < : 14aa4f8>)

178

Visual LISP AutoCAD

(5 . " 2 F " )
(100 . " A c D b E n t i t y " )
( 6 7 . 0)
(410 . " M o d e l " )
(62 . 1)
(100 . "AcDbLine")
(10 8 5 . 4 6 5 5 2 2 3 . 3 3 5 0.0)
(11 1 8 7 . 7 1 2 1 6 7 . 2 0 9 0.0)
( 2 1 0 0 . 0 0.0 1 . 0 ) )
D

(setq edata

'((-3

("GENHULL"

(1000

"")

(1070

(3 .

"0")

5 7 ) ) ) ) ) CO-

edata ,
1 ( DXF-
1000 DXF- 1070)
D

(setq Ie2

( a p p e n d l e e d a t a ) ) 1 e d a t a

1 2 : ( ( - 1 . < : 1 4 5 7 8 > ) (0 . " L I N E " )


(330 . < : 1 4 a a 4 f 8 > ) (5 . " 2 F " ) (100 . " A c D b E n t i t y " )
(67 . 0) (410 . " M o d e l " ) (8 . " 0 " ) (62 . 1) (100 . " A c D b L i n e " )
(10 8 5 . 4 6 5 5 2 2 3 . 3 3 5 0 . 0 )
(11 1 8 7 . 7 1 2 1 6 7 . 2 0 9 0 . 0 )
(210 0 . 0 0 . 0
(-3 ("GENHULL" (1000 . " " ) (1070 . 5 7 ) ) ) )

1.0)

(entmod 12)
,

(entget (entiast) '("GENHULL"))


, -

"GENHULL":

( (-1 . < : 14578>)

(0 . "LINE")

( 3 3 0 . < : 1 4 a a 4 f 8 > )
(5 . " 2 F " )
(100 . " A c D b E n t i t y " )
(67 . 0)
(410 . " M o d e l " )
(8 . " 0 " )
( 6 2 . 1)
(100 . " A c D b L i n e " )
(10 8 5 . 4 6 5 5 2 2 3 . 3 3 5 0 . 0 )
(11 1 8 7 . 7 1 2 1 6 7 . 2 0 9 0.0)
( 2 1 0 0.0 0 . 0 1 . 0 )
( - 3 ("GENHULL" ( 1 0 0 0 . " " ) ( 1 0 7 0 . 5 7 ) ) ) )


16 1 (16 383 ).
.
x d s i z e xdroom.

, .
. 10.

2.14.4. xdsize
, .
(xdsize <>)

<> ,
DXF- - .
( ).
:

(xdsize

18

'(-3

("GENHULL"

(1000

"")

(1070

57))))

2. AutoLISP

179

2.14.5. xdroom
.
(xdroom <>)
.
. nil.
:

(xdroom (entiast)) 16383,


2.15. ,
-
, ,
, (dictionaries). . , , .

2.15.1.
AutoCAD .
, ,
:
;
;
;
;
.
, . ()
namedobjdict.
dictsearch, dictnext,
dictadd, dictrename, dictremove. .
layoutiist,
.

180

Visual LISP AutoCAD

2.15.2. namedobjdict
.
(namedobjdict)

( ).
( ):

(setq od (namedobjdict)) < : 40020>

,
. entget:
n

(entget od) ((-1 . < : 400260>)


( . "DICTIONARY") (330 . < : 0>) (5 . "")
(100 . "AcDbDictionary") (280 . 0) (281 .1) (3 . "ACAD_GROUP")
(350 . < : 40028>) (3 . "ACAD_LAYOUT")
(350 . < : 4002ecd0>) (3 . "ACAD_MLINESTYLE")
(350 . < : 40028>) (3 . "ACAD_PLOTSETTINGS")
(350 . < : 40028>) (3 . "ACAD_PLOTSTYLENAME")
(350 . < : 400270>))

DXF- :
ACADJ3ROUP ;
ACAD_LAYOUT ;

ACADJVILINESTYLE ;
ACAD_PLOTSETTINGS ;
ACAD_PLOTSTYLENAME .

2.15.3. dictsearch
( tbisearch).
(dictsearch <> <> [<>])

: <> ( ),
<> , <>
dictnext.
.
. 2.15.2 od, .
dictsearch .

2. AutoLISP

181_

( ):

(dictsearch od "ACAD_LAYOUT")
({-1 . < : 4002ecd0>) (0.. "DICTIONARY") (5 . "1")
(102 . "{ACAD_REACTORS") (330 . < : 400260>) (102 . "}")
(330 . < : 400260>) (100 . "AcDbDictionary") (280 . 0)
(281 . 1 ) (3 . "Model") (350 . < : 4002edl0>) (3 . "1")
(350 . < : 4002ecf0>) (3 . "2")
(350 . < : 4002ed30>))

DXF-
: , 2 ( . 2.15.8
layoutiist).
(Model).

( ):

(dictsearch od "ACAD_MLINESTYLE") (
(-1 . < : 40028>) (0 . "DICTIONARY") (5 . "17")
(102 . "{ACAD_REACTORS") (330 . < : 400260>) (102 . "}")
(330 . < : 400260>) (100 . "AcDbDictionary") (280 . 0)
(281 .1) (3 . "Standard") (350 . < : 40020>))

,
. Standard.

( ):

( d i c t s e a r c h od "ACAD_PLOTSTYLENAME")
((-1 . < :" 400270>) (0 . "ACDBDICTIONARYWDFLT") (5 . "")
(102 . "{ACAD_REACTORS") (330 . < : 400260>) (102 . "}")
(330 . < : 400260>) (100 . "AcDbDictionary") (280 . 0)
(281 .1) (3 . "Normal") (350 . < : 400278>)
(100 . "AcDbDictionaryWithDefault") (340 . < : 400278>))

, .
,
DXF- ( DICTIONARY ACDBDICTIONARYWDFLT).

2.15.4. dictnext
( tbinext, ).
(dictnext <> [<>])

: <> ( ),
<> ( , nil ).
.
, nil.
<> nil,
. dictnext
( , -

182

Visual LISP AutoCAD

dictnext, dictsearch,
<>, , nil).
,
,
.
( ):

(setq dbegin (dictsearch (namedobjdict) "ACAD_LAYOUT"))


: ((-1 . < : 4002ecd0>)
( . "DICTIONARY") (5 . "1") (102 . "{ACAD_REACTORS")
(330 . < : 400260>) (102 . "}")
(330 . < : 4002>) (100 . "AcDbDictionary") (280 . 0)
(281 . 1 ) (3 . "Model") (350 . < : 4002edl0>) (3 . "1")
(350 . < : 4002ecf0>) (3 . "2")
(350 . < : 4002ed30>))

(setq layoutdict (cdr (assoc -1 dbegin) ) )


: < : 4002ecd0>

(dictnext l a y o u t d i c t )
( Model):
((-1 . < : 4002edlO>) (0 . "LAYOUT") (5 . "22")
(102 . "{ACAD_REACTORS") (330 . < : 4002ecdO>) (102 . "}")
(330 . < : 4 002ecd0>) (100 . "AcDbPlotSettings")
(2 . "HP DeskJet 720C Series") (40 . 0.0) (41 . 0.0) (42 . 0.0)
(43 . 0.0) (44 . 0.0) (45 . 0.0) (46 . 0.0) (47 . 0.0) (48 . 0.0)
(49 . 0.0) (140 . 0.0) (141 . 0.0) (142 . 1.0) (143 . 1.0) (70 . 1712)
(72 . 0) (73 . 0) (74 . 0 ) (7 . "") (75 . 0) (147 . 1.0) (148 . 0.0)
(149 . 0.0) (100 . "AcDbLayout") (1 . "Model".) (70 . 1) (71 . 0)
(10 0.0 0.0 0.0) (11 12.0 9.0 0.0) (12 0.0 0.0 0.0) (14 0.0 0.0 0.0)
(15 0.0 0.0 0.0) (146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0)
(17 0.0 1.0 0.0) (76 . 0) (330 . < : 4002ecf8>))

(dictnext l a y o u t d i c t )
(1): ((-1 . < : 4002ecf0>) (0 . "LAYOUT")
(5 . "IE") (102 . "{ACAD_REACTORS") (330 . < : 4002ecd0>)
(102 . "}") (330 . < : 4002ecd0>) (100 . "AcDbPlotSettings")
(1 . "") (2 . "none_device") (4 . "Letter_(8.50_x_ll.00_Inches))
(40 . 6.35) (41 . 6.35) (42 . 6.35001) (43 . 6.35001) (44 . 215.9)
(45 . 279.4) (46 . 0.0) (47 . 0.0) (48 . 0.0) (49 . 0.0) (140 . 0.0)
(14.1 . 0.0) (142 . 1.0) (143 . 1.0) (70 . 688) (72 . 1) (73 . 1)
(74 . 5 ) (7 . "") (75 . 16) (147 . 1.0) (148 . 0.0) (149 . 0.0)
(100 . "AcDbLayout") (1 . "1") (70 . 1) (71 . 1) (10 -6.35001 6.35 0.0) (11 273.05 209.55 0.0) (12 0.0 0.0 0.0) (14 26.67 20.32 0.0)
(15 240.03 182.88 0.0) (146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0)
(17 0.0 1.0 0.0) (76 . 0) (330 . < : 4002ecd8>)
(331 . < : 4002ed70>))

(dictnext l a y o u t d i c t )
(2)." ((-1 . < : 4002ed30>) (0 . "LAYOUT")
(5 . "26") (102 . "{ACADJREACTORS") (330 . < : 4002ecd0>)
(102 . "}") (330 . < : 4002ecd0>) (100 . "AcDbPlotSettings")
(1 . "") (2 . "none device") (4 . "Letter (8.50 x 11.00 Inches)")

2.

183

(40 . 6 . 35) (41 . 6.35) (42 . 6.35001) (43 . 6.35001 ) (44 . 15.9)
(45 . 7 9 . 4 ) (46 . 0.0) (47 ,. 0.0) (48 . 0.0) (49 . 0 0) (140 . 0. 0)
(141 . 0 . 0 ) (142 . 1.0) (143 . 1. 0) (70 . 688) (72 . 1) (73 . 1)
(74 . 5) (7 . " " ) (75 . 16) (147 . 1.0) (148 . 0.0) (149 . 0 . 0 )
(100
AcDbLayout ") (1 . "2" ) (70 . 1) (71 . 2) ( 0 . 0 0 . 0 0.0)
(11 12.0 9.0 0.0) (12 0.0 0.0 0.0) (14 0.0 0.0 0.0) (15 0.0 0.0 0.0)
(146 . 0.0) (13 0.0 0.0 0.0) (16 1.0 0.0 0.0) (17 0.0 1.0 0.0)
(76 . 0) (330 . < : 4002edl8>))

,
DXF- 1 (. layoutiist
. 2.15.8).

2.15.5. dictadd
.
(dictadd <> <> <>)

: <> , <>
, , <> (
). entmakex.
.
,
. ( ).
( ):

( s e t q d i c l i s t ' ( ( 0 . "DICTIONARY") (100 . " A c D b D i c t i o n a r y " ) ) ) ((0 . "DICTIONARY") (100 . "AcDbDictionary") ),


(setq newdic (entmakex d i c l i s t ) ) < : 4002edc0>
(dictadd (namedobjdict)

"" newdic) -

, , , ; < : 4 002edc0>
, entget:
D

(entget newdic) ((-1 . < : 4002edc0>)


(0 . "DICTIONARY") (5 . "38") (102 . "{ACAD_REACTORS")
(330 . < : 400260>) (102 . "}")
(330 . < : 400260>) (100 . "AcDbDictionary")
(280 . 0) (281 . 1))


. entget:

(entget (namedobjdict)) ((-1 . < : 400260>)


( . "DICTIONARY") (330 . < : 0>) (5 . "")

184

Visual LISP AutoCAD

(100
(3 .
(3 .
(3 .
(3 .
(3 .
(3 .

. "AcDbDictionary") (280 . 0) (281 . 1)


"ACAD_GROUP") (350 . < : 400268>)
"ACAD_LAYOUT") (350 . < : 4002ecdO>)
"ACAD_MLINESTYLE") (350 . < : 40028>)
"ACAD_PLOTSETTINGS") (350 . < : 40028>)
"ACAD_PLOTSTYLENAME") (350 . < : 400270>)
"") (350 . < : 4002edcO>))

,
.
, ACAD_ , AutoCAD.
dictadd .
-, . 2.15.9.

2.15.6. dictremove
.
(dictremove <> <>)

: <> , <>
, .
.
( . 2.15.5):

(dictremove (namedobjdict) newdic) < : 4002edc0>

dictremove ,
. ,
,
entdei.
. AutoCAD
, dictremove
.

AutoCAD d i c t r e move , .

2.15.7. dictrename
.
(dictrename <> <> <>)

2. AutoLISP

185_

: <> , <>
<> ( ).
<> . nil.
:
0

(dictrename (namedobjdict) "" "") ""


, . 2.15.5.

2.15.8. layoutlist
.
(layoutlist)

.
(. 1st floor.dwg ,
AutoCAD 2000):

(layoutlist)
("Architectural Plan" "Electrical Plan" "Lighting Plan")

2.15.9.-
- ,
. XRECORD.
- (. . 2.14), 16 383 .
- , ,
, DXF- 1369
( , DXF- 1000
). - .
.
l x r l 12 entmakex

XRECORD ( DXF- 100


, ):
(setq lxrl '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . " ")
(10 110.0 5267.2 230.8) (11 -11.2 1234.6 429.0) (40 . 637.54) (70 . 0)))
D

(setq Ixr2 '((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "")


(10 4207.2 3128.9 -234.4) (11 -687.3 5344.6 1234.6) (40 . 230.17)
(70 .1)))

186

Visual LISP AutoCAD

entmakex (-) xri 2:

(setq xrl (entmakex lxrl)) < : 4002ed58>


(setq xr2 (entmakex Ixr2) ) < : 4002ed60>

entget -:

( e n t g e t x r l ) ( ( - 1 . < : 4 0 0 2 e d 5 8 > )
( . "XRECORD") ( 3 3 0 . < : 0 > ) (5 .. " 2 " )
(100 . " A c D b X r e c o r d " ) (280 . 1 ) (1 . " " ) (10 1 1 0 . 0 5 2 6 7 . 2
2 3 0 . 8 ) (11 - 1 1 . 2 1 2 3 4 . 6 4 2 9 . 0 ) (40 . 6 3 7 . 5 4 ) (70 . 0 ) )

( e n t g e t x r 2 ) ( ( - 1 . < : 4 0 0 2 e d 6 0 > )
(0 . "XRECORD") ( 3 3 0 . < : 0 > ) (5 . " 2 " ) ( 1 0 0 .
" A c D b X r e c o r d " ) (280 . 1 ) ( 1 . " " ) (10 4 2 0 7 . 2 3 1 2 8 . 9 - 2 3 4 . 4 )
(11 - 6 8 7 . 3 5 3 4 4 . 6 1 2 3 4 . 6 ) (40 . 2 3 0 . 1 7 ) (70 . 1 ) )

, AutoLISP enmakex - DXF-


330, 5 280.
,
. 2.15.5:

(setq diclist '((0 . "DICTIONARY") (100 . "AcDbDictionary"))) ((0 . "DICTIONARY") (100 . "AcDbDictionary"))

(setq newdic (entmakex diclist)) < : 4002ed68>

(dictadd (namedobjdict)
4002ed68>

"" newdic) < :

, :
D

(entget (namedobjdict)) ((-1 . < : 40020>)


(0 . "DICTIONARY") (330 . < : 0>) (5 . "")
(100 . "AcDbDictionary") (280 . 0) (281 .1) (3 . "ACADJ3ROUP")
(350 . < : 400268>) (3 . "ACAD_LAYOUT") (350 . < :
4002ecd0>) (3 . "ACAD__MLINESTyLE") (350 . < : 40028>)
(3 . "ACAD_PLOTSETTINGS") (350 . < : 40028>)
(3 . "ACAD_PLOTSTYLENAME") (350 . < : 400270>)
(3 . "") (350 . < : 4002ed68>))

xrl 2 1
.'

(dictadd newdic "1" xrl) < : 4 002ed58>

(dictadd newdic "" 2) < : 4002ed60>

entget - xrl 2, , (
):

(entget xrl) ((-1 . < : 4002ed58>)


(0 . "XRECORD") (5 . "2") (102 . "{ACAD_REACTORS") (330 . < : 4002ed68>) (102 . "}") (330 . < : 4002ed68>)

2. AutoLISP
(100 .
230.8)
D

"AcDbXrecord")
(280 . 1 )
(1 . " " )
(11 - 1 1 . 2 1234.6 429.0)
(40 . 6 3 7 . 5 4 )
(70 .

187_
(10
0))

110.0

5267.2

( e n t g e t x r 2 ) ( ( - 1 . < : 4 0 0 2 e d 6 0 > )
(0 . " X R E C O R D " )
(5 . " 2 " )
( 1 0 2 . "{ACAD_REACTORS")
(330 . <
: 4002ed68>)
(102 . "}")
( 3 3 0 . < : 4 0 0 2 e d 6 8 > )
(100 . " A c D b X r e c o r d " )
(280 . 1 )
(1 . "")
(10 4 2 0 7 . 2 3 1 2 8 . 9
-234.4)
(11 - 6 8 7 . 3 5344.6 1234.6)
(40 . 2 3 0 . 1 7 )
(70 . 1))

dictnext, :

(dictnext newdic ) ((-1 . < : 4002ed60>)


(0 . "XRECORD") (5 . "20") (102 . " f ACAD__REACTORS") (330 . <
: 4002ed68>) (102 . ."}") (330 . < : 4002ed68>)
(100 . "AcDbXrecord") (280 .1) (1 . "") (10 4207.2 3128.9 -234.4)
(11 -687.3 5344.6 1234.6) (40 . 230.17) (70 . 1))

(dictnext newdic) ( (-1 . < : 4002ed58>)


(0 . "XRECORD") (5 . "2") (102 . "{ACAD_REACTORS") (330 . <
: 4002ed68>) (102 . "}") (330 . < : 4002ed68>)
(100 . "AcDbXrecord") (280 . 1) (1 . " ") (10 110.0 5267.2
230.8) (11 -11.2 1234.6 429.0) (40 . 637.54) (70 . 0))

, .
, .

2.16.

. AutoLISP lambda,
, defun,
.
AutoCAD.
614.

, . .
AutoCAD.
AutoLISP, atoms-family (.
. 2.16.16).
,
, ,
, . .

188

Visual LISP AutoCAD

2.16.1. lambda
lambda ( ), .
, , .
,
lambda.
:
(lambda <> <>)
<> ,
<> , .
,
lambda apply mapcar. .
(lambda (u v w) (abs (+ (* 2 v) (* w)))) ,
u+2*v+3*w, u, v w , (
lambda).
, , :
-(apply ' (lambda (u v w) (abs (+ u (* 2 v) (* 3 w) ) ) ) ' (4 . 7 - 3 . 2 10.5) )
29.8. AutoLISP
u, v w, , 4.7, -3.2 . 5 (abs
( + 4 . 7

(* 2 - 3 . 2 )

(* 3 10.5) ) ) .

:
D

(mapcar
(list

1.7

'(lambda
2.2

5.8

(q)

(+ 1.0 q

(* q q)

(* q q q) ) )

3 . 0 ) ) ( 1 0 . 5 0 3

18.688
2

235.552

40.0)

, l + q + q + q , ( l i s t 1.7 2.2 5.8 3.0).

2.16.2. defun

defun:
(defun <> ([<>]' [/ <>]) <>)

2. AutoLISP

189_

, (. . ,
).
: <> , ; <> - , ; <> , , ()
; <> , ,
.
defun , .
, defun,
, .
.
:
(defun oursum (al 2 / s)
(setq s (+ al a2))
(- s a3)
); oursum

oursum.
(al, 2 ) (s). s
. : al 2
s, s .
, oursum.
al, 2 , s , . .
.
oursum
AutoCAD,
AutoCAD ( ), lsp (,
ourfunctions.lsp) load:
(load "ourfunctions.lsp")

lsp .
AutoCAD -

190

Visual LISP AutoCAD

, (. . 1.3). , oursum, , , , :
(setq newvall (oursum 55.02 (sqrt 0.933) -2.64))
, oursum
,
( ).

(~

Isp .
.

LISP-
/ (Load/Unload Applications),
. 3.4.4.
, 2.13 . 2.12.23.
rci ( 2.14).
! 2.14. r d ,
(defun r c l

( /)

; (list_rad) (list_cen)
(setq list^rad '() list__cen '())
; HOLES
(setq nab_cir (ssget "_X" (list (cons 8 "HOLES") (cons 0 "CIRCLE"))))
; , nab_cir
; ( , nil)
(if (null nab_cir)
(progn
(princ "\ HOLES. " ) ;
(princ);
); progn
(progn
(setq i -1 nab_len (sslength nab_cir))
; nab_cir
(repeat nab len
(setq i (1+ i))
;
(setq cirllst (entget (ssname nab_cir i)))
(setq radcir (cdr (assoc 40 cirlist)))
(setq cencir (cdr (assoc 10 cirlist)))

2. AutoLISP

1_91_

; list_rad list_cen
(setq list_rad (append list_rad (list radcir)))
(setq list_cen (append list_cen (list cencir)))
) ; repeat
;
(princ "\: ")
(princ list_rad)
(princ ": ")
(princ list_cen)
); progn
); if
); defun

rci. rci
(, rcl.lsp),
:
(load "rcl.lsp")

, rcl.lsp .
, AutoCAD RCL
, . :
(rcl)

rci:
: (66.0916 29.1292)
: ((179.603 194.961 0.0) (43.0525 184.539 0.0))
((179.603 194.961 0.0) (43.0525 184.539 0.0))

rci
, . , rci
l i s t rad iist_cen.
, ,
.
nil,
rcl, :
(defun rcl ( / nab_cir i nab_len radcir cencir cirlist) ...
, AutoLISP
AutoCAD.
! ( ):
ircl #<SUBR @0id6fib8 RCL> ( ,
, )

192

Visual LISP AutoCAD

AutoCAD !
( ) .

2.16.3.
AutoCAD

, :, .
,
AutoLISP, AutoCAD
( ).
PRITENT 2.15.
I 2.15. PRITENT AutoCAD

(defun c:pritent ( / wn)


(setq wn (entsel " : "))
{if (null wn)
(princ " . ")
(progn
(princ " : ")
(princ (cdr (assoc 0 (entget (car wn)))))
);prong
) ;if
(princ);
)/defun c:pritent

,
(c:pritent),
AutoCAD PRITENT, .
. 2.9 .
,
AutoCAD CM. vl-list-exported-functions (. 2.17.18).

2.16.4. defun-q
defun,

.
(defun-q <> ([<>] [/ <>]) <>)

, " defun.

2. AutoUSP

193

AutoCAD 2000 - [1)11]


^ ^

P-|D|x,
^

pritent
5

;
L 1335283-00000

LWPOI.YLIHE

' - ( 0-1HBi ,|

AJ

. 2.9. AutoCAD,

defun-q , .
defun-q
AutoCAD
.
defun defun-q oursum, . 2.16.2. oursumq, defun-q!
(defun-q oursumq (al a2 / s) (setq s (+ al a2)) (- s a3))

oursum oursumq
load, :

(oursum 15 18 ) 27
(oursumq 15 18 ) 27

oursum oursumq,
:
!oursum #<SUBR @oid6fcdo OURSUM> ( )

! oursumq ( (Al A2 A3 / S) (SETQ S (+ Al A2)) (- S A3))


7

. 155

194

Visual LISP AutoCAD

, .
, , .
:
0

(car oursumq) (Al 2 A3 / S)

(cdr oursumq) ( (SETQ S (+ Al A2)) (- S A3))

oursumq
. ,
oursumq , :

(setq oursumql (list (car oursumq) (cadr oursumq) ' (* s a3))) ( (Al A2 A3 / S) (SETQ S (+ Al A2)) (* S A3))

, oursumqi,
oursumq , (- s A3) (* s A3).
(oursumqi 15 18 6) 198, 27.

2.16.5. defun-q-list-ref
, defun-q ( , ).
(defun-q-list-ref

'<~^>)

,
defun-q.

. m l ,
, , defun-q.
( . 2.16.4):

(defun-q-list-ref 'oursumqi) ( (Al A2 A3 / S)


(SETQ S (+ Al A2)) (* S A3))

(defun-q-list-ref 'oursumq) ( (Al A2 A3 / S)


(SETQ S (+ Al A2)) (- S A3))

(defun-q-list-ref 'oursum) nil

2.16.6. defun-q-list-set
,
defun-q.
(defun-q-list-set ' <^> <>)

2. AutoLISP

75_

: <^> , ; <> ( , , ).
.
:

(defun-q-list-set 'yourf ' ( (w) (sin (+ w w) ) ) ) YOURF

2.16.7. function
Visual LISP (
. viisp-compile 3)
, , lambda, ( , lambda, ).
(function <>)

<> , ,
, lambda.
:

(function (lambda (g) (sqrt (+ g 56.9)))) (quote #<SUBR


@01e27ed8 -lambda->)

2.16.8. vlisp-compile
LISP- .
viisp-compile:
(vlisp-compile '<> <1> [<2>])

:
<> ; st (), ism ( ) isa
( );
;
<1> lsp;
<2> fas.
<> st. .
fas,
, -

196

Visual LISP AutoCAD

( lsp),
fas- .
load.

<2> ,
lsp fas.
, ,
nil, .


Visual LISP (. 3).

2.16.9. exit
().
(exit)

.
:
; : /
(; error: quit / exit abort)

2.16.10. quit
, ,
().
(quit)

. :
; : /

(; error: quit / exit abort)

2.16.11. *error*
, AutoCAD
( ).
(*error* <>)

,
.

2. AutoUSP

197_

, *error*,
( ).
.
( . vi-exit-with-value). *error*
- .
:

(setq oiderror *error*) olderror


*error* #<SUBR @oidl53fc *ERROR*>

(defun *error* (msg) (princ ": ")


(if
(or
(= msg " / ")
(= msg "quit / exit abort")
); or
(princ " ")
(princ msg)
); if
(princ)
); defun

exit :
": "

*error*:
(setq *error* olderror)
. vl-exit-with-error, vl-exit-with-value, vl-catch-allapply, vl-catch-all-error-message vl-catch-all-error-p.

2.16.12. vl-acad-defun
, :,
ObjectARX.
(vl-acad-defun '<>)

AutoLISP.
.
:

(vi-acad~defun ! c:pritent) ,
ObjectARX, : pritent

198

Visual LISP AutoCAD

2.16.13. vl-acad-undefun
, , vi-acad-defun,
.
(vl-acad-undefun '<>)

AutoLISP.
, , n i l
(, ).
:

{vi-acad-undefun r c:pritent) , ObjectARX, crpritent

2.16.14. vl-exit-with-error
VLX-,
, *error*
.
(vl-exit-with-error <"')

.
.
vl-exit-with-error "error*, :
(defun *error* (msg) (princ " . ")
(vl-exit-with-error (strcat " : " msg))
); defun *error*

VLX-
.

2.16.15. vl-exit-with-value
VLX-
, vi-exitwith-vaiue .
(vl-exit-with~vaJue <>)

( ).
VLX-
.

2. AutoLISP

199

(defun *error* (msg) (princ " . ")


(vl-exit-with-value 517))

VLX- 517.

2.16.16. atoms-family

, . . AutoCAD.
AutoLISP,
atoms-family, :
(atoms-family <> [<>])

: <> , 0 1;
<> (, ).

AutoLISP. <> 0, , 1 .
<> , , <>,
.
:

(acad_strisort (atoms-family l))


, acad_strisort

2.16.17. trace
.
(trace [<1> [<2> . . . [<!\|>] ... ] ] )

.
,
. , nil.
Visual LISP, (Trace) (. . 3.4.1).
Visual LISP ,
AutoCAD.

untrace.

200

Visual LISP AutoCAD

( oursum . 2.16.2):

(trace oursum) OURSUM

(oursum l 78) (
AutoCAD):
(OURSUM 1 6 78)
(Entering (OURSUM 1 6 78))
: -71
(Result:-71)

-71
oursum
, , :
D

(+

( o u r s u m 15 3 0)

( o u r s u m 2 56 4)

(oursum 0 1 2 ) )

:
(OURSUM 15 3 0)
: 18
(OURSUM 2 56 4)
: 54
(OURSUM 012)
: -1
71

2.16.18. untrace
(. trace).
(untrace [<1> [<2> ... [<>] ... ]])

.
,
. , nil.
:

(untrace oursum) O U R S U M

2.17. ,
Windows
, ( ,
). . 2.17

2. AutoLISP

201

ARX- ( C++) VLX-. ARX- . VLX- . . 3.4.3.


. 2.17 , .

2.17.1. ver
AutoLISP.
(ver)

( AutoCAD ):
(ver) "Visual LISP 2000 (en)

2.17.2. mem

(. ).
(mem)

nil.
:

(mem) :
; GC calls: 11; GC run time: 36 ms
Dynamic memory segments statistic:
PgSz Used Free FMCL Segs Type
512
14
113
93
1 lisp stacks
334
3 bytecode area
256
431
151
4096
9
4 CONS memory
51
9
1 : :new
32
749 1234 1234
7 DM Str
4096
33
72
14
0
4096
90
6 DMxx memory
0
1 bstack body
128
3
508
508
Segment size: 65536, total used: 23, free: 2
nil

2.17.3. alloc
expand.
(alloc <>)

202

Visual LISP AutoCAD

( ,
, , . .).
( ).
:

(aiioc 120) 256

2.17. expand

AutoLISP ( alioc).
(expand <>)

.
(
AutoLISP).
:

(aiioc loo)
(expand 2) 82

, AutoLISP
200 (, , ) 8200 .

2.17.5.
( ).
()

nil.
,
, . .

2.17.6. vl-registry-read
Windows.
(vl-registry-read <> [<>])


Windows.

2. AutoLISP

203_

() . <> ,
.
:
D

(vl-registry-read "HKEY_C'JRRENT_'JSER\\Control PaneiWColors"


"ButtonLight") "223 223 223"

(vl-registry-read "HKEY _CURRENT_USER\\SOFTWARE\\Autodesk\\AutoCAD


\\R15.0\\ACAD-l:419\\TSM" "ListColumnWidth")
"96,64,56,48,72,240"

2.17.7. vhregistry-write
.
(vl-registry-write <> [<> [<>]])

: <> , <>
, <> ,
.
<>. nil.
,
HKEYJJSERS HKEY_LOCAL_MACHINE.

<> nil, , ( ). <> ,


.
:
n

(vl-registry-write
"1234567890"

"HKEY_CURRENT_USER\\New3"

""

"1234567890")

2.17.8. vl-registry-delete
.
(vl-registry-delete <>

[<>])

: <> , <>
.
, .
nil.
<> nil,
<>.

204

Visual LISP AutoCAD

( v l - r e g i s t r y - d e l e t e "HKEY_CURRENT_USER\\New3") ,

2.17.9. vl-registry-descendents
.
(vl-registry-descendents <> [<>])
: <> ( ); <>
nil.
<> nil, . , .
nil.
:

(vl-registry-descendents "HKEY_LOCAL_MACHINE") (".DWF"


"Security" "Driver" "Config" "Network" "Hardware" "Enum" "System"
"Software")

(vl-registry-descendents "HKEY_CURRENT_USER\\Control PanelWColors")


nil
(vl-registry-descendents "HKEY_CURRENT_USER\\Control PanelWColors" "")
("GradientlnactiveTitle" "GradientActiveTitle"
"HotTrackingColor" "ButtonAlternateFace" "InfoWindow" "InfoText"
"ButtonLight" "ButtonDkShadow" "ButtonHilight" "InactiveTitleText"
"ButtonText" "GrayText" "ButtonShadow" "ButtonFace" "Hi'lightText"
"Hilight" "AppWorkspace" "InactiveBorder" "ActiveBorder" "TitleText"
"WindowText" "MenuText" "WindowFrame" "Window" "Menu" "InactiveTitie"
"ActiveTitle" "Background" "Scrollbar")

2.17.10. arx
ObjectARX (ARX-).
(arx)
.
:

(arx) ("acadapp.arx" "acdim.arx" "aceplotx.arx" "acetutil.arx"


"achapil5.dbx" "achlnkui.arx" "oleaprot.arx" "swfileconv.arx" "vl.arx")

2. AutoUSP

205

2.17.11. arxload
ARX-. .
( a r x l o a d <> [<>])

: <>
( ); <> , () .
, .
, <> ( <> , ,
).
:
(arxload "geomcal.") "geomcal.arx"

(arxload "noarx" (setq na -5)) -5,


. (
, ,
-5)

2.17.12. arxunload
ARX-. .
(arxunload <> [<>])
: <>
( ); <> , ()
.
, .
, <>.
:

(arxunload "geomcal.arx") "geomcal.arx"


(arxunload "noarx" (setq na 22)) 22, .
( , , 22)

206

Visual LISP AutoCAD

2.17.13. autoload
, ( Isp, fas vlx).
(autoload <> <>)

: <> , ;
<> .
nil.
,
, autoload,
AutoCAD ( lead).
: ,
( ).
:
D

(autoload " r a d . f a s "

'("RAC"

"RBC") n i l

RAC,
rad.fas ( ) , ( ):
...
HOLES .

(), .

2.17.14. autoarxload
, ARX-.
(autoarxload <> <>)

: <> ,
ObjectARX; <> .
nil.
autoload, (
arxload).

:
D

(autoarxload " r a d . a r x "

'("RAC"

"RBC") n i l

2. AutoLISP

207

2.17.15. vl-arx-import
VLX-,
( . . 2.17.25 3.4.3), ( ) ObjectARX
ADSRX.
(vl-arx-import

[<>])

<> ( )
,
ARX-.
.
:

(vl-arx-import ' cpritent)


(vl-arx-import "pritent.arx")

2.17.16. vl-doc-export
()
( .
. 2.17.32 3.4.3) VLX-, .
(vl-doc-export

'<>)

VLX-
(. vi-doc-import),
( VLX-).
: .
.
:

(vl-doc-export 'c:pritent) VLX-



:pritent

vl-doc-export defun
(. . 2.16.42.16.7) .

2.17.17. vl-doc-import

VLX- , -

208

Visual LISP AutoCAD

VLX- (. vl-doc-export).
( v l - d o c - i m p o r t <>
['<>]...]])

['<1>

['<2>]

...

: <>
( vlx),
; <1>, <2>, . . . , <> .
.
:
D

(vl-doc-import "makedesign" 'c:pritent 'trlow) VLX makedesign.vlx VLX- c.-pritent,


trlow

vl-doc-import defun
(. . 2.16.42.16.7) .

2.17.18. vHist-exported-functions
.
(vl-list-exported-functions [<>])

( vlx
).
,
<>. nil, . <>
nil, () , , VLX .
:
D

(vi-iist-exported-functions)
, ,
AutoCAD, : ("C:-LMAN"
"C:-LMANMODE" ":-PACK" ":-REDIRMODE" "C.--XLIST" ": 3-"
":3-" ":3-" ":3D" "C:3DARRAY" "C:3M" ":1_"
"C:AI_CIRCTAN" "C:AI_CONE" "C:AI_DIM_TEXTABOVE" "C:AI_DIM_TEXTCENTER"
"C:AI_DIM_TEXTHOME" "C:AI_DISH" "C:AI_DOME" "C:AI_FMS" "C:AI__MESH"
"C:AI_MOLC" "C:AI_PSPACE" "C:AI_PYRAMID" "C:AI_SPHERE"
"C:AI_TILEMODE1" "C:AI_TORUS" "C:AI_WEDGE" "C:ALIGN" "CrARCTEXT"
"C:ATEXT" "C:ATTREDEF" "C:BCOUNT" "C.-BEXTEND" "C:BLOCK?" "CrBTRIM"
"C:BURST" "C.-CAL" "C:CCONFIG" "C:CLIPIT" "C.-DATE" "C: DDEMODES"

2. AutoLISP

209_

"C:DDGRIPS" "C:DDPTYPE" "C:DDRMODES" ":DDSELECT" ":DDVPOINT"


"C:DIMEX" "C-.DIMIM" "C:DWFOUT" "C:EDGE" "C:EXC" "C:EXCP" "C-.EXF"
" C : E X P " "C:EXPRESS" "C:EXPRESSMENU" "C:EXPRESSTOOLS" "C:EXTRIM"
"C:EX'W" "C-.EXWP" " C : FILTER" " C : FULLSCREEN" "C:GATTE" "C:GETSEL"
"C-.GIFIN" "C:GOTOURL" "C:HPCONFIG" "C:LAYCUR" "C:LAYDEL" "C:LAYFRZ"
"C-.LAYISO" "C:IAYLCK" "C:LAYMCH" "C:LAYMRG" " C : LAYOFF" "C:IAYON"
"C-.1AYTHW" "C:LAYULK" "C:LMAN" " : LMANMODE" " C : L S P " "C:MIRROR3D"
"C:MKLTYPE" "C-.MKSHAPE" "C:MOCORO" "C:MPEDIT" "C:MSTRETCH" "C:MVSETUP"
"C:NCOPY" "C:OCECO1SIFIG" "C:PACK" " C : P C X I N " " C : P L J O I N " " C : PLJOINMODE"
"C:QLATTACH" "C:QLATTACHSET" "C:QLDETACHSET" " C : R E D I R " "C-.REDIRMODE"
"C:REVCLOUD" "C:ROTATE3D" " C : R T E D I T " "C:RTEXT" "C:RTEXTAPP"
"C:SCR-DXFOUT-2000" "C:SCR-DXFOUT-R12" "C:SCR-DXFOUT-R13"
"C:SCR-DXFOUT-R14" "C:SCR-SAVEAS-2000" "C:SCR-SAVEAS-R13"
"C:SCR-SAVEAS-R14" "C:SCRIPTPRO" "C:SHOWURLS" " C : S P S C R I P T " " C : S S X "
"C:SUPERHATCH" " C : T E X T F I T " "C:TEXTMASK" "C:TEXTUNMASK" "C:TFRAMES"
" C : T I F F I N " "C:TUTCLEAR" "C-.TUTDEMO" "C:TXT2MTXT" "C:TXTEXP" " C : V L I S P "
"C:WIPEOOT" "C:XDATA" "C:XDLIST" " C : X L I S T " "C:XPLODE" " C : _ 3 D "
"C:_3DARRAY" "C:_ATTREDEF" "C:_DDPTYPE" "C:_DDVPOINT" "C:_EDGE"
" C : _ F I L T E R " "C:_MVSETUP" "C:_XPLODE" ":" "-."
":" ":" ":" ":" ":"
"-." ":")
D

(vl-list-exported-functions "pritent") (":PRITENT")

,
,
AutoCAD ( , , ,
(3D), VLISP, (MVSETUP), EXPRESSTOOLS, , ).

2.17.19. vl-list-loaded-vlx
VLX-, .
(vl-list-loaded-vlx)

,
. VLX- nil.
:

(vi-iist-ioaded-vix) (PRITENT),
VLX- pritent.vlx

2.17.20. vl-vlx-loaded-p
, VLX-,
.
(vl-vix-loaded-p <>)

210

Visual LISP AutoCAD

( vlx
).
,
, nil .
. , pritent.vlx. :

(vi-vix-loaded-p "pritent") , pritent.vlx ,


nil, pritent.vlx (

).

2.17.21. vl-unload-vlx
VLX-, .
(vl-unload-vlx <>)

( vlx
).
, vl-unload-vlx
.
,
.
:

(vi-unioad-vix "pritent")

( ,
), :
; : LISP- pritent
(; error: LISP Application is not found pritent)

2.17.22. vl-get-resource
, VLX-.
(vl-get-resource <">)

,
( txt ).
, VLX-.

2. AutoLISP

211

(vi-get-resource "girls") VLX-


():
" \ ."

2.17.23. vl-vbaload
DVB-.
(vl-vbaload <>)

DVB- (
Visual Basic for Applications).
.
( drawline.dvb AutoCAD 2000
Sample\Vba):

(vl-vbaload

"d:\\AutoCAD2000\\Sample\\Vba\\drawline.dvb")

n i l ( )

2.17.24. vl-vbarun
VBA, .
(vl-vbarun <>)

, .
.
:

(vl-vbaload "d:\\AutoCAD2000\\Sample\\Vba\\drawline.dvb") n i l

(vl-vbarun "drawiine") AutoCAD VBA Line


Sample, . 2.10.
Draw Line
(1,1,0) (5,5,0), Done
"drawiine"
vl-vbarun.

2.17.25. vl-bb-set
.
(vl-bb-set '<> <>)

: <> ; <> , ( ).
.

212

Visual LISP AutoCAD

et Qf Q f 5- if
Jl

Ji

Draws a'Lhe h AutoCAD from 1,1,0 to S,S,0

Qone

\ X 1 ^ 2

"hi

tvl-vbaiun "drawline")
-VEARUH
4484832 295 72.00000

OPTO - [ - [0

. 2.10. AutoCAD VBA Line Sample


(). :
(setq curnumber 19) 19 ( curnumber
)
(vi-bb-set 'bbnmn curnmnber) 19 ( bbnum
)
. vi-bb-ref.

2.17.26. vl-bb-ref
.
(vl-bb-ref

'<>)

( ).
. ,
nil.

2. AutoLISP

213_

( ):

(setq ournum (vi-bb-ref 'bbnum)) 19 ( bbnum


ournum )

2.17.27. W-doc-sef
().
(vl-doc-set '<> <>)
: <> ()
; <> .
.
VLX-, , . vl-doc-set
VLX- , set.
:
a

(setq curiist '(l 2 3)) (1 2 3)


(vl-doc-set 'doclist curiist} (12 3)

. vi-doc-ref.

2.17.28. vl-doc-ref

().
(vl-doc-ref

'<>)

<> () .
.
YLX- .
( ):

(setq I i s t 2 (vl-doc-ref 'doclist}) (1 2 3)

vl-doc-ref vl-docset.

214

Visual LISP AutoCAD

2.17.29. vl-load-all
. 2.2.5 LSP. .
(vl-load-a.ll <>)

LISP-
,
AutoCAD.
.
. ,
AutoCAD , ,
, AutoCAD (. . 1.3).
. .
:

{vi-ioad-aii "nofiie.vix") :
; : LOAD: "nofile.vlx"
(; error: LOAD failed: "nofile.vlx")

. acaddoc.lsp . 2.19.

2.17.30. vl-propagate

,
AutoCAD.
(vl-propagate '<>)

<> () .
.
:

(vi-propagate ' d o d i i s t )
dociiist d o d i i s t
( )


vi-bb-set vi-bb-ref, .

2. AutoLISP

215_

2.17.31.
(). , , ,
.
,
, (. . 2.16.2, 2.16.4).
, ,
.
fkos, 2.16.
: 2.16. , -

(defun fkos (rl ppl / pp2 vo)


(command "_CIRCLE" ppl rl)
(setq vo (entlast))
(initget 1)
(setq pp2 (getpoint " : "))
(command "__COPY" vo "" ppl pp2)
(princ "\ . ")
(princ);
); defun

: rl, ppl, pp2


vo. ,
.
fkos .
, ppl, , rl. vo.
( ) (, )
2, . AutoCAD , 2.
fkos , ( )
, , :
(fkos

55.0

'(0.0

0.0))

fkos ( (0,0), , -

216

Visual LISP AutoCAD

" : "). 55.


AutoCAD ! ( ), ,
(ri, ppi, pp2 vo) nil
( !ri, ippi, !pp2, !vo nil) ,
. , fkos . ,
,
( ).
, , , (). !.
fkos. , :
#<SUBR @01eeee9c FKOSX

, :
(setq mainradius 17.89 mainpoint (list 60.345 12.107))
,
, mainradius mainpoint . :
D

Imainradius 17.89

!mainpoint (60.345 12.107)

,
. ,
:
(fkos (+ mainradius 1.1) mainpoint)
fkos
18.99.
, 2.16, (.
2.17).
2.17. ,

(defun fkosl (rl ppl / pp2)


(command "_CIRCLE" ppl rl)
(setq vo (entlast))

2. AutoLISP

217

(initget 1)
(setq pp2 (getpoint " : "))
(command "_COPY" vo "" ppl pp2)
(princ " . ")
(princ);
); defun

fkosi fkos , vo . . fkosi, vo. nil:


!vo < : 4 002ed68>

, vo, ( ). ,
, .
.

. ,
, , nil.
(. ), .
, , ,

.
.

2.17.32.
, () ( ),
, .
, ,
VLX-, . , , . 3.4.3.
VLX-
, . .
.

218

Visual LISP AutoCAD

, , VLX- ( ) (. vi-doc-import) (.
vl-doc-ref).

VLX- ,
vi-doc-export (
) vi-doc-set (
).
VLX-, ,
( )
, . .

2.17.33.
, ,
AutoLISP . , ,
, AutoCAD (
, AutoCAD (AutoCAD Design Center) . .).
LISP-, , (OPEN),
:
(command "_OPEN") n i l ,

:
(command "_OPEN" "Draw24")
Draw24.
VBA, . :
(command "VBASTMT" "AcadApplication.Documents.Open \"Draw24.dwg\"") yc Draw24, . VBASTMT
Visual Basic for Applications.
AutoCAD SDI. SDI
I, .
SDI
.
().

2. AutoLISP

219_

SDI 0 (
, ).
AutoLISP,
.
.
LISP- (. . lsp, fas vlx) viload-all.

-
, vi-propagate.

(), , vl-propagate.
(blackboard) . - vi-bb-set
- ,
vl-bb-ref.

2.18.
,
.
, 4 7 , , , ,
, ActiveX.

2.18.1. osnap
.
(osnap <> <>)

: <>
; <> ( ) ("_end", "_mid", "_int", "__nea", "_nod" . .).
(
, ).

220

Visual LISP AutoCAD

, nil.
,

APERTURE, .
:

(osnap '(16.32 4.782) "_end,_mid")


,

2.18.2. redraw

, .
(redraw [<> [<>]])

: <> , <> (
. 2.7).
nil.
<> ,
,
(REDRAW). , , .
2.7. redraw

( )

, , ( ),
(
).

2. AutoLISP

221

(redraw el 2) el 6

(redraw el l) el

(redraw el 3) el
(redraw el 4) el

- ,
.
(REGEN) redraw, .

2.18.3. graphscr
AutoCAD ( , ).
(graphscr)

nil.
(GRAPHSCR).

2.18.4. textscr
AutoCAD.
(textscr)

nil.
(TEXTSCR).

2.18.5. textpage
AutoCAD.
(textpage)

nil.
textscr
(TEXTSCR).

2.18.6. grtext
.
(grtext [<> <> [<>]])

: <> ( . ), ; <> -

222

Visual LISP AutoCAD

; <> (
, ).
.
nil.
grtext , .
<> (1 2)
, 0 .
. 2.11 grtext.
<>, 1
, .

MODEMACRO.

. ' ?

~\-

- &
DP
'-' DD
$

I

^ ,

U

A f

J
1
2
3
4
AutoCAD - Drawing
5


isetq 1
7
0
3
9
(grtext i (strcat " " (ltoa i)))(setq i (i+ ) )
(repeat
10
28
11
12
: (grtext
" ") "
13
14
" ")
: (grtext
" "
15
16

17
18
19
20
21
22
23
24

;
26

-1
-2

"ill

(grteHt 2 " ")


" "
|:
|

( - |

. 2 . 1 1 . g r t e x t

2. AutoUSP

223_


<> 2 AutoCAD, (
). (,
<F6>), , grtext , ,
.
SCREEN BOXES
, AutoCAD . 0
. 1. <> grtext 0 max1, max
SCREENBOXES.
. 2.11
( SCREENBOXES 27). 26 , 25 .
< ( -2) , nil.
<>
<> ,
, , . <>
<> , .
<> (
<>; , ). , <>
.
:

(grtext -1 " ") " "

(grtext -2 " ") " "

(grtext 4 " 4") 4 " 4"

(grtext 4 " t t t " 8) 4 n i l

(grtext 4 " t t t " 0) 4 n i l

224

Visual LISP AutoCAD

2.18.7. grdraw
.
. redraw (REDRAW)
(REGEN).
(grdraw <> <> <> [<>])

: <> <>
( ); <> , ( -1
); <> , (0 , ). <> , 0.
nil.
, .
:

(grdraw

'(28.0

15.56)

'(256.12

354.88)

1) -

, ,
nil

2.18.8. grvecs
.
grdraw.
(grvecs <> [<>])

: <> , (. ); <> , ( , nentselp).


nil.
:
([<1>]

<1> <1>

[[<2>]

<2> <2>

...

[[<>]

{'

<> < B N > ] . . . J ] )

<1>, <2>, ..., <> . ,


. , , -

2. AutoLISP

225

. 255, , ,
.
<1>, <1>, <2>, <2>, ... , .
<> (. ,
nentselp).

:
0

( g r v e c s
' (11
(0.0
0 . 0 ) ( 1 0 0 . 0 1 5 0 . 0 ) )

0.0) ( 1 0 0 . 0 50.0)
12
(0.0 0.0) ( 1 0 0 . 0
' ( ( 1 . 0 0 . 0 0 . 0 2 0 . 0 )
(0.0 1.0 0 . 0

100.0)
2 0 . 0 )

13
(0.0
( 0 . 0 0 . 0

l . o .) (. . . 1.0))) ,
20 X
20 Y 11, 12 13;
nil

2.18.9. grclear
. (
).
(grclear)

nil.

2.18.10. grread
(, .).
, get (. . 2.10)
.
(grread [<>] [<> 1<>]])

: <> ( nil) , ; <> (


), (.
); <> , (. ).
.
, ;
, . . .
<> ,
. 2.8, () grread.
8 . 155

226

Visual LISP / AutoCAD


2.8. grread

. , 5,
(X, Y)

, .
,

, <>

,
<Esc>

<> , , : 1 = 1+0+0+0, 3 = 1+2+0+0, 7 = 1+2+4+0 . .


. 2.9 <>, , <> ,
2.
2.9. <> grread

()

. 2.10 , . 4.
2.10. , grread

227

2. AutoUSP

2.10 ()


,


,

,
(
)

0-999
1000-1999
2000-2999,

1
2

16000-16999


16

0-999
1000-1999
2000-2999
3000-3999

8*


BUTTONS1

BUTTONS2

BUTTONS3

BUTTONS4

TABLET1

0-32767

TABLET2

0-32767

TABLET3

0-32767

10

TABLET4

0-32767

11

AUX

0-999
1000-1999
2000-2999
3000-3999

12



( 6
11)

AUX1
AUX2
AUX3
AUX4

228

Visual LISP AutoCAD


grread.

<Esc> grread
AutoLISP ( grread), 8 (. . 2.8).
,
, grread
. grread 12.
.
( 6 11)
12,

grread, :
(setq return2 (grread (setq returnl (grread))))
, r e t u r n l retum2,
.
:

(grread) , , (2 1)
<N> , , (3 (303.147 137.451 .0))

2.18.11. initdia
AutoCAD, LISP, .
(initdia [<>])
<> . 0, ( )
AutoCAD ,
. initdia
, 0, .
nil.

:
(ATTDEF)
()

(BLOCK)
(VIEW)

2. AutoLISP

229_

(INSERT)

(TOOLBAR)

(IMAGE)

(PLOT)

(IMAGEADJUST)

(LAYER)

()

(STYLE)

()

(LINETYPE)

(RENAME)

(COLOR)

:
(command "^INSERT") :
[?]:
(Block name or [?]:)
(INSERT)
initdia, :
(initdia) (command "INSERT")
(Insert).
initdia .
initdia (INSERT) .

2.18.12. tablet
() .
(tablet <> [<1> <2> <> <>])

: <> ( ,
1); <1>, <2> <> (
), ,
; <> ( ), .
. - , -
, , - TABMODE nil.
0 , 1 . 0 .
<> 1, AutoCAD
1.

230

Visual LISP AutoCAD

<>
, AutoCAD ( ).
:

(tablet
0)

(1
(0.000978942 0.00561717 -9.17308)

(0.00561717
( 0 . 0 0 . 0 1.0)

-0.000978942
-7.5171)
(0.0 0.0 1.0))

( t a b l e t 1 ' (1 .) ' (0 1 0 ) ' ( 0 0 1) ' ( 0 1))


,

2.19.

AutoCAD , LISP-
AutoCAD, .

2.19.1. acad.lsp
AutoCAD .
acad2000.lsp
acad.lsp, AutoLISP, .
acad2000.lsp AutoCAD (. 1)
, - . .

acad.lsp. AutoCAD, AutoCAD . acad.lsp AutoCAD (. ]). , AutoCAD,
.
acad.lsp .
acad.lsp ,
.
,
.
,
. 2.18 acad.lsp.

2. AutoLISP
i 2.18. acad.lsp

231
I

(defun fkosl (rl ppl / pp2)


(command "_CIRCLE" ppl rl) (setq vo (entlast))
(initget 1) (setq pp2 (getpoint " : "))
(command "_COPY" vo "" ppl pp2)
(princ "\ . ")(princ);
); defun fkosl
(defun d2r (angdeg /) (* pi (/ angdeg 180.0)))
(setq curname "Design-Ritm")
(setvar "DIMSCALE" 50.0)
(princ " acad.lsp, ")(princ)

acad.lsp (fkosl d2r), AutoLISP,


. curname
DIMSCALE, 50.0.
acad.lsp ,
LSP-, :
(load "d:\\User\\my_designtools.lsp")

acad.lsp , command vi-cmdf,


AutoCAD .

2.19.2. acaddoc.lsp
acad.lsp AutoCAD ( . ), acad2000doc.lsp
acaddoc.lsp ().
acad2000doc.lsp , , . acaddoc.lsp, . .
acaddoc.lsp .
, acad.lsp
( , , ).

.

232

Visual LISP AutoCAD

2.19.3. ACADLSPASDOC
AutoCAD acad.lsp ,
. ACADLSPASDOC.
: 0 ( ) 1. AutoCAD acad.lsp ,
acaddoc.lsp.

2.19.4. sr.startup
AutoCAD ( s : : startup), acad.lsp
acaddoc.lsp, .

Visual LISP
Visual LISP AutoCAD 2000
AutoLISP. . 3.1
Visual LISP AutoCAD (Visual LISP for AutoCAD), , VLISP
( AutoCAD).
VLIDE. AutoLISP, Visual LISP (Visual LISP Editor)
(Tools).
[ Visual LISP AutoCAD <Diawing1_dwg>
. .

QKHO

Visual LISP
_$
_$

I Visual LISP

L 00002 C00Q04

. 3 . 1 . Visual LISP AutoCAD

Visual LISP AutoCAD (Visual LISP for AutoCAD) AutoCAD, -

234

Visual LISP AutoCAD

.
, . 3.1, . 3.2.
14 Visual LISP AutoCAD <Drawrng1 dwg>
. . .

L 00001 00001

. 3.2. Visual LISP AutoCAD

( LISP-, DCL-
, SQL- , )
Visual LISP (Visual LISP Console) ( AutoCAD), (Trace) ( ).

3.1.VisualLISP
Visual LISP : (File),
(Edit), (Search), (View), (Project), (Debug),
(Tools), (Window), (Help).
,
.

3.1.1.
(File) (. 3.3) :
(New File)
(Open File)

235

3. Visual LISP

D (Reopen)

(Save)
(Save As)
(Save All)
(Close)
(Revert)
(Close All)
(Print)
(Print Setup)
(Make Application)
(Load File)
(Exit)
RpogKi
.
..

Ctrl-N
Ctt(-0

.,.

. ^

Ctfl-S
-Alt-S
M-Shift-S

CU1-F4
:

"'

. (Revert) , (Reopen).
(Make Application) . 3.4.3.

,.. ;
C(il-P
...

...

Dtl-Shift-L

Aft-Q

. 3.3.

3.1.2.
(Edit) (. 3.4) :
(Undo)
(Redo)
(Cut)
()
(Paste)
(Delete)
(Select All)

236

Visual LISP AutoCAD

(Parantheses Matching)
G (Extra Commands)
!

, /;; CUE

;1,.:.'

- '.': .:

. :

'; : Del '.'. :VCtilA'; .

ciii- V:
-

>

. 3.4.


(Edit) Windows 95/98.
(Parantheses Matching) :
(Match Forward)
(Match Backward)
(Select Forward)
(Select Backward)
(
) ,
. ,
.

3.1.3.
(Search) (. 3.5) Visual LISP ( , )
:
(Find)
(Replace)
/ (Find/Replace Next)
(Complete Word by Match)
(Complete Word by Apropos)
(Bookmarks)
(First Message)
(Next Message)

237

3. Visual LISP

(Go to Line)
(Go to Last Edited)
:-:;
.:.
...-

-F

' :

cm:

v ::.'-


Orl-Space ;. ...
Ctrl-SHfeSpsce

' '"".. \ I '.


f-.il-.. ';' ;,
; ',: ;

...

'

wp12

' ..:

;..:. ;,; : .:;;

/
:

::

''APPNAME
APPSET
ftPPTYPE

. .6.

w s v . :":;
Otl-SWl-S:

. 3.5.

(
). (Complete Word by
Match) Visual LISP () .
(Complete Word by Apropos) AutoLISP,
(. 3.6).

. ,
/ (Toggle Bookmark), ("Next
Bookmark), (Previous Bookmark),
(Clear All Bookmarks) (Bookmarks).
(Select to Next Bookmark)
(Select to Previous Bookmark)
.

3.1.4.
(View) (. 3.7) LISP-, Visual LISP AutoCAD
(Visual LISP for AutoCAD).
:
(Inspect)
(Trace Stack)

238

Visual LISP AutoCAD

(Error Trace)
(Symbol Service)
(Watch Window)
(Apropos Window)
(Breakpoints Window)
(Output Window)
D LISP (LISP Console)
(Browse Drawing Database)
(Toolbars)
;
...

-; ..

CbfSWt-l.
',

. "' .

Ctrl-Shift-T
Qrl-Shift-R

.:: ;: :,.-'
i1
,.. Ctrl-Shift-A

. 3.7.

(Inspect)
(Inspect), , , , , AutoLISP.
. , (Inspect) . (Inspect) . 3.8, .
J , : LIST
JIM . <&: 14a3dSO>|fO. "CIRCLE"! (330 . <6: 14a3cf8>l(5. "2C"]|lflO. "167.
....,..<,.&:.1.40>]
[ l j ( 0 . "CIRCLE")
[2] (330. < : 14a3c(S>)
5.-2")
[4)1100. "AcDbEntity")
(51(67.0)
[6] (410. "Model")
17](8. "HOLES")
[81(100. MAcDbCcle"J
(91(10179.603174.1180.0)
(10) (40. 11.5871)
[111(2100.00.01.0)

. .8.

239

3. Visual LISP

(Trace Stack) .
(. 3.9).
:
(Refresh) ;
/ (Copy to Trace/Log)
(Trace), , , .
(Trace Stack) - ,

(
): (Inspect), (Print), (Function Symbol), (),
(Local Variables), (Source Position),
(Call Point Source).

1 ,

; TOP COMMAND

HICVLIDE)
<3> :CALLBACK-ENTRY
<4 iRO SUBR

CALLB"CI' EtITR i
[4] 1 ,LIDE|
c
, CAUEACt ENTRY
E "RQ bUBR CMLLE^

. .9.

. 3.10.

(Error Trace) (View) (. 3.10) , .


,

(Error Trace).
, (Trace Stack).
. 3.11 ,
(Show Message), SYNTAX-ERROR.
(Symbol Service) (View)
(. 3.12), ,
(Inspect), AutoLISP.

'

"

"

. 'Xjf^

' .

'

''

. .

-:

"

'

' . .

'

'

'.

'

'

'"

'

-.
'

. 3.11.

240

Visual LISP AutoCAD

:
jusrfiAD

'

,.:;:<
':

'

"

"

. ' .

'

'

'

-:'

'.-'

'

. ' ' - '

"

. .

- '

90111.- BUtS

-._..i_<~.-

"

" egjqae.:.
-"''My 'I

AutoCAD
:0 ; :

. 3.12.

: (Name), (Value) (Flags).


( ),
(Flags) ,
:
(Trace) ;
(Debug on Entry) ;
(Protect Assign)
(, , pi .);
AutoCAD (Export to AutoCAD) AutoCAD,
ObjectARX.
(Symbol Service)
( ):
(Watch)
(Watch);
(Inspect) (Inspect) ;
(Show Definition) ,
;
(Help) Visual LISP ,
.
(Watch Window) (View) (Watch) (. 3.13).
.
(Symbol Service) (
(Watch)), () ( -

241

3. Visual LISP

(Add Watch)), (Watch). :


(Add Watch)
(Clear Window)
(Sort Expressions)
/ (Copy to Trace/Log)
(Apropos Window) (View)
(Apropos) (. 3.14).
| en..

LS
I T ...RAD.;iO..Offl

i
WCMATCH
~

. 3.13.

. 3.14.

AutoCAD ,
, .
. , . 3.14
" ...".

( , ).
( . 3.14 f) (
).
,
,
* #, wcmatch (. . 2.8.8). . 3.15
(Apropos
results) , "F".

Visual LISP AutoCAD

242
I

[
cl L5P(294]

FAS4-FILE
FILE
FILEDIA-SAVE
FILEDIA_OLD
FILENAME
FILLJMAGE
FINDFILE
FITSTR2LEN
FIX
FLAG
FLG
FLOAT
FLT
FMSA
FMSB
FNA
FNAME
FNSPLITL
FORCE
FOREACH
FORMAT
FU
FUN
-,
rl

. 3 . 1 6 .

'

. 3.15.

(Breakpoints Window) (View)


(Breakpoints) (. 3.16), .
(Output Window) <
> (<Builder Ouput>) ,
(. 3.17).
Visual LISP AutoCAD <Dia*ing1.dwg>

#4
(" *

JL.

V *~7 ' * ^ * ^

- >
[FflSDUMPING object format -> "D:/flutoCflD2000/t-cl .fas"]
; Compilation complete.

-iLJ

RO

. 3 . 1 7 . >

L 00008 00001

243

3. Visual LISP

LISP (LISP Console) (View) , Visual LISP (Visual LISP Console) (. 3.18),
Visual LISP AutoCAD. AutoLISP, , . Visual
LISP .
e V i s u a l LISP AutoCAD <Diawing1 dwg>

3
}' '

Visual LISP
; 1 I K e d i t o r 1 D:/flutoCflD2eee/i-cl.LSP">
$ (tcl)
$ (ulisp-conpile 'st " r c l . l s p " )

L 00007 0000

Visual LISP

. 3 . 1 8 . V i s u a l LISP

(Browse Drawing Database)


(View) (Browse All Entities), (Browse
Tables), (Browse Blocks), (Browse Selection) (Inquire Extended Data), (. 3.19).
AUTOCAD

1 <
!;;

...&,!

<LWPQLYUNE> < : 149ed60>


<LINE> < : 149ed68>
<UME> < : H9ed7Q>
<UNE> < : 149ed78>

: 5
USelection set: 6>

< > ....


<> ....
<> ....
<> ....
< > ....
< .>
<>

|0)<UHE> < 149ed68>


AUTOCAD
I1)<LWPQLYUME> < 149ed8C
[2] <C1RCLE> < : 149ed58>
_ _ _
[3] <LINE> < : 149ed78>
i |<5->
[4] <>< : 149ed70>
'

. 3 . 1 9 .

(Toolbars) (View) (Toolbars) (. 3.20), Visual LISP.

Visual LISP AutoCAD

244
|

13)

|
; . |

1 ?
{ f/
: "
!

" i
';

|:'

. 3.20.

( (Standard), (Search), (Tools),


(Debug), (View)), .
(Hide All), (Show All),
(Apply). (Close) (Toolbars).

3.1.5.
(Project) (. 3.21) .
__ LISP- , AutoCAD fas ( ,
FAS-, ). FAS-npu.

,..
^
...
FAS-
'

FAS-
FAS-

. 3 . 2 1 .

(Project) :
(New Project)
(Open Project)
(Close Project)
(Project Properties)
FAS- (Load Project FAS File)
(Load Project Source Files)

245

3. Visual LISP

FAS- (Build Project FAS)


FAS- (Rebuild Project FAS)

..

: /'
:.

'

F8 '.,
Shift-F8

..

'.

'

CSMtf8 ::.

\ ;'

-FS

_ ;;/

(Debug) (. 3.22) Visual


LISP.

ctrt-Q

;.

.,. Dil-W

""

'

' " ' " " " "

"

":

:',""'

. 3.4.2. ()
. .

:"",_""~

6/
;;.:
: . aii-Sbift-F3:;y;
Dt9

;:

".':

'

;
:

'

. 3.22.

:
(Step Into)
(Step Over)
(Step Out)
(Continue)
(Reset to Top Level)
(Quit Current Level)
(Add Watch)
(Watch Last Evaluation)
/ (Toggle Breakpoint)
(Clear All Breakpoints)
(Last Break Source)
(Trace Command)
(Stop Once)
(Break On Error)
(Animate)
D (Abort Evaluation)
. 3.4.1.

246

Visual LISP AutoCAD

3.1.6.
(Tools) (. 3.23) .
Visual LISP Visual LISP (Visual LISP
Console), (Tools) :
AutoCAD (AutoCAD Mode)
(Window Attributes)
(Environment Options)
! (Save Settings)
Qr.no
AutoCAD

CM-Shift-C

. 3 . 2 3 .
( )

BE
".|"----'

;:

AutoUSP

; i S

3 ,: ;/;';'
SQL:
. : '
.

^~1

i
J

. 3 . 2 4 .

AutoCAD (AutoCAD Mode)


Visual LISP (Visual LISP Console)
AutoCAD ( :
(Command:)). AutoCAD
. ,
.
(Window Attributes) :
(Syntax Coloring)
(Configure Current)
(Set Current Window to Prototype)
(Set All Windows to Prototype)
(Fonts)
(Syntax Coloring)
, , , Isp. (Color
Style) ( . 3.24 , DCL-),

3. Visual LISP

247

, . . 3.3.1.
(Configure Current) (Window Attributes) (. 3.25), . .
|

|:WINDOW-TEXT

j j

'.

7
]8
|0

~]

. 3.25.

(Set Current Window to


Prototype) , (Set All Windows to Prototype) .
(Fonts)
(Select Font) (. 3.26) .
I
^:..;

: ;

d .
".; '

' 1 ,: :''*'

. 3.26.

248

Visual LISP AutoCAD

(Environment Options) (Tools)


:
(General Options)
Visual LISP (Visual LISP Format Options)
(Page Setup Options)
(General Options)
(General Options), (General)
(. 3.27) (Diagnostic) (. 3.28),
Visual LISP.

, j )

. . .

.-: :

::

~,

- : -

: & ,
." ,
& / ..
:.;
; - :
\ " ^ . ".
' "
:- SETQ -~
; *

' ..

- - "' '

f
.. :
; &

.-. :

; '

"^

..

ft IACAD

'. ' ' " " -':-';

'. .

. 3 - 2 7 .

'lrj'"''Sr'"Jl .

*
"
ixo-BbieaaPRlNK AutoCAD

;'.

"
^ :

|500

. 3 . 2 8 .

J .

Visual LISP (Visual LISP Format Options) (Format options)

249

3. Visual LISP

(. 3.29), Visual LISP.


|

72

]2

J9

]40


"

*"*
*~
(*
(*?

!?

- ^

*"*

*~"

" 2

. 3 . 2 9 .

(Page Setup Options)


(Environment Options)
(Page Setup) (. 3.30)
Visual LISP.
|


1
"

053

. 3.30.

(Save Settings) (Tools)


Visual LISP ( ,
. .). ,
(DESKTOP)
(General) (General
Options) (. 3.27).

250

Visual LISP AutoCAD

Visual LISP ,
(Tools) (. 3.31) :
(Load Selection)
(Load Text in Editor)
(Check Selection)
(Check Text in Editor)
(Format code in Selection)
(Format code in Editor)
(Interface Tools)
, , . . 3.3.2 3.4.1.
(Interface Tools) :
DCL (Preview DCL in Selection)
DCL (Preview DCL in Editor)
DCL .

.-.'.

. . .

:. Qrt-Shift-E
...1 Ctrl-AH-E "" .

Ctrl-Shift-

Qrl-Alt-C . .

Ctrl-Shift-F .
Ctrl-Alt-F': ;..

'

. 3 . 3 1 .
[ )

. : . - ) _ : ^"._-''..

:.. : > :^:" 1 : ..:."..;>' : ^ ;; -.

" . . V ..:\ .''- ':[.\

.'.; '...;, ;_J-y /.'


' ; ^-/;';:.;.; : ;/;. '
-.;'. ^^'\\- :-;,"\

' ; : ' ; v-y/- .'"': -:'''' ."


. : ^[ '.. .;. ; : .: ;..
.',.;' -'- ;.' " ;. ..'>
AutoCAD
'

~
'
~"~
"""'" : : '.'
~
1
-."' ;; ' '

SKoHcoflbVisualLJSP

.^aceddd." ":;;:/'";-.:'.:: ..': -


',
:
" 4rcl.LSP
"

. 3 . 3 2 .

3.1.7.
(Window) (. 3.32)
Windows.
Visual LISP. AutoCAD

3. Visual LISP

251

(Activate AutoCAD) Visual LISP AutoCAD


(Visual LISP for AutoCAD) AutoCAD (, - ). (Window) , .

3.1.8.
(Help) (. 3.33) .

'

"''

Visual LISP

F1

Q VisualUSP

. 3.33.

3.2.
Visual LISP
Visual LISP :
(Standard)
(Search)
(Tools) (
(Tools), . . 3.2)
(Debug)
(View)
, .
.

3.2.1.
(Standard) (. 3.34)
( ):
(New file)
(Open file)
(Save file)
(Print)
(Cut)
()

252

Visual LISP AutoCAD

(Paste)
(Undo)
(Redo)
(Complete word)
. 3 . 3 4 .

< . *

(Standard) AutoCAD.
(Complete word) (Complete Word by Apropos) (Search), .

3.2.2.
(Search) (. 3.35) , (Search).
Jcar

-, ,

/w

. 3 . 3 5 .

:
(Find)
(Replace)
(Find toolbar string)
/ (Toggle bookmark)
(Next bookmark)
(Previous bookmark)
(Clear all bookmarks)
, , (Search).
(Find toolbar string) , (Search),
, .

3.2.3.
(Tools)
(Tools) (.
(. 3.36)
3.36) \
:
(Load active edit window)

3. Visual LISP

253

(Load selection)
(Check edit window)
(Check selection)
D (Format edit window)
(Format selection)
(Comment block)
(Uncomment block)
(Help)
. , - <), (
*

4. v

~ *"> ?!

. 3 . 3 6 .


(Tools),
(. . 3.31).
(Comment block)
(Uncomment block) ( )
.
(Help) .

3.2.4.
(Debug) (. 3.37) :
(Step into)
(Step over)
(Step out)
(Continue)
(Quit)
(Reset)
/ (Toggle breakpoint)
(Add watch)
(Last break)

if it '&&&

. 3 . 3 7 .

, ,
, ( . 3.37
, ).

254

Visual LISP AutoCAD

, ( ).
. 3.4.1.

3.2.5.
(View) (. 3.38) :
AutoCAD (Activate AutoCAD)
(Select window)
Visual LISP (Visual LISP Console)
(Inspect)
(Trace)
(Symbol service)
(Apropos)
(Watch window)
. 3.38.

, , :
AutoCAD (AutoCAD Mode) (Tools), (Window), LISP (LISP Console) (View), (Inspect) (View), (Trace
Stack) (View), (Symbol Service)
(View), (Apropos Window) (View),
(Watch Window) (View).

3.3. Visual LISP


Visual LISP (New File)
(Open File) (File) , :
LISP- ( lsp);
DCL- ( del);
SQL- ( sql);
C++ ( , ).

,

3. Visual LISP

255

, , , , , . .
.

3.3.1.
Visual LISP
(Window Attributes), (Syntax
Coloring) (Tools) (. 3.24). LISP-.
, LISP, :
AutoLISP ( . .);
, ;
;
( ) ;
;
( .).
. 3.39 LISP, (
).

(Window Attributes),
(Configure Current) (Tools) (. . 3.25).
(Environment Options) (Tools) (.
. 3.1.6)
.

3.3.2.
, Visual LISP,
() . <Shift>
<Left>, <Right>, <Up>,
<Down> Microsoft Word.


(Comment block) (Uncomment block) (Tools).

256

Visual LISP AutoCAD

3 * QKHQ
~- -

--- -

-1||

f '' S*? '

~^ . ,. .'

*** 1. FflRf^UER.DWG, FSRM LEU.DWJ,


**
* * * *

r o H ^ s i m . & w G ,
FOR^SHU.DWG,

raRestin.DWe

FOCKSJHI.DWG,

roc

F0R_SH2K0MG.

****

S H U . O H G ,
~

*** 2 . 11 - . .

uecho 1 ? 4 shlan yn
i s e t q uecho gpf'j<n*
" '
;si?tq aa ->fi-*-d 1 enuacd
<s<*tq a l i s t '

(set'tj g 1 d i dp
Fanii polzoii
Fam2
fan3

. .'sptu ( n
shlan '

* * * *
* * * *

***

'
);

ch > 1 i kr i lang t
^
;
;.|)

fam5
;
Fan6
;
otr
tab1 : tab2 t tab3 tali4 ;
; : Windos (KU?

,1.1 " " " " "


: F:/Pakt15/IVDrfoim.lsp (Visud LISP]

>

L0V001 00001

. 3.39.


(Check Selection) (Check Text in

Editor) (Tools)
(Tools).

(Parentheses Matching)
(Edit).
lsp Visual LISP ( _ls).

3.4.
Visual LISP ,
. LSP- (FAS-)
, . 3.4.2. DCL-
,
(VLX-, . . 3.4.3). . 3.4.1.

3. Visual LISP

257

3.4.1.
Visual LISP (Visual LISP Console) Visual LISP AutoCAD.
AutoLISP,
, Visual LISP AutoCAD.
LISP- ( load AutoLISP), , (Load Text in Editor)
(Tools) (Load active edit window), (Tools).
. 3.40 , Visual LISP .
, (
(Load Selection) (Tools) (Tools)).
Visual LISP (Visual LISP Console)
_$. , , rcl.lsp , ,
(rcl)

Visual LISP , , (. 3.41).


.
.
Visual LISP ( . 3.42
l i s t r a d ) .

Visual LISP
,
AutoCAD (. . 2.1.2).

JKeditor "D:/flutoCflD2eoe/r-cl.LSP">

. 3 . 4 0 . Visual LISP
9 . 155

258

Visual LISP AutoCAD

Visual LISP
_$
; 1 ( e d i t o r "D:/flutoCflD20BB/i-cl.LSP">
L $ O'cl)
HOLES.
J

. 3 . 4 1 . Visual LISP

I S3 Visual LISP
_$
; 1 ( e d i t o r 1 D:/ftutoCHD200e/rcl.LSP">
L $ (rcl)
((323.111 80.71*76 .) (223.09 1711.559 .))
_$ l i s t _ r a d
(79.3076 29.6181)

_$ I

. 3 . 4 2 . Visual LISP

. (Inspect), (Symbol Service), (Watch Window), (View). (. . 3.8, 3.12 3.13)


.
(Trace)
.
(Trace Stack) (Error Trace), (. . 3.9 3.10).

().
/ (Toggle Breakpoint) (Debug)
/ (Toggle breakpoint)
(Debug). ,
, .
(Step Into), (Step Over), (Step Out), (Continue), (Reset to Top Level), -

259

3. Visual LISP

(Quit Current Level) (Debug)


(Debug).
(. . 3.13). ,
, .
(Animation) (Debug) , . . Visual LISP
,
.

3.4.2.
LISP-, ,
. ,

fas. ,
FAS-, .
(Project). (New Project), ... (New Project) (. 3.43).
.
| _ j AutoCAD2000

_J Data Links
_LlDr,
_!E>pie.
_ll Font;
JHelp
' 1 mg
i i allot i

_ll Plot Styles


_J Ploters
1 Sampe
l
L_ll Support
1 Tempa
l te
' 1 Textures

Zl.

_1] Tulonal
*\ icl.pij

VL

. 3.43.
...

.
,
. prj. (Object Properties) (. 3.44).
: (Project Files) (Build Options).
(Look in) LSP- >

260

Visual LISP AutoCAD

. ,
.
, ,
,
(Log filenames and size)

(. 3.45).
I
| |
D /iutoD>D2000

I

_ J

. 3 . 4 4 .

OK

I
! | |
D 12000

Fad
id

1 ]

2}

| / j

. 3 . 4 5 .
OK

261

3. Visual LISP


(), (Up),
(Down), (Bottom). ,
(, , , ).
(Build Options) (Object
Properties) (. 3.46) . , (Merge files mode)" ,
FAS- LSP- (FAS-).
FAS- .
1
j

<**

*"
*"" *


*"*
(*
<"*

Fas-
I
Tmp-

I
I

. 3 . 4 6 .

1 I


(Apply). OK (OK) ,
. . 3.47
newp .

. 3 . 4 7 .

262

Visual LISP AutoCAD


( ):
(Project Properties)
FAS- (Load Project FAS)
(Load Source Files)
FAS- (Build Project FAS)
FAS- (Rebuild Project FAS)

(Project). ,
, .

3.4.3. VLX-
VLX-,
:
LSP-;
DCL- ( .
5);
FAS- ( LISP- );
DVB- (, Visual Basic for Applications);
- ( ).

vlx.
prv, .
(Make Application) (File). :
(New Application Wizard)
(Existing Application Properties)
(Make Application)
(Rebuild Application)

(New Application Wizard),
(Wizard Mode) (. 3.48).
, :
(Simple) (Expert). -

263

3. Visual LISP

LISP- ( FAS-),
DCL-, DVB- .
|

(*



6ya<jr
LlSP-



(. del /

f*

' &

> |

. 3 . 4 8 .

.
(Expert) (Next)
(Application Directory) (. 3.49).
\

- -

;
= .
i ,
: :vlx,
; .prv,
; , . .
] 6\)&&
; .
\ .

...

<

> J

. 3 . 4 9 .

(Application Name) (
(Target File)
vlx), (Application Location)
,
vlx prv (
).
(Browse). (Next) (Application Options) (. 3.50).

264

Visual LISP AutoCAD

|
;

1?, '.
\ ;
:- .
;
;
(.. 6y$ijr
;
;
=

:
f
'. LISP).
]

: :
.
'=
i
\
; LISP.
. .
;

"'

> |

. 3.50.

(Separate Namespace) . , .
, VLX- , .

VLX- ,
vi-doc-export
v l - d o c - s e t .
VLX- (. . 2.17.32).

(Separate Namespace) ActiveX (ActiveX Support) (no


, ).
(. 3.51) LISP- (LISP
Files to Include) lsp ( ), fas ( ) prv ( ), .
(Add) (Remove) . (), (Up),
(Down) (Bottom) LISP- . ( LISP- (LISP source files), LISP- (Compiled LISP files) Visual LISP (Visual LISP project
files)), .
(. 3.52) (Resource Files to Include)
, (. 3.48).

265

3. Visual LISP
| m LISP

LISP-
.
:
! AutoUSP (.Up].
- US
: '(.fas) Visual
LISP (prv),
. .
...

. 3 . 5 1 .
<

>

LISP-

|
:

; ;
\ , Visual
;
: Basic foi Application {.dvb]
; Dialog Control Language [.del]. .;
. ,
| !
:
;
.
:

;.
' '

'

'''- .

|j|ffiy]jfltrffifl!||l

< j | > |

. 3 . 5 2 .

, (
):
LISP- (LISP source files)
LISP- (Compiled LISP files)
Visual LISP (Visual LISP project files)
DCL- (DCL files)
DVB- (DVB files)
(Text files)
DCL- ,
5. DVB- , Visual
Basic for Applications ( ). txt,
.

266

Visual LISP AutoCAD

(Application Compilation
Options) (. 3.53).
\

:
(*

I .
; "

;
; .
.
: .

: .
;
i , ;:
I

i
.
\
: .

< [! >. |

. 3.53.

(Standard)
(Optimize and Link).
, AutoCAD.
, , / (Review Selections/Build Application) (. 3.54).
I /
- ~ :
I
j
.1 i
; . Visual :
LISP 1
; f.PRV).
'
i . ;
j
j
:

:
;
|.
-

.< . |[ |

. 3,54.
/

(Build Application) (Finish), Visual LISP


( vlx) ( prv). (Finish),
PRV-, -

267

3. Visual LISP

. (Make Application) (File).


(Existing Application Properties)
, (Rebuild Application) , - (DCL, LSP- . .).

3.4.4.
Visual LISP
AutoLISP load (Load File) (File).
AutoCAD Visual LISP,
load, AutoLISP, (Load) (Tools) AutoCAD, (Load Application) ,
/ (Load/Unload Applications) (. 3.55).

/
: | _J Acad2000 Eng

1) Data Ln
i k*

1)0 iv
lEvpiet-,
_J Fonts
_IHelp
1 mg
ia
i to
in
_| Po
l t Stye
ls
<1
|


_l Po
l ters
K>
l l Sampel
_J Support
I Tempa
lte

, ;
_ll Textue
is
1
Tutonai
i R14
aci

^acb

[+^ AutoCAD (' atx " l;p ' d\ b," db1 j j


\ | '

(7

l "

ACDIM.ARX
ACEPLOTX....

D:\ACAD2000 ENG\
D:SACAD2000ENG4

. 3.55. /

,
AutoCAD , -

268

Visual LISP AutoCAD

AutoLISP acad.lsp
acaddoc.lsp, :
(load "rcl.vlx")

rcl.vlx (acad.lsp acaddoc.lsp), .


acaddoc.lsp ( AutoCAD ), acad.lsp
AutoCAD. AutoCAD
acad.lsp acaddoc.lsp,
(. . 1.3), AutoCAD,
AutoCAD Windows (. . 1.4).
, ,
, acad.lsp acaddoc.lsp
, :
(rcl)

autoload
(. . 2.17).
. / (Load/Unload Applications), . 3.55, (Startup Suite), . (Contents),
(Startup Suite), . 3.56.
(Add)
, AutoCAD. (Remove)
.
"l!Pj|j|

IJV
.

id-w fas
'fw d fa*

F\PaH15\Fonts\
F\Pakt15\Fonls\

... j

jifii nij;:i!ivb j

. 3 . 5 6 .

AutoCAD, , , ,
. , , .

4.1.
:
mnu ;
nine ;
mnr ( );
mns .
acad.mnu, acad.mnc, acad.mnr
acad.mns, Support AutoCAD 2000.
, AutoCAD
() ,
acad.mnc. acad.mnr, acad.mns.
acad.mnu .
AutoCAD acad.mnc, acad.mnr acad.mns,
acad.mnu, nine, mnr mns. 4 acad.mnu
AutoCAD.
, .

270

Visual LISP AutoCAD

mnc, mnr mns ,


(, acad acad.mnc, acad.mnr acad.mns).
acad
AutoCAD, . , , , . AutoCAD
acad, (, ) Windows. AutoCAD
, , .

4.1.1.
acad, , .
, , . , (.
. 4.1.2), .
(MENU),
(Select Menu File),
. 4.1.

mnc.
(Files of type), :
(*.mnc, .*mns) (Menu Files (*.mnc, *.mns))
(*.mnu) (Menu Template (*.mnu))

, , .
(. . mnu), .
, , .
. 4.2 AutoCAD ,
(, Express).
, , .

271

4.

1.

: | _ j Support
J J Batchplt
_| Legacy
acad
) acad

[acad

: | (".mnc^.mns)

. 4 . 1 .
A AutoCAD 2000 - - IDiawingi]
, Peflat- Qrno

sa I J J * 5

? Q? Q, if ?
|0

J p

d l

!
2

1

1
I 2
'
1
2

DD

0

^ 3 AutoCAD

^'

AutoCAD

./

|
411.5241.58 0391.00000

00| - |

. 4.2. AutoCAD 2000

4.1.2.
,
. , , AutoCAD
ACAD, ( , -

Visual LISP AutoCAD

272

, . 4.2). , mnu ( )
.
(partial)
(MENULOAD) (Customize Menus)
(Tools), (Menu Customization), . 4.3.

: I |

~
...

. 4.3. ,

:
(Menu Groups)
(Menu Bar)

, (,
, ,
. . 4.2.1).
. 4.3 , AutoCAD
acad. (ACAD)
(Menu Groups).

4.

273

(Menu
Customization) acetmain,
(Browse) (Select Menu File) acetmain.mnc,
Express AutoCAD 2000.
(Open),
(Menu Groups) (Menu
Customization), (File Name),
acetmain.nine.
(Load),
(Menu Groups),
EXPRESS. , EXPRESS , (, Express . .4.2.1).
(,
, ),
(Unload)
(Menu Groups).
(MENUUNLOAD),
(MENULOAD), (Menu
Customization),
, .
, FILEDIA 0
( 1).
( ), , ,
( (MENULOAD)) ( (MENUUNLOAD)).
(Replace All)
(Menu Groups) ,
( (MENU)).

4.2.
(, , ) , :
BUTTONS ;
AUX ;
POP ;
TOOLBARS ;

274

Visual LISP AutoCAD

IMAGE ;
SCREEN ;
TABLET ;
HELPSTRINGS ;
ACCELERATORS .
BUTTONS, AUX, POP TABLET (, BUTTONS2, , 12, AUX1), .
***MENUGROUP=, :
***MENUGROUP=EXPRESS

(,
//, ) .

, :
***BUTTONS1
***0
***500
***HELPSTRINGS

( ),
, ,
, .
4 acad.mnu, AutoCAD ( - ACAD).
, ( , ,
. .).
( , . .) AutoCAD . , , EXPRESSTOOLS,
Express, (Modify) (Window) . 4.4.

. 4.2.1 4.2.2.

4.

275

\&AutoCAD20
00 - [Diawnqil
5
D &U

'

''& 0

j j ]

? q,
J |

' '

sf U

?
"

. 4 . 4 . AutoCAD 2000
Express

4.2.1.

(
).

, , (Menu Bar)
(Menu Customization) (. 4.5).

[ 5 ^ ^ ^

:
JACAD
:

MeHjg:

<<

. 4 . 5 . ,

(Menu Bar) . (Menu


Group) ,

276

Visual LISP AutoCAD

(Insert),
(Remove), (Remove All). (Menus) , (Menu
Bar) , ()
AutoCAD.
, . 4.5, ACAD 11 .
(Menu Bar) ,
(Remove). (Insert)
(Remove All) , ,
. ,
, (Menus), , (Menu Bar).
( acetmain,
EXPRESS) Express, (Modify) (Window) ACAD.
(Menu Bar) (Menu Groups) EXPRESS, (Menus) Express, (Menu Bar) (Window) . 4.6.
Jp
|

(EXPRESS
WeHjg: j '.::'

:
|

<< ]

. 4.6. Express

277

4.

(Insert)
(Menu Customization), ,
. 4.4.

4.2.2.

,
: , , , .
, ,
. 4.10.


Web

-2



-2

AutoCAD 2000
: (TOOLBAR),
(Toolbars) (View), a
(Customize)
(. 4.7),
, .
. 4.7.

U
^]
XJ
]
Q
D -2
[X]
:
JACAD

...
j
j

...
...

. 4.8.


(Toolbars), . 4.8.
(Toolbars)

,
(Menu Group). , ,
.
.

(Toolbars) :
(Close) ;
(New) ;

278

Visual LISP AutoCAD

(Delete) ;
(Customize) ( . .);
(Properties) ;
(Help)
(Toolbars).
, (Close), (Delete)
(Help), . (New) (Customize) . 4.10.
(Properties)
(Toolbar properties) (. 4.9).

;
:

""

:' AC4D.TB_0RBIT

. 4 . 9 .

:
D (Name) ;
(Help) .
(Toolbars)
(. . 4.8) (. . 4.7).
12J

< > \/

""

/ ,
,
(. 4.10).
. 4 . 1 0 .

, (Toolbar
Properties), (Apply)
.
, ,
. (docking) AutoCAD.

279

4.

(, ,
. .) . . 4.11 , .

/ ,

/ / - 9
0

CD

0+ cf* ? 65 0 ? "-S

'0 0 0 43

. 4 . 1 1 . ,

(Toolbars) (. . 4.8) :
(Large Buttons) ;
(Show ToolTips) ,
.

4.3. AutoLlSP,

AutoLlSP , : , , . .

4.3.1.
, .
( <>)

.
, ;
nil.
:

( "ACAD") "ACAD"

( "EXPRESS") nil, EXPRESS


280

Visual LISP AutoCAD

4.3.2. menucmd
.
(menucmd <>)
, ,
(. ).
nil.
<> menucmd
, , . . :
"<>=<>"

<> ( <>)
( <>) . <> , . 4.1.
4.1. <>

14

BUTTONS1BUTTONS4

14

AUX1AUX4

16

016

IMAGE

SCREEN

14

TABLET1TABLET4

DIESEL

(, "GACAD.POP1")

(menucmd "P7=*") ,
(
) . 4.12

(menucmd "I=ACAD. image_3D0bjects")


image_3Dobjects ACAD,

(menucmd "i=*")
(. 4.13)

281

4.
1# AutoCAD 20 [Di
Ejjpiess JQKHO Crpaejca

^.; .. * ^. ^ 9 .^ P. . ?. ' ^J i
Ji
.
d

<?

/'

-/


-
Ei f
,/

.-Itg.^xJ

s?:u

.' D 1* & & X ( *? >

/ X

"
N i N \ / ! j( 2 /

[
[

Tejia

rJ
JJLI

' redrawal 1
^menucrad " P 7 3 * " )

_ i d
l i

. 4 . 1 2 . 7

. -' ; - |

. 4 . 1 3 . image_3DObjects

282

Visual LISP AutoCAD

<>
( ) , . 4.2. ,
(. . 4.5).
4.2. <>

#?

I
( )

(. . 4.4)

. DIESEL . 4.14.

4.4.

.
11 ACAD ( acad.mnu 4):
\ 4.1. 11 AutoCAD
***11
**HELP
ID_MnHelp
[&]
ID_Help
[& AutoCAD\tFl] '__help
ID_PlotHelp
[& ](help "acad_plt" +
"Fast_Tr'ack_to_Plotting_Your_First_Drawing")
[--]
ID_Wnew
[& ](help "acad_ug" "whatsnew")
ID_L_acla
[&Learning Assistance](if (findfile "alalink.exe") +
(progn (princ)(startapp "alalink.exe") (princ)) +
(la_support_assistance alert))

4.

283

ID_Support
[. ] (if (findfile +
"asajnain.hlp") (progn (princ)(help (findfile "asa_main.hlp") +

"contents")(princ)) (ai_support_assistance_alert))
ID AcadWeb
[~>Auto&desk ]
A A
ID_ACHomePage
[& AutoCAD] C CjDrowser +
http://kivw,autodesk.com/products/autocad/index.htm
A A
ID_PlugIn
[& AutoCAD] C C_browser +
http://www.cadplugins.com
A A
IDJTechPubs
[[ AutoCAD] C C_browser +
http://www.autodesk.com/techpubs/autocad
A

ID_ADHomePage
[& Autodesk]~C C__browser +
http://www.autodesk.com

ID_ProdSupp
[& Autodesk] browser +
http://www.autodesk.com/support
A A
ID_DevRes
[ & Autodesk] C C_browser +
http://www.argonline.com
ID AUGI
[<-& Autodesk](command +
"_browser" (findfile "augi.htm")) A P
t ]
ID_About
[SO ] '__about

011 AutoCAD (, AutoCAD 2000i).


4.1 ( * * * ) (**HELP), .
.

4.4.1.
4.1 :
<>

[<>]

<> ( , tag), ;
<> , (
, ).
_. (,
). ,
.

284

Visual LISP AutoCAD

& & , <Alt>+<K> .


_1. , ,
.

4.4.2.
:
<>

[<>]<>

<> , _
; <> ,
,
( , );
< , , .
BUTTONS, AUX
IMAGE. SCREEN TABLET ,
AutoCAD .
. , , (). , .
AutoCAD ,
AutoLISP, , , , . . 4.3.
,
(., , . 4.12).
.
, , . 255 .
, , AutoLISP
DIESEL ( DIESEL . . 4.14).
4.3. ,

<Enter>

<Tab>

<Enter>
<Tab>

4.

285

4.3 ()

( AutoLISP DIESEL
<Enter>)

(
)

=*

* ~

(
$ -
. 4.1)
DIESEL ( $ )

AutoCAD

/ (SNAP)

<Ctrl>+<B>
<F9>

<Esc>

<Ctrl>+<D>
<F6>

<Ctrl>+<E>

/ (GRID)

<Ctrl>+<G>
<F7>

<Backspace>

/ (ORTHO)

<Ctrl>+<0>
<F8>

/ -
/ -

/

<Ctrl>+<T>

<Ctrl>+<R> (CM.
. 4.13)

0,

286

Visual LISP AutoCAD

4.1 , .
mjfeip AutoCAD. (\t)
<F1> , <F1>. (HELP). . ,
(. .
).
iDPiotHeip . , <Esc> , ,
.
<Esc>. (, (DIM))
<Esc>. , <Esc>
AutoCAD.
, ( 1 MENUECHO). LISP- (help
"acad^plt" "Fast_Track_to_Plotting_Your__First__Drawing") ,
AutoCAD.
LISP- ( <Enter>), AutoCAD . -.

4.4.3.
\, . 4.2 7
( ) AutoCAD 2000.
I 4.2. 7 acad.mnu
ID_ArcStCeEn
ID__ArcStCeAn
ID_ArcStCeLe

[, , &] arc \_c


[, , &]_ \_ \_
[, , &]_ \_ \_1

4.
ID_ArcStEnAg
ID_ArcStEnDi
ID_ArcStEnRa
ID ArcCeStEn
ID ArcCeStAn
ID_ArcCeStLe

287

[, , &] _ \_ \_

[, , {] __ \_ \_d
A A
[, , ] C C^arc \_e \_
[--]

[, &, ] _ _

[, &, ] _ _ \\_

[, , &] _ _ \\_1

( ) (ARC). .
. \ ,
.
, iDj\rcstceAn , .
(ARC), ( ).
_ ( (Center))
. _ ( (Angle)), (ARC)
. ,
.

4.5.
1 499.
POP
, .
(, 1
ACAD, EXPRESS).
16 .
,
( ).
,
.

4.5.1.

AutoCAD . 4.2.1.

288

Visual LISP AutoCAD

LISP:
(menucmd "P1O+EXPRESS. 1")

, . 4.4, . .
Express ( , 1
EXPRESS) ,
EXPRESS acetmain .
(1) ,
( 4.1, . 4.4, ,
11, HELP). :
(menucmd "PIO+ACAD. HELP")


,
, :
(menucmd "GACAD.POP12-+EXPRESS.1")

1 EXPRESS
, 12 ACAD, , ( , ,
).

4.5.2.

, . 4.2.1, LISP:
(menucmd "10=-")

,
.
, 1
EXPRESS, ,
:
(menucmd "GEXPRESS.1=-")

4.5.3.
, , :
(menucmd "P2=*")

4.

289

,
:
(menucmd "GACAD.POP5=*")

, :
(menucmd "GACAD.FORMAT=*")

(Format),
5 acad.mnu.

4.5.4.
, menucmd,
,
<> , (5, 12, . .),
. 0 . .

(). , ,
, . !.,
.
:
(menucmd " 1 0 . 3 = ! . " )

X Drawing!

. 4.14 ( ).
. 4.14.

4.5.5.
~
(). :
(menucmd "10.2=~")

,
.
(. . 4.5.4) .
AutoCAD
ACAD
.
10

.155

290

Visual LISP AutoCAD

4.5.6.

( ), :
(menucmd " P I 0 . 2 = " )

2 .

4.5.7.
,
. :
(menucind "P1ORITM. 13")

POP 13 RITM.
,
, :
(menucmd "10=12")

AutoCAD, 12 ACAD.
(013, 12) ,
(, 4.1, . 4.4, , 11, HELP).
:
D

(menucmd "PIO^RITM.GENHULL")

(menucnd "Piu-HELP")

4.5.8.

menucmd,
<>. :
(menucmd "P11.1=?")

.
"~", 1 ;
"!", ; "",

291

4.

( ); nil, .
, "-!" "! -" , .
, :
(memiand " P I I . 1 ~=-#?" )

, , :
" 1 1 . 1 - - " " 1 1 . 1 = ! ".

4.5.9.
, .
. 4.15 .
AutoCAD 2000 HE - IDiawingi]
Q
..

F t E ii -

D * U i
gs 5

'

c^t


-,

. , ?

Fa


Hi'i^HugaHHbie .

G
O

I
J
D-,

~k

7';'

a
A

-1 ]

'hi

Ji

:'

. 4 . 1 5 .

4.3 ACAD (
4).

292

Visual LISP AutoCAD


\

: 4.3. acad.mnu

ID MnDisplay [->&]
IDJMnuCSicon

[->& ]

ID_UcsiconOn

[$(if,$(and,$(getvar,ucsicon),1),!.)&]+
A

$M=$(if,$(and,$(getvar,ucsicon),1),"C C_ucsicon _off, " ucsicon


ID_UcsiconOr

on)

[<-$ (if, $ (and, $ (getvar, ucsicon) , 2) , ! . ) ] -t


A

$M=$ (if, $ (and, $ (getvar, ucsicon) , 2) , C" C_ucsicon


ID_MnAttribu

no, C C__ucsicon

or)

[->&]

ID AttdispNo

[$(if,$(eq,$(getvar,attmode),1),!.)&]+

' _ a t t d i s p _n
[ ]
[$ (if ,$ (eq, $ (getvar, attmode) ,2) , ! .) &BK.nJ '_attdisp _on

ID_AttdispOn
ID_AttdispOf
?

[<-$(if,$(eq,$(getvar,attmode),0),!.)&01+

_attdisp _off

ID Textscr
ID__Toolbar

[]
[<-& OKHo\tF2]'_textscr

[&...]AC^C_toolbar

, , . 4.15 .
->. <-. ->,
.
, <-<-. mjrextscr ID MnDisplay, iD_ucsiconOr
ID_MnUCSicon, ID_AttdispOf ID_MnAttribu.

4.5.10.

LISP menucmd,
, $.
, $=*, LISP- (menucmd " = * " ) . $ . 1 = > . (menucmd " = ! . " ) . .

293

4.

4.6.
SCREEN , AutoCAD ,
( ,
).

4.6.1.
AutoCAD .
, (Options) (. . 1.3)
(Display) (Display screen
menu), . 4.16.
j j f

[ j p

Diawingl.dwg

| / | } ] ) ] } \
-. ;
;

- -

i \ [ftp ja"" *~
:
...

"'

""

...

.;

1V

'

'

: 1 .5

! : g p

"" ""

"

"

(*/

V/

"
^ F5"

I*?
!***

^ "

7 .

^ "


-J

'

"~"~ "


(50

- J -

. 4.16. ,

(. 4.17).
() ,
AutoCAD, ,

( ).

294

Visual LISP AutoCAD

1
?
JV AutoCAD 2O0U [Dtawingll 1 :"? S S s i S i ,! ',!':"(=,! j\i -..- ",'..'" ' ' ':'.*-

% % t ^ rj :"-'

&

i i J t f o i o

j | .

ttj =^
^

V IS S i * ' (5, (ft 3

,,

,,

1
2
!
2

1
2

*
0

0;.

&

"

^;

{ 1_7 2

_L

li)

^
^ * UPTU [

. 4 . 1 7 .

^ &

1
2

1
2
1
2

1
2

AutoCAD Express Tools Menu loaded

40.2081, 296.6303. OLOGOO

-|1 - ?

. 4 . 1 8 .

295

4.

, , , , , AutoCAD,

SCREEN BOXES. 27.


, 0.
,
. 4.17, , . 4.18.
(Screen
Menu).
,
. (. 4.19).

D 2

D c=>

!
i ^ _J' -.
1!
n
jrJ 1

Bcia^a . _^- i f- Fa e^t E f[f- If t n


;

S . ' 4

^ ft f

\'1 -irf'OBO

'

-j |

, f

-J |

6]

,
^

AuioCAO

1
2

!
1
J
1
2

1
2

^ A
_ ' >S
DO

rJ

0
bi
:.
/'

423 3214

? i
CJ

*4
(a r

.
1]

< - >

14

> \ f i n a l 7 2_/~

.-J

|<|

_options
'1

54 7j71

. 0.0000

QPTQ- - [ - [0

Zj
J jj

. 4 . 1 9 .

4.6.2.
4.4
acad.mnu ( 4).

296

Visual LISP AutoCAD

\ 4.4. acad.mnu

***SCREEN
**s

[AutoCAD ]ACnCAP(ai_rootmenus)
[* * * * ]$S=ACAD.OSNAP
[
]$ S=ACAD.01_FILE
[]$S=ACAD.02_EDIT
[ 1]$S=ACAD.O3_VIEW1
[ 2]$ S=ACAD.0 4_VIEW2
[]$S=ACAD.05_INSERT

SCREEN (s), . s,
(. . 4.4.2), .
.
. , .
AutoCAD ,
.
, .
, , ,
. 4.4.2. ( AutoCAD) LISP (ai_rootmenu), .
, $s=,
. , (, ACAD.OSNAP).
, AutoCAD ,
.
* * * *, () .
4.5 OSNAP ACAD.
I 4.5. OSNAP acad.mnu
**OSNAP 3
[
]_tt
[]_from
[:]'

-osnap

4.

297

[] endp
[] mid
[ ] i n t
[ l^appint
[]_ext
[] par
[
]
[]_qua
[] tan
[ ] per
[
]_nod
[] ins
[ ]
[ ]_
[..]'

+dsettings 2

, ,
, .
.
3. ,
, ()
, . 1 2 .
,
(, ,
)
(, ).

4.6.3.
, $s= (. 4.4),
monucmd. LISP- (menucmd "S=ACAD.OSNAP"i
OSNAP .
$s= (
),
(, $S=ACAD. ,
ACAD). menucmd.

298

Visual LISP AutoCAD

MFNUCTL, 1,
AutoCAD
,
( ). , ,
(CIRCLE)
CIRCLE ( 4.6).
: 4.6. CIRCLE acad.mnu

**CIRCLE 3
[:

] " 4 ^ circle

] \\

, ]\_d
[2 L..2P \
? ]..3 \\

[Kf
[ V.
t

] tt
1 JP

tan \ tan

[ :]~ circierad ' '":a.l '"ad;

0, .

4.6.4.
. ,
,
,
,
10 ( 0 9) ,
(, , . .).
(
)
,
. , , AutoCAD
<Enter>, .
:.

4.

299_

<Backspace>, <Enter> ( ).
. , , 4.7.
i 4.7.

**NUMBERS 3
[-]-
[0]0

[2]2
[3]3
[4]4
[6]6
[7]7
[8]8
[]
[]


(, 15-2339-012), <Enter> ,
Enter.

4.7.
(. . 4.13) (. . 1.7). IMAGE. ,
, .

4.7.1.
, AutoCAD, . IMAGE ,
:
[<>] <>
;

300

Visual LISP AutoCAD

[<>,<>] <> , <> ;


[<>(<>) ] <>, <>;
[<>(<>,<>) ]
, <> ;
[<>] (<> );
[ <>] (
, <> ); .
<> sld,
<> sib, .
<>
<> .
, , , . 4.8
imagevporti ACAD.
| 4.8. image_vporti acad.mnu
**image vporti
[: ]
[acad(vport-l,OflHH )](ai_tiledvp 1 nil)
[acad(vport-3v, : )](ai_tiledvp 3 "_V")
[acad(vport-3h, : )](ai_tiledvp 3 "_")
acad(vport-4, : )](ai_tiledvp 4 nil)
[acad (vport-2v, : ) ]/^C/vC(ai_tiledvp 2 "_V")
[acad (vport-3r, : ) ] (ai_t.iledvp 3 "_R")
[acad(vport-31, : )](ai_tiledvp 3 "_L")
[acad(vport-41, : )](ai_tiledvp 4 "_L")
[acad(vport-2h, : )](ai_tiledvp 2 "_")
[acad(vport-, : )](ai^tiledvp 3 "_")
[acad(vport-3b, : )]"(ai_tiledvp 3 "_")
[acad(vport-4r..: )](ai_tiledvp 4 "_R")

, ,
, , . . 4.20 .

301

4.
:
.
:
;
. 1
:
'.
:
:
63:
:

C H H 3

=1
=

. 4 . 2 0 . image_vporti

4.7.2.
:
, .
IMAGEVPORTI :

$1=IMAGE_VPORTI $I=*

AutoLISP:
(menucmd "I=IMAGE_VPORTI")
(menucmd "!=*)

4.8.
( BUTTONS 14) ( AUX 14) .
.
() AUX, a
() BUTTONS .
4
AUX BUTTONS. AUX
:
AUX1 - <RightButton>;

302

Visual LISP AutoCAD

AUX2 <Shift>+<RightButton>;

AUX3 <Cirl>+<RightButton>;
AUX4 <Sliift>+<Ctrl>+<RiglitButton>.

4.9.
TABLET
1 4.
. , 32 766 .
(TABLET).
. 4 : TABLETI 9 15 , TABLET2
9 11 .

(,

TABLET2STD) (, **-2).

+1

, (1, -2, ), (-1, -2, ) . .


, . .
.
, ,
, . 4.4.2.

4.10.
TOOLBARS ,
.

4.10.1.

(Customize) (Toolbars), . 4.8.
(Customize Toolbars).
. 4.21 (Toolbars) (Customize Toolbars). , , (Customize Toolbars) ( , ),
. (

303

4.

(Customize Toolbars)) .

D
'-? t

^ | < or. ^ -

D&
: ^ | J J & & 0

3 \

3 |

I >

_\ |

: *-*


Q
Q

-2

-V

- V/

-^

'

>- *
<* 1.4 ^

14

[
[

"

\\ ['\ 2 /

"ill

__toolbar

760977 26.57,0.0000

0-| : |

. 4 . 2 1 .

. 4.2.2.
(Toolbars)
.
(Button Properties), . 4.22.
(Name)
, (Help)
, ,
(Macro) , .
(Button Icon)
(Button Properties) .
(Edit) , . 4.10.4.

Visual LISP AutoCAD

304
O
D tS-

Q
^ j [

_] j

/ A

"

(
|

i4\X12/

iiJ

^.t oolbar

. 4.22.

,
, (Flyout Properties) (. 4.23).

:
: | " "

AD43.
.
ACAD.

. 4.23.

,
. 4.22. ,
,
(. . 4.10.3).

4.

305

4.10.2.

(New) (Customize Toolbars).

(New Toolbar),
. 4.24.
:

JAIIAD

"

. 4 . 2 4 .

, ,
(, " I").
(. 4.25),
.
, , . 4.10.1,
, . . 1
. 4.26.

. 4 . 2 5 .

[SM 2? ! <> >5>

- 4 . 2 6 .

(Customize Toolbars)
, ,
AutoCAD .

4.10.3.
TOOLBARS
AutoCAD, 4.9.
; 4.9. TOOLBARS acad.mnu
**_OBJECT^PROPERTIES
IDJTbObjectP [JToolbar(" ", __, _Show, 0, 1, 1)]
ID Ai_molc
[_Button(" ", ICON_16_MOLC,
ICON_16_MOLC) ]AC'4C_ai_molc
ID_Layer
[_Button("", IC0N_16_LAYERS, ICON_16 LAYERS)]'_layer
ID_CtrlLayer

[]
[^Control(_Layer)]

306

Visual LISP AutoCAD

ID_CtrlColor

[]
[_Control(_Color)]

ID_CtrlLinet

[--]
[Control(_Linetype)]

[]
ID_CtrlLineW [_Control (__Lineweight) ]
[ ]
lD_CtrlPStyl [^Control(_PlotStyle)]

, , ,
. ,
, , _. _.
, , .
, , :
[ Toolbar(<3>, <>, <>, <>, <>, <>)]

<> , ,
.
<>
, , :

Floating ;

Bottom ;

Left ;

Right .

<> ( ):

Hide ;

show .

<> <> , , , ,
.
, AutoCAD.
<> ,
.
, 4.9,
.

4.

307

,
. , ,
:
[_Button(<>, <-16>, <-24>)]

<>
.
<-1>, <-24>
BMP-,
( (Large Buttons) (Toolbars)). 16x15 , 24x22
. BMP-, ,
AutoCAD (. . 1.3). BMP-
, AutoCAD .
, 4.9,
" ", BMP-
icon_16_molc.bmp.
, , .
.
, .
, 4.9,
, :
[^Control(<>)]

<>
:

color ;

Dimstyle ;

_Layer ",
_ L i n e t y p e ;
_Lineweight ;

_piotstyie ;

Refbikname ;

_ ;
_view .;

viewportscaie .

308

Visual LISP AutoCAD

: , , , .
,
.
,
. , .
.
4.10 AutoCAD,
(
TB_STANDARD, ).
\ 4.10. TOOLBARS acad.mnu

IDJTbOsnap
[__Flyout (" ", ICON_16_OSNAP, ICON_16_OSNAP,
__0therlcon, ACAD.TB_OBJECT_SNAP)]
IDJTbUcs
[_Flyout("", ICON_16_UCS, ICON_16_UCS, _OtherIcon,
ACAD.TBJJCS)]
IDJTblnquiry [_Flyout("", ICON_16_LIST, ICON_16_LIST, Otherlcon,
ACAD.TB_INQUIRY)]

, ,
:
[_Flyout(<>, <-16>, <-24>, <>,
<>)]
<>, <-16> <-24>

, . <> :

Ownicon ;

othericon .

<> , , ( ,
). ,
4.10,
TB_OBJECT_SNAP, ACAD.TB UCS, ACAD.TBJNQUIRY.

4.10.4.
(, Paint,
Windows). -

309

4.

, AutoCAD 2000,
(Edit) (Button
Properties) (. . 4.22). . 4.27.

v V

j j |

. 4.27.

(Buttons Editor) . ( , , , ). ,
.
(Buttons Editor) . (Grid) . (Clear) ,
. (Open)
-.
(Undo), (Save As),
(Save), (Close), (Help) .
,
.

4.11.
,
(,
).

310

Visual LISP AutoCAD

4.11.1.
, 500,
501 ,
500 999. <Shift> ( AUX2 .
. 4.8), <Shift>.
. ( ).
AutoCAD.
4 500 ( GRIPS),
501 (CMDEFAULT), POP502 (CMEDIT), POP503 (CMCOMMAND),
504 (OBJECTS_DIMENSION), POP505 (OBJECT_VIEWPORT), POP508
(OBJECT_TEXT).

4.11.2.

GRIPS ,
, (. .
).
CM DEFAULT , ,
AutoCAD.
,
, CMEDIT. , .
,

OBJECT_.
,
.
O B J E C T S .

,
).
, OBJECT__TEXT,

OBJECT_LINE, OBJECTS_DIMENSION . .


. 4.28 ,

LWPOLYLINE.

.
,

. 4 . 2 8 .

4.

311

CM EDIT
OBJECTLWPOLYLINE.
.
AutoCAD
_ OBJECTS,:
OBJECTS_DIMENSION
OBJECT_VIEWPORT
OBJECTS_XREF
OBJECT_MTEXT
OBJECT TEXT
OBJECT_HATCH
OBJECT_LWPOLYLINE
OBJECTSPLINE
AutoCAD 2000i OBJECT POLYLINE.
AutoCAD 2000 IDiawmsl]
^ EKptess

D & H 3 J . . 85, *i ^ -' w

I- - - *
/>

Jt-

J5

~ j f l I x|

Ci* Q, f I? f ?
I J

J I
Enter

2 1

D
a

jI

, tt, = < S3 &

4<

0
h:

/ \\
//
\
/
\\

/
ffi +

'J] '

4> -i
tj

XX
11"11
IS r Inz3>
A /'
:

,1]

. 4 . 2 9 .

CMCOMMAND ,
, AutoCAD , -

312

Visual LISP AutoCAD

.
,
/. . 4.29 , (PEDIT).
CMCOMMAND
, ,
COMMAND_, .
, , ABCD
COMMAND_ABCD , , .


.

4.12. HELPSTRINGS
, ,
HELPSTRINGS. :
<>[<>]

( ,
).
'/ HELPSTRINGS
AutoCAD. 4. ( ).
I 4.11. HELPSTRINGS acad.mnu

ID_Line
[ : ]
ID_Linetype [, : ]
ID Linewt
[ ,
: ]
ID_Links
[, OLE-: ]
ID_List
[ : ]
ID__TbLayouts [ ""]
ID_LayNew
[
: - ]
ID_TbVpCreat [ " "]
ID^VpDialog [ : ]

,
.

4.

313

4.13. ACCELERATORS
ACCELERATORS ,
AutoCAD, , <>+<> ( . . 4.4.1).

. :
<>[<>]

<> ,
<&> (
, CONTROL, ALT, SHIFT, INSERT,
DELETE, ESCAPE, UP, DOWN, LEFT, RIGHT).
:
D

ID_Copyclip

[CONTROL+"C"]

ID__Save

[CONTROL+"S"]

IJJPasteclip [CONTROLVV"]

IDJ/BAIDE

[ALT+"F11"]

:
[<>]<>

, , . :
[CONTROL+"L"j0

fCOMTROL+"R"]AV

\, , , , .
, , <F3><F11> AutoCAD . , <F1> , <F2>
, Windows (ALT+<F4>, <Ctrl>+<Esc>,
<Ctrl>+<Shift>+<Esc> .).

"NUMPADO", "NUMPADl", ..., "NUMPAD9".

()

314

Visual LISP AutoCAD

4.14. DIESEL
DIESEL (Direct Inteipretively Evaluated String Expression Language)
. , , (, ).
DIESEL
MODEMACRO .

4.14.1.
DIESEL (
):
$(<>[,<1>[,<2> ... [,<9>] ... ]])

<> , <>, <2>, ..., <9> . (


).
, DIESEL, .
. DIESEL ,
. , , .
DIESEL.
DIESEL , , AutoLISP, .

4.14.2.
DIESEL 28 : +, -, *, /, =, <, >, !=, <=, >=, and, angtos, edtime,
eq, eval, fix, getenv, getvar, if, index, linelen, nth, or, rtos, strlen, substr,
upper, xor.
, DIESEL
AutoLISP, (
, ).
DIESEL 16.
DIESEL MODEMACRO, , .
(setvar "MODEMACRO" (strcat " : " "$(getvar,cecolor)"))

4.

315

"$ (getvar,cecolor)" , DIESEL


( , CECOLOR
). ,
(getvar "CECOLOR") AutoLISP.
, , AutoLISP:
(setvar "MODEMACRO" (strcat " : " (getvar "CECOLOR")))

, (
DIESEL) ,
(!).

(, ,
. .). USERS1, USERS2, USERS3, USERS4, USERS5,
(
MODEMACRO, ).

4.14.3.
DIESEL , . 4.4.
4.4. DIESEL

$?

(, )

$ (<>, ??)

<>

$(<>)??

$ (-*-+)

4.14.4.
DIESEL , ( ).
4.3 DIESEL . DIESEL
!., (
. 4.5.4). '

316

Visual LISP AutoCAD

4.12 DIESEL
( ).
4.12. TOOLBARS ( TB_REFERENCE)
acad.mnu
ID Xclipfram [ Button(" ",
ICON_16_XCLIPFRAME,ICON_16 XCLTPFRAME)]$=$(if,$(eq,$(getvar,xclipframe),
f ra:ne 1)

,
(Reference), , $, DIESEL
( . 4.4.2).

$ ( i f , $ (eq, $ ( g e t v a r , x c l i p f r a m e ) ,1) , _ x c l i p f r a m e _0, __

xclipframe i)

XCLIPFRAME,
. 1, __xciipframe _, 0 xdipf 1 (
_XCLIPFRAME
XCLIPFRAME). AutoCAD XCLIPFRAME _0 _ 1 .
, 0 1
( ).

4.14.5. DIESEL AutoLISP


DIESEL ,
AutoLISP. ( MODEMACRO) . 4.14.2. .
-, DIESEL , AutoLISP
(edtime, linelen). -, menucmd DIESEL.
, DIESEL , AutoLISP, .

4.15. MNL-

AutoCAD MNL- ,
. , acad.mnu (

4.

317

acad.mnc, acad.mns, acad.mnr) acad.mnl,


AutoLISP. 4.13
acad.mnl AutoCAD 2000.
i 4.13. acad.mnl
;;;
;;;

AutoLISP routines used by the AutoCAD Standard Menu.


This file is loaded automatically following the menu ACAD.

(princ "NnAutoCAD menu utilities ")


...^_,= j c o n Functions ===
;;;

lew -> Layout -> Tiled Viewports...

(defun ai tiledvp_chk (new)


(setq m:err 'error* 'error* *merrmsg*)
(if (= (getvar "TILEMODE") 0)
(progn
(princ "\n** Command not allowed in a Layout **")
{princ)
(progn
(if new
(menucmd "I=ACAD.IMAGE VPORTI")
(menucmd "I=IMAGE_VPORTI")
)
(menucmd "I*")

(setq *error* m:err m:err nil)


(princ)

(defun ai_tiledvp (num ori / ai_tiles_g ai_tiles_cmde)


(setq m:err "error* *error* *merrrasg*
ai_tiles_cmde (getvar "CMDECHO")
ai_tiles_g (getvar "GRIDMODE")
)
(ai. undo_push)
(setvar "CMDECHO" 0)
(setvar "GRIDMODE" 0)
fcond ((= num 1)
(command " .VPORTS" " SI")

318

Visual LISP AutoCAD


(setvar "GRIDMODE" ai_tiles_g)
)
((< num 4)
(command " .VPORTS" " SI")
(command. "_.VPORTS" num ori)
(setvar "GRIDMODE" ai_tiles_g)
)
((

=
- ori nil)
(command "_.VPORTS" "_SI")
(command "_.VPORTS" num)
fsetvar "GRIDMODE" ai_tiles_g)

(command "_.VPORTS" "_SI")


(command " .VPORTS" "2" "")
(setvar "CVPORT" (car (cadr (vports))))
{command " .VPORTS" "2" "")
(command "_.VPORTS" "_J" "" (car (cadr (vports))))
(setvar "CVPORT" (car (cadr (vports))))
(command " .VPORTS" "3" " H")
(setvar "GRIDMODE" ai_tiles g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRJDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
)
(T
(command "_.VPORTS" "_SI")
(command "_.VPORTS" "2" "")
(command "_.VPORTS" "2" "")
(setvar "CVPORT" (car (caddr (vports))))
(command "_.VPORTS" " J" "" (car (caddr (vports))))
(setvar "CVPORT" (car (cadr (vports))))
(command "_.VPORTS" "3" "__H")
(setvar "GRIDMODE" ai tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai tiles jg)

4.

319

(a i_undo_pop)
(setq *error* m:err m:err nil)
(setvar "CMDECHO" ai_tiles_cmde)
(princ)

, ,
AutoLISP ( acaddoc.lsp, ).
, (, mynew.mnu),
mynew.mnl, LISP LISP-.
, , .


AutoCAD
,
, . , AutoLISP C++,
DCL- ( del).
VLX- DCL-
, VLX- (. . 3.4.3).
acad.dcl, ase.dcl, base.del,
ddptype.dcl, ddvpoint.dd, doshelp.dcl, filter.dcl, rendcomm.dcl, render.dcl,
viewslid.dcl, Support AutoCAD 2000. ,
.
base.del,
(, ,
., ).

5.1. DCL
DCL (Dialog Control
Language), .

5.1.1.
, DCL, , .
. -

5.

321

. . .
, DCL, ,
load_dialog (. . 5.2.1).
( ,
, , ). (, , )
. ( ). , (
, , , ), ,
. .
DCL ,
, , ,
. ,
( ),
.
. :
[<>]:<>{<>}


. .
:
Uzel:edit_box{11=" :";edit_width=40;value="";key="um";}

:
<>;

:
ok_cgmcel_help_info;

<> (
).
,
. uzel.
ok_cancei_heip_info ( ),
base.dcl.
1 1 . 155

322

Visual LISP AutoCAD

<> ,
, ,
.
(

<> , . AutoCAD
,
.. : i m : o p e r l : o p e r 2 { l a b e l = " D o u b l e " ; } .
ran , a o p e r l 2 . , o p e r l
2, , .


<> edit_box, .
, <>
( , ).
<> , :
<1>=<1>;[<2>=<2>;
[ ... <>=<>]...]


. ( ).
,
.
. 5.1 ,
( ),
"" "-" .
5.1 paktinfo.dcl, , . 5.1.
; 5.1. paktinfo.dcl
pakt: dialog{11=" , 1994-2000 ..";key="pin";width=50;
children_alignment=centered;
:text{label="KB \"\" ( )";key="tl";}

323

5.
:image{key="dl";width=23;height=7;fixed_width=true;
color=graphics_background;}
:text{label="Pa3pa6oT4HKH: ";key="t2"; }
:text{label="IIonemyK H.H., .., ..";key="t3";}
:text{label="Ten. (812) 186-16-60";key="t4";}
:textflabel="E-mail: poleshchukSpeterlink.ru";key="t5";}
:ok_button{label="";fixed_width=true;is_cancel=true;}

. 1994-2000 r.r.
"" [!

'.': ' -' :.:::';:::"::::'.:.'

... .., .*
. 1812) 166-16-60 ; ; : : ^ : ;

. 5 . 1 .

11 . , pakt ( ).
, . . . 5.1.2.
, , (
), ,
text image ( 3, 4, 6, 7, 8, 9). .
( 45), ( 3,
6, 7, 8, 9).
10 ok_button,
base.dcl ( ).
label .

, ,
.
. 5.3.

324

Visual LISP AutoCAD

DCL-
DCL-, :
@include "fourth-b.dcl"

DCL-
fourth-b.dcl ( , , AutoCAD
.
. 1.3).
@include acad.dcl
AutoCAD.
@include , ,
.
//, AutoCAD
, .
DCL- Visual LISP (. . 3.3).

5.1.2.
,
. , ,

AutoCAD.
dialog :
<>:dialog{<_> <>}

<>
(), , .
AutoCAD ,
.
<_>
:
<> = <>;

<> (. . ,
, , ).

. . 5.1 ,
.

325

5.

5.1.

label

value

key

width

height

i n i t i a l focus

children alignment

l e f t , right,

l e f t (
);
centered
( )

c e n t e r e d (
); t o p ,
bottom, c e n t e r e d

()

( )
children f i x e d width

true, false

false

children f i x e d hight

true, false

false

, .
label value -
. .
,
AutoCAD . , .

, .
, label,

326

Visual LISP AutoCAD

, , .
value .
value, ,
label. value ,
label, .
value ,
label, ,
, , ,
.
, set_tiie (. . 5.4.3).
key, ( , key
, ).
( .
, . 5.1.1).
width , AutoCAD
. , , ,
width. , , .
height width, , .
initiai_focus , <Enter>.
chiidren_ ,
( ) .
chiidrenaiignment , AutoCAD
, . (), , , , . 5.1,
chiidren_aiignment :
left ( );
right ( );
centered ( ).

5.

327

, (. .
children_alignment ), left.
(), :
top ( );
bottom ( );
centered ( ).
centered.
, (alignment),
chiidren_aiignment .
children__fixed_width children_fixed_height ,

true,
(, ) , , .
Visual LISP,

DCL- . (Interface Tools) (Tools)
Visual LISP (. . 3.1.6).
(Interface Tools) :
DCL (Preview DCL in Selection)
DCL (Preview DCL in Editor)
, DCL , , , .
AutoCAD
(Enter the dialog name), . 5.2.
. AutoCAD .
1,

QK

. 5.2.

328

Visual LISP AutoCAD

5.2.

, DCL-, , .
, DCL- (load_dialog, unload_dialog),
.

5.2.1. loadjdlalog
DCL- .
(load_dialog <>)

<> DCL-.
(,
;
).
, AutoCAD

(. . 1.3).
:

(ioad_diaiog "paktinfo.dcl") -1 (
) 5 ( DCL-
AutoCAD)

DCL-
unload_dialog.

5.2.2. unload_dialog
DCL- .
(unload_dialog <>)

<>
DCL- (
load__dialog).

nil.
DCL-
, .

5.

329

( . 5.2.1):
D

(unload_dialog 5) nil

5.2.3. new_dialog
, DCL-.
(new__dialog <> <> [<> [<>]])

: <> ; <> DCL- ; <> LISP-,


( LISP- ,
" " ) ; <> ,

( (0,0);
1
(-1 -1), ,
).
, , nil
.
<>
, <>.
AutoCAD LISP-, <>,
,
( action__tiie LISP-
action DCL-). action_tiie . . 5.4.1,
action . 5.3.1.
:

(new_dialog "pakt" dcl_id "" ( l i s t 222 114)) pakt,


(222,114),

5.2.4. start_dialog
AutoCAD .
(start_dialog)

,
done_diaiog ( . . 5.2.5).
, donedialog
, s t a r t d i a i o g : 1,
; ,

330

Visual LISP AutoCAD

(Cancel).
, start_diaiog -1,
term_dialog.

5.2.5. done_dialog
, start_diaiog.
(done_dialog <>)

<> , start'_diaiog (. . 5.2.4).


.
:
(done_diaiog 92) , , (229 160),
s t a r t _ d i a l o g 92

("

d o n e d i a l o g LISP-
action__tile action.

5.2.6. term_dialog
,
(Cancel).
(term_dialog)

nil.
- ,
, AutoCAD term_dialog.

5.2.7.
,
, . 5.1, ,
. 5.2.
| 5.2. p a k t i n f o ,
(defun paktinfo ( / dcl_id)
(if (< (setq dcl_id (load_dialog "paktinfo.del")) 0)(exit))

5.

331

(if (not (new_dialog "pakt" dcl__id) ) (exit) )


(start_dialog)
(unload_dialog dcl_id)
(princ)

, DCL- paktinfo.dcl,
5.1.
d c l i d ,
.
paktinfo.dcl
(. . dci_id
, load_diaiog),
exit, .
, DCL-
pakt. ,
exit.
start_dialog
.
done_dialog,
.
okbutton ,
done_dialog.
unioad_diaiog DCL- , princ (. . ).

5.3.
.
(, . .),
(, . .,
).
.
AutoCAD 2000 .
:
;
, ;

332

Visual LISP AutoCAD

;
;
.
. , .

5.3.1.
. 5.2 ,
.
5.2.

,
AutoLISP

"" (
)

alignment

l e f t , right,
centered;
top, bottom,
centered

left,
centered

allow accept

<Enter>

true, f a l s e

false

aspect r a t i o


( 0.0,
)

image

big
increment

slider

0.1
max value
min value

children
alignment

left, right,
centered ();

row, column,
boxed row,
boxed column

left
();
centered
()

action

top, bottom,
centered ()

333

5.

5.2 ()

true, false

row, column,
boxed_row,
boxed column

false

children_
fixed width

true, false

row, column,
boxed_row,
boxed column

false

color

0-256
image
dialog_line,
dialog_foreground,
dialog_background,
graphics_background,
black, red, yellow,
green, cyan, blue,
magenta,
whitegraphics_
foreground

edit limit


(
)


( 256)

edit box

132

edit width


( )

edit box

fixed height

true, false

false

fixed width

true, false

false

fixed width
font

true, false

list box,
popup list

false

height

children_
fixed_height

334

Visual LISP AutoCAD


5.2 ()

0 6

is bold

true, false

false

is cancel


<Esc>

true, false

button (


true)

false

is default


<Enter>

true, false

b u t t o n (


true)

false

is enabled

true, false

true

is tab stop



<>

true, false

true

key

label

"" (
)

layout

horizontal, v e r t i c a l

slider

horizontal

list


( \)

l i s t box,
popup l i s t

max value


( 32 767)

slider

10000

initial
focus

"

335

5.

5.2 ()

mm value


( -32 768
max value)

slider

mnemonic

multiple
select

true, f a l s e

l i s t box

false

password
char

e d i t box

small
increment

slider

0.01
max_value
min_value

tabs

(,
"8 16 24 32")

l i s t box,
popup l i s t

tab truncate

true, false

l i s t box,
popup l i s t

false

value

width

, (, label, value,
key, width, height .) . , .
,
(, layout, multiple_select, password_char, big__increment,
small_increment, tabs, tab_truncate -)-

.
, , .

336

Visual LISP AutoCAD

, 5.1, pakt 7 . text,


,
image, ,
okbutton, .

5.3.2.
:
button ;
editjDox ;
e r r t i i e ;
image ;
image__button ;
iist_box ;
popup_iist ;
radio_button ( );
0 radio_coiumn ;
radio^row ;
boxed_radio_coiumn ;
boxed_radio_row ;
slider ;
toggle .
button .
(), . 5.3 button.
1 5.3. b u t t o n
sample: dialog {label=" ";
:button{11=" 1"; key="bl"; action="(setq bstyle 1);}
:button{11=" 2"; fixed_width=true; alignment=right; key="b2";
action="(setq bstyle 2);}
ok_button;

337

5.

:
.

''.'

'

. 5.3.
b u t t o n

. 5.4.
edit box errtile

. 5.3 . ,
AutoCAD , ,
true fixedwidth,
(, ). , right alignment .
ok_button .
action LISP-,
( bstyle
1, 2). , AutoCAD ,
action a c t i o n t i l e (.
. 5.4.1) , .
5.4 e d it b ox
errtile.
\ 5.4. edit_box e r r t i l e

sample: dialog {11=" ";


:edit_box{label="BBen.MTe :"; ="";
edit_width=12; edit_limit=24;}
ok_button;
:errtile{11=" ";}

. 5.4 .
, , edit__width 12 .
(. e d i t i i m i t ) 24 . editbox
true
f ixedwidth,
( ).

338

Visual LISP AutoCAD

"error".
s e t j r i i e (. . 5.4.3) , .
editbox 11.
5.5 image image b u t t o n .

,
.
j 5.5. image image_button

sample: dialog {label=" ";


:image{key="bl";width=20; height=8;color=2;}
:image_button{key="b2"; action^"(setq col 5)";color=5;
width=6;height=3;fixed_width=true;}
ok button;

. 5.5 .
, fixed_width. color.
s t a r t i m a g e , endimage -

(. . 5.6).
5.6 l i s t box, .
: 5.6. list_box
sample: dialog {11=" ";
:list_box{label="QracoK ";key="bl";
Jist="fl"aHHoe 1\ 2\ 4";fixed_width_font=true;}
okjoutton;

I -

. 5.5.
image image_button

339

5.

. 5.6 . true
muitipie_seiect <Shift> <Ctrl> .
true f ixed_width_f ont AutoCAD , , .
1.-.11.-.1.1.

1
2
3
*i

1
2
3

. 5 . 6 . 1
l i s t box

. 5.7. 2
l i s t box

iist_box height
(height=4,-), ,
(. 5.7).
s t a r t i i s t end_iist (. . 5.5).
5.7 popup_iist,
.
I 5.7. p o p u p _ l i s t
\
sample: dialog {11=" ";
:popup_list{label="CnncoK ";key="bl";
list="flaHHoe 1\ 2\ 4";fixed_width_font=true;}
ok button;

I
i

. 5.8 5.7 .
, ,
.

( 1

. 5 . 8 .
popup l i s t

340

Visual LISP AutoCAD

s t a r t _ l i s t end_list.
11
popup_list.
, ,
. radiobutton, radio_row
radiocoiumn . 5.8
.
| 5.8. radiojfcrutton, radio_row radio_column j
sample: dialog {11=" ";
:radio_column{label="IfoJioHKa ";key="bl";
:radio_button{label="Hcncmb30BaTb 1"; key="bll";value="l";}
:radio_button{label="Hcnonb3OBaTb 2"; key="bl2";value="0";\
:31_{11=" 3"; key="bl3";value="0";}
}
:radio_row{label="PHfl ";key="b2";
:radio_button{label="3anafl"; key="b21";value="0";}
:radio_button{label="CeBep"; key="b22";value="0";}
:radio_button{label="BocTOK"; key="b23";value="l";}
:radio_j3utton{label="f0r"; key="b24";value="0"; }
}
ok_button;
, radiobutton
radio_row radio_coiumn. . 5.9 5.8 .
I
- "-"-
j t* 1
j ;2
| '
|

''<&'1

.5.9. 1
radio_row
radio column

radiobutton value, " 1 " ,


, "" . -

5.

341

.
( ) . 5.9
.
. 5.9 radio_row radio__column ,
boxed_radio_row radio^column
( ).
, label, . radio_row
radio_coiuim (. 5.10).

( 1
* 2

* 3

( .

. 5 . 1 0 . 2
r a d i o row

radio column

(slider) , . 5.9
.
i 5.9. s l i d e r

sample: dialog {11=" ";


:slider(key="bl";min_value=50;max_value=450;
layout=horizontal;small_increment=10;big_increment=50;}
ok button;
. 5.11 5.9 .
( layout. min_vaiue max_vaiue .
smaii_increment big_increment .
, , toggle. 5.10
.

. 5 . 1 1 .
s l i d e r

342

Visual LISP AutoCAD

1 5.10. toggle

sample: dialog {11=" ";


:toggle{11=" ";key="bl";value="l";}
:toggle(label=" ";key="b2";value="0";}
:toggle{label=" ";key="b3";value="l"; }
ok_button;

. 5.12 , 5.10. value : " 1 " ( ), "0" ( ).


toggle 11.

f? .
"
is?
f r w

. 5 . 1 2 .
t o g g l e

5.3.3.
,
AutoCAD , . column (). row ().
, 5.1,
(. 5.11).
\ 5.11. column
pakt: dialog{11=" , 1994-2000 ..";key="pin";width=50;
:column{11=" ";children_alignment=centered;
:text{label="KB \"\" ( )";key="tl";}
:image{key="dl";width=23;height=7;fixed_width=true;
color=graphics_background;}
:text{11=":";key="t2";}
:text(11=" .., .., ..";key="t3";}
.^11=". (812) 186-16-60";key="t4"; }
:text{label="E-mail: poleshchukSpeterlink.ru";key="t5";}
}//column
:_^{11="";fixed width=true;is cancel=true;}

343

5.

column , ,
column, ( ). ,
children_alignment, children_fixed_width children_fixed_height, -

( ),
alignment, f ixed_width f ixed_height.

column ( label), 5.11.


AutoCAD ( ,
boxed_column).

5.11 . 5.13.
, 1994-2000 ..

( )

... ., .
. [2)166-16-60

. 5.13.
column

column , , . 5.1.
, , row.
. 5.12.
i 5.12. row
sample: dialog {11=" ";
:row{11="";
:button{11=" 1"; key="bl"; action="(setq bstyle 1)";}
:button{label=" 2"; fixed_width=true; alignment=right; key="b2";
action="(setq bstyle 2)";}
}
okbutton;

. 5.14 .

344

Visual LISP AutoCAD

. 5.14.
row

I
-Pmi- 1
2
!

'4

. 5.15.

column row , label


.
boxed_column boxed_row,

.
, . .
.

. 5.13 . 5.15
.
j 5.13.

sample: dialog {11=" ";


:row{label="PHfl 1";
:column{11=" 1";
:button{11=" l";key="bl";}
:button{label=" 2";key="b2";}
}//column
:column{11=" 2";
:button{11=" 3";key="b3";}
:button(11=" 4";key="b4";}
}//column
}//row
ok_button;

5.3.4.
,
, text. .
5.1 . 5.1.1. , text,

set_tile (. . 5.4.3).

5.

345

, .
:
textjoart , concatenation paragraph;
concatenation text_part;
paragraph text_part concatenation.
, t e x t p a r t , set_tile.
5.14 ,
.
I 5.14. text_part, concatenation paragraph i
sample: dialog {11=" ";
:paragraph{key="pl";
:concatenation{key="cl";
:text_part{11=" ";key="tl";}
:text_part{11=" ";key="t2";}
}//concatenat i on
:concatenation!key="c2";
:text_part{11="";key="t3"; }
:text_part{11=" .";key="t4";}
}//concatenation
}//paragraph
ok_button;

. 5.16.

. 5.16. text_part,
concatenation paragraph

5.3.5.
base.dcl ,
:
ok_button ;
ok_oniy ;

346

Visual LISP AutoCAD

okcancei (Cancel);
ok_cancei_heip , (Cancel) (Help);
okjcanceierr (Cancel)
;
ok_cancei_heip_errtiie , (Cancel)
(Help) ;
ok_cancei_heip_info , (Cancel),
(Help) (Info).

( ). . 5.3.1
okjoutton. 5.1 , label .
ok_button.
, .
. 5.3 , .
5.3.
()


accept

(Cancel)

"cancel

(Help)

"help"

(Info)

"info"

"error"

5.3.6.

( ), :
spacer ( width height);
spacer_0 spacer width
height;

spacer_i spacer width


height.

5.

347

. 5 . 1 7 .
s p a c e r

,
.
, . 5.13 , spacer

spacer (. 5.15 . 5.17).
\ 5.15. spacer

sample: dialog {11=" ";


:row(label="PHfl 1";
:column!11=" 1";
:button{11=" l";key="bl";}
:button{label="KHonKa 2";key="b2";}
}//column
spacer_l;
:column{11=" 2";
:button(11=" 3";key="b3";}
:button{11="

4";key="b4";}

}//column
}//row
:spacer{width=0;height=2;}
ok_button;

. 5.15
.

5.4. ,
AutoLISP :
LISP-, <Enter> ( action_tiie);

348

Visual LISP AutoCAD

() (
( get_tile);
( set_tiie);
, DCL- (
get_attr);

( ciient_data_tile).

5.4.1. action_tile
LISP- ,
AutoCAD .
(action__tile <> <>)

: <> , <> LISP-.


.
, , , AutoCAD
.
<Enter> button,
editjoox, () listjoox popup_iist,
slider . . , (, . .) .

action DCL-. LISP ( ,
command). LISP- , <>
a c t i o n t i l e , new_dialog start_dialog.
, <>, () , () action DCL-.
, .
key .
actionjrile <>.
LISP- a c t i o n t i l e :
$vaiue ;

5.

349

$ ;
$reason , ;
$data , ciient_data_tiie ;
$ $ ( ).
. . 5.4.7.
:

( a c t i o n _ t i l e " a c c e p t " " (done_dialog) ")

( a c t i o n _ t i l e " D r t l " ( s t r c a t " ( i f (<= ( a t o i $value) 0 ) "


" ( a l e r t \" ! \ " ) " ) ) -


LISP-, "Drtl", .
, / , alert, \.
. a c t i o n t i l e , 11.
, <>,
.

5.4.2. mode_tile
.
(mode_tile <> <>)

: <> ; <> 0 4 (.
. 5.4).
nil.
5.4. <> mode_tiie

( )

350

Visual LISP AutoCAD

, . ,
.
:

(mode_tiie "ki" l) "ki" ( )

(modetiie "ki" 0) "ki" (


)

. mode_tiie, 11.

5.4.3. set_tile
, value.
(set tile <> <>)

: <> ; <> ,
value .
, .
value ( label). , 5.16.
I 5.16.
// .., 2001.
user:dialog{label = " ";
:column)
:edit_box{11=":";edit_width=4 0;alignment=centered;
value=""; key="usfam";
}// edit__box
:spacer{height=l;}
:text{11=" ";alignment=centered; }
: row {
.^^11=" 0001"; key="sl"; }
:popup_list{key="pl";is_enabled=true;label="";list="";width=20;}
}// row
: row {
:text{11=" 0002"; key="s2";}
:popup_list{key="p2";is_enabled=true;label="";list="";width=2 0;}
}// row

351

5.

: row {
^1;{11=" 0003"; key="s3";}
:popup_list{key="p3";is_enabled=true;label="";list="";width=20;}
}// row
: row{
:text{label="noflpa3fleneHHe 0004"; key="s4";}
:popup_list(key="p4";is_enabled=true;label="";list="";width=20;}
}// row
:spacer {height=l;}
ok cancel help_info;

,
5.16, . 5.18.

^:

0001 ; . . ; : :; ,|
' 0002

I
3

0003

.' ,

. J
3

: OQCR

j
3

" . '

..

"

'

If"'W~%

:.

'

'

"

'

'

j
-

'

'

; . '

..

':

| :

-. | :

. 5 . 1 8 .

editjbox
,
. 4 ( ).
, .
, . 5.18,
, 0001, ..., 0004. ,
AutoCAD
, DCL-.
set_tiie.
, AutoCAD.

352

Visual LISP AutoCAD

, (. ) , , .
,
5.17.
j 5.17. polz01.txt

2111

, .
5.18 ( usn).
! 5.18. usn

; .., 2001 .
(defun usn ( / dcl_id fpolz i p l i s t n l i s t spi s t r nsubd)
(if (not pv)(setq pv ""))
(if (< (setq dcl_id (load__dialog "user.del")) 0) (exit) )
(if (not (newjdialog "user" dcl_id)) (exit) )
(setq p l i s t n i l n l i s t n i l i 0)
; polz01.txt, polz02.txt, polz03.txt, polz04.txt
(repeat 4; 4
(setq spi nil)
(setq i (1+ i) fpolz
(if (findfile fpolz)
(progn

(strcat "polzO"

(itoa i)

(setq fd (open (findfile fpolz) "r"))


(setq s t r (read-line fd))
(setq n l i s t (append n l i s t (list str)))
(if s t r
(while (setq s t r (read-line fd))
(setq spi
);while
);if s t r

(append spi

(list s t r ) ) )

(close fd)(setq fd nil)


);progn
(setq n l i s t (append n l i s t
);if findfile

(list nil)))

".txt"))

5.

353

(setq plist (append plist (list spi)))


);repeat

;
(setq i -1)
(repeat 4
(setq i (1+ i) )
(if (setq nsubd (nth i nlist))
(progn
(set_tile (strcat "s" (itoa (1+ i))) nsubd)
(if (setq spi- (nth i plist))
(progn
(start_list (strcat "p" (itoa (1+ i))))
(raapcar 'add_list spi)
(end_list)
);progn
);if
);progn
; ,
(progn
(mode_tile (strcat "s" (itoa (1+ i))) 1)
(mode_tile (strcat "p" (itoa (1+ i))) 1)

);repeat
;==
(action_tile "accept"
(strcat
"(if(= (setq pv(get_tile \"usfam\"))\"\")"
" (1\" \")"
"(done_dialog))"
);strcat
);action-tile accept
(action_tile "cancel" "(done_dialog)")
(action_tile "pi"
"(set_tile \"usfam\" (nth (atoi $value)
(action_tile "p2"
"(set_tile \"usfam\" (nth (atoi $value)
(action_tile "p3"
"(set_tile \"usfam\" (nth (atoi $value)
(action_tile "p4"
"(set_tile \"usfam\" (nth (atoi $value)
(start_dialog)
(unload__dialog dcl_id)
(princ)
);defun usn
12 . 155

(nth 0 plist)))")
(nth 1 plist)))")
(nth 2 plist)))")
(nth 3 plist)))")

354

Visual LISP AutoCAD

, ,
s e t t i l e , LISP-, "pi", "2", "" "4", , polz01.txt,
polz02.txt, polz03.txt, polz04.txt
( start_list, add_list end_list

. 5.5).
p i i s t , niist.
$value, a c t i o n t i l e ,
popupiist
.
s e t t i l e ( 0001 . .) niist. (, ),
mode_tiie.
, editbox,
,
pv, .
. 5.19
, usn.

:

2111
2112

2113

d
d
...

. 5.19.
,
usn

5.4.4. get_tile
( value).
(get_tile <>)

<> .
value.

5.

355

( g e t t i l e "usfam") , ,
, (, . 5.19 "")

5.4.5. get_attr
( value DCL-).
(get_attr <>)

<> .
value.
:

( g e t t i l e "usfam") , 5.16 , ""

5.4.6. client_data_tile
.
(client_data_tile <> <>)

: <> ; <> .
nil.
, , ,
$data action_tile. , , , .
:
0

(client__data_tile
"usfam"

"usfam"

"2110")

"2110"

5.4.7.
AutoCAD
$key, $vaiue, $reason, $data, $x, $y (
),
. LISP-,
action__tiie ( action_tiie ).
12*

356

Visual LISP AutoCAD


. . 5.5
.
5.5.

( )

$value

value ( ). e d i t Joox
; t o g g l e " l " () "" ();
l i s t _ b o x popup l i s t ( n i l , )

$data

,
(. . 5.4.6)

$reason

edit_box, l i s t _ b o x , image_button s l i d e r
( .
. 5.6)

$, $

( )
imagejoutton

(action_tile "usfam" "(setq nam (strcat \": \" $value))")

(action_tile "cldat" "(setq tyg (read $data))")

. 5.18 11.
. 5.6
$reason.
5.6. $reason

, :
; <Enter>, t r u e
is_default

e d i t b o x : , ( <> )

s l i d e r :
,

l i s t _ b o x image_button:
( m u l t i p l e _ s e l e c t i o n = f a l s e ,
, m u l t i p l e _ s e l e c t i o n = t r u e ,
. 1)

5.

357

5.5. ,
,
iist_box popup_box, s t a r t _ i i s t ,
add_list end_list.

5.5.1. startjist
iist_box popupiist.
(start_list <> [<> [<>]])

: <> , ; <>
, (1 ; 2 ; 3
); <> ,
(, <> 1).
3, 0.
, .
, .
s t a r t i i s t , end_iist . add_iist , s t a r t _ l i s t end_iist. He
s t a r t _ l i s t end_list set_tile.
:
(start_iist "kp2")
"2"

( s t a r t i i s t "kp2" 2) "2"

( s t a r t i i s t "kp2" 1 14)
, , "2"

. 5.18 11.

5.5.2. addjist

listbox

popup_list.
(add_list <>)

: <> , ; <>
, .

358

Visual LISP AutoCAD

<>, . nil.
, add_list, start_list.
:

(addj.ist "kp2" " 3217-06")

. 5.18 11.

5.5.3. endjist
iist__box popup_iist.
(end_list)

nil.
. 5.18 11.

5.6. ,

image i m a g e b u t t o n

, , ,
. startimage ( ), end_image ( ), fill_image, slide_image, vector_image.

5.6.1. start image


.
(start_image <>)

<> ( key).
. nil.
startimage , endimage .
slide^image, fill_image, vector_image , start_image end_image. He start_image
end__image set t i l e .

5.

359

(start_image "igp4")

5.6.2. endjmage
.
(end_image)

nil.
endimage
start_image.

5.6.3. filljmage
.
(fill_image <xl> <yl> <> <> <>)

: <xi>, <yl> ( ) ; <>, <> ( ) ; <> , . AutoCAD 0 256,


, . 5.7.
( <>).
.
(0,0),
d i m x _ t i l e d i m y _ t i l e (.

. 5.6.6 5.6.7). filiimage


, .
. 5.7 , .
5.7. ,

AutoCAD

-15

-16

-18

fill__image

360

Visual LISP AutoCAD

(fiii_image "igp4" 5 15 25 1) ( 1)
(5,6)
(20,31)

5.6.4. slidejmage

.
(slide_image <xl> <yl> <> <> <>)

<xi>, <yi>, <> <> ,


fiiiimage. <> ( sld
) (
).
( <>).
:

(slide_image "igp4" " r i n g l " ) "igp4"

ringl.sld

(slide_image "igp5" "Iib23 (nut8) ") "igp5" -

nut8 Iib23
, . 5.1 .5.13, siide_image "", .

5.6.5. vectorjmage
.
(vector_image <xl> <yl> <2> <2> <>)

: <xi>, <yi> ( ) ;
<2>, <2> ( ) ; <>
0 256, . 5.7.
( <>).
, vectorimage, ,
fill_image.

(vector_image "igp2" 5 11 l i 2) ( 2) (5,11) (33,11)

5.

361

5.6.6. dimx_tile

(, 1).
(dimx_tile <>)

<> .

( 0).
:

(dimx_tiie "igp2") 50 (
51 )

5.6.7. dimyjile

(, 1).
(dimyjtile <>)

<> .
( 0).
:

(dimy_tiie "igp2") 32 (
33 )

5.7.

5.7.1.
, ,
. , , , <. 5.19
DCL- tempexit.dcl ,
edit_box, .

362

Visual LISP AutoCAD

! 5.19.

tempexit: dialog {11=" ";


: row{
:column)
:edit_box{label="X:";value="O";key="xp";}
:edit_box{label="Y:";value="0";key="yp";}
:editJoox{label="Z:";value="0";key="zp";}
}// column
:button{11=" <";key="mousep";height=6;}
}// row
spacer_l;
ok_button;

DCL- . 5.20.

. 5.20.

5.20 tempe, DCL tempexit.dcl.


5.20. tempe
; .., 2001 .
(defun tempe

(/ d c l _ i d s t e p pt)

(setq d c l _ l d

(load_dialog

"tempexit.dcl"))

( s e t q s t e p 2)
(if

(null p t ) ( s e t q pt

(while
(if

(list

0.0

0.0

0.0)))

(>= s t e p 2)
(null

(new_dialog

"tempexit" d c l _ i d ) ) ( e x i t ) ,

( s e t _ t i l e "xp"

(rtos

(car p t )

( s e t _ t i l e "yp"

(rtos

(cadr p t )

( s e t _ t i l e "zp"

(rtos

(caddr p t )

(action_tile

2 5))
2 5))
2 5))

"accept"

(strcat
"(setq x

(atof

(get_tile

\"xp\")))"

"(setq

(atof

(get_tile

\"yp\")))"

"(setq z

(atof

(get__tile \ " z p \ " ) ) ) "

5.

363

"(setq pt (list z))"


"(done_dialog 1 ) "
);strcat
);action_tile
(action_tile "mousep" "(done_dialog 3)")
(setq step (start__dialog))
(cond
((= step 3)(setq pt (getpoint " : ")))
((= step 1)
(princ ": (")
(princ (rtos x 2 5))(princ " ")
(princ (rtos 2 5))(princ " ")
(princ (rtos z 2 5) ) (princ ")")
);= step 1
) ; cond
) ;while
(unload_dialog dcl_id)
(princ)

tempe step, 3,
( ), 1,
. step
start_diaiog, done_diaiog (1 3).

set_tile editjaox .

5.7.2.
, - ,
. .
AutoCAD
,
( ,
).
LISP, a c t i o n t i i e ,
new_diaiog start_diaiog. DCL-

364

Visual LISP AutoCAD

( ), loaddiaiog LISP-
action_tile.
5.21 twodia.dcl,
(dial dia2). dia2
dial .
\ 5.21. ( twodia.dcl)
i
dial: dialog{11=" ";
:edit_box{label="BBOfl :";key="tl";}
:button{11=" ";="1";}
ok_button;
}
dia2: dialog{11=" ";
:text{11=" OKHo";key="t2";}
:ok_button{11="";}

;
j

5.22 twodia.lsp, . twodia



opendia2, .
! 5.22. twodia.lsp

(defun twodia ( / dcl_id)


(if (< (setq dcl_id (load_dialog "twodia.dcl")) 0)(exit))
(if (not (new_dialog "dial" dcl_id)) (exit))
(action_tile "tl" "(setq mytxt $value)")
(action_tile " " " (opendia2 dcl_id) ")
(start_dialog)
(unload_dialog dcl_id)
(princ)
);defun dial
(defun opendia2 (dc /)
(if (not (new_dialog "dia2" dc)) (exit))
(start_dialog)
);defun dia2

. 5.21 , twodia opendia2 ( ,


).

365

5.

[_

1 ^


_

. 5 . 2 1 .

5.7.3.
edit box , , (, ).
password_char. , , . , , (, ).
5.23 , editbox
.
I 5.23.

pass: dialog(11=" ";


:edit_box{label=" :";key="el";password_char="0";}
ok button;

. 5.22 , 5.23.
, edit_box, .

:

. 5.22.


.
.
, .
AutoCAD 2000 :
HELP- Windows;
HTML-;
AutoCAD ().
,
.

6.1. HELP- Windows


WinHelp, AutoCAD 2000,
Microsoft Office, , Windows. AutoCAD,
. WinHelp
, , ,
.
(Microsoft Help Workshop, Microsoft
Help Designer . .).

6.

367

6.1.1. HELP-
HELP- Windows :
rtf ( , , ,
MS Word Microsoft Office);
hpj ( );
( HELP-);
cnt ( );
gid ( );
fts ( , );
ftg ( ).

AutoCAD 2000i, AutoCAD 2000,


awa, chm, lim.

,
, cnt. , Help AutoCAD 2000 36 hip (acad.hlp, acadag.hlp, acad_ala.hlp,
acad_asi.hlp, acad_car.hlp . .) 21 cnt (acad.cnt,
acad_ag.cnt, acad_asi.cnt, acad_car.cnt . .).
(Microsoft Help Designer .). cnt
. , .
. 6.1 AutoCAD 2000,
Windows.
. (Contents)
, (Index) , (Find) .
, . 6.1,
, .
cnt,
, . , AutoCAD 2000

368

Visual LISP AutoCAD

, acad.cnt. 6.1
, AutoCAD
( ). . 6.1 ,
,
.
: AutoCAD 200D
. j

AutoCAD 2000
^ Using AutoCAD Help
...


^
^ Customization Guide
^ AutoCAD
^ V i s u a l LISP and AutoLISP
^ VBA and ActiveX Automation
^ DXF Reference
^ AutoCAD Express Tools

- [

. 6 . 1 .

AutoCAD 2000

6.1. acad.cnt
;;; ACAD.CNT- [v.ul5.0.01]
:Base acad.hlp
:Title AutoCAD 2000
:Index AutoCAD Command Reference=acad.hlp
:Index AutoCAD Customization Guide=acad_cg.hlp
:Index AutoCAD Installation Guide=acad_ig.hip
:Index AutoCAD User's Guide=acad_ug.hlp
.Index 3d Graphics System Configuration=gsconfig.hlp
:Index AutoCAD Readme=readme.hip
:Index AutoCAD Technical Publications=doccheck.hlp
:Index AutoCAD Learning Assistance=acad_ala.hlp
:Link doccheck.hlp
.-Link acad.hlp
:Link acad_cg.hlp
:Link acad_ig.hlp
:Link acad_ug.hlp
:Link acad_vlr.hlp

6.

369

:Link acad_vlg.hlp
:Link acad_vlt.hlp
:Link acad_ag.hlp
:Link acad_asi.hlp
.Link acadauto.hlp
:Link dxf_2000.hlp
:Link batchplt.hlp
:Link drv_dwf.hip
:Link drv_hpg2.hip
:Link drv_hpgl.hip
:Link drv_ps.hip
.Link drv_rast.hlp
:Link gsconfig.hip
:Link nsyshnts.hlp
:Link pltedt.hlp
:Link syshnts.hlp
:Link webbrw.hlp
:Link acad_plt.hlp
1 AutoCAD 2000 Readme=AutoCAD_2000_Readme@readme.hlp>main
1 AutoCAD 2000=What39s_New_in_AutoCAD_2000_aug_01@
acad_ug.hlp>main
Include
Include
Include
Include
Include
Include
Include

doccheck.cnt
acad_how.cnt
acad_cr.cnt
acadjjg. cnt
acad_ig.cnt
acad_cg.cnt
acad_plt.cnt

;; The RunHelp macro lives in achlp.dll


1 Visual LISP and AutoLISP
2 Shortcut link to the AutoCAD Visual LISP Help=!RunHelp("acad_vlr.hip")
; 2 Shortcut link to the AutoCAD Visual LISP Help=
!EF("acad_vlr.hip","",4, "")
1 VBA and ActiveX Automation
2 Shortcut link to the AutoCAD VBA and ActiveX Help=
!RunHelp("acad_ag.hip")
; 2 Shortcut link to the AutoCAD VBA and ActiveX Help=
;
!EF("acad_ag.hlp","",4,"")
1 DXF Reference
2 Shortcut link to the DXF Reference=!RunHelp("acad_vlr.hip")
; 2 Shortcut link to the DXF Reference EF=!EF("acad_ylr.hlp","",4,"")
:Include acetmain.cnt
:Include include.cnt

370

Visual LISP AutoCAD

6.1.2. CNT-
acad.cnt (. 6.1) AutoCAD . ,
include.cnt CNT- ( cnt)
HELP-. include.cnt
Help, AutoCAD. include.cnt
: include , 6.2.
: 6.2. include.cnt

:Include spravkal.cnt
:Include spravka2.cnt
:Include spravka3.cnt

6.2 spravkal.cnt, spravka2.cnt spravka3.cnt


,
(. . 1.3). include.cnt (
) acad.gid.
.
CNT- , ,
.
. :
.-Base ( );
0 : Title , ;
: index ;
: Link HELP-;
: include .
CNT- , . 1 ,
2 1 . . 2 1, . 3 2
. . 6.3 acad_cr.cnt, .
1 6.3. acad_cr.cnt
:Base acad.hlp
1

6:

371

2 BBefleHMe=introduction@acad.hlp>main
2 KoMaHflbi=cmd_toc@acad.hlp>main
2 KOMaHfl=command_aliases@acad.hlp>main
2 nepeMeHHbie=sysvar_toc@acad.hlp>main
2 =
dimension_variables_quick__reference@acad.hlp>main
2 yTMnnTbi=utilities@acad.hlp>main
2 6n6nnoTeKM=standard_libraries@acad.hlp>main
2 AutoCAD=autocad_graphical_objects@acad.hlp>main
2 Unicode=Using_Unicode_Fonts@acad.hlp>main
2 MeHbo=menus_main@acad.hlp>main
2 ae=toolbars main@acad.hlp>main

. 6.1 , 1 AutoCAD 2000


acad_cr.cnt. , . 6.1,
(Show), 2, 6.3 (. 6.2).
I : AutoCAD 200U
| ) }
; ^ ' "
.'^&

' :

^ Using AutoCAD Help


...


i2]
i?3
[23
j j
[V]
L 2 AutoCAD
i?l | Unicode

?]

t

zli
-^| ": ... ]

. 6.2.


2

6.1.3. help
HELP- AutoLISP
help:
(help [<> [<> [<>]]])

372

Visual LISP AutoCAD

help: <> , <> , <> , .


<>
(""), AutoCAD ,
(. . 1.3).
<> , AutoCAD 2000
hip (a AutoCAD 2000i chm, hip).
<> ( CNT-), . , , acad.cnt, 6.3,
"introduction", "cmd_toc", "command^
aliases" . . <>
, . . 6.3
, (help "" "cmdjtoc").
AutoCAD


3-.

3- i

. 6.3. cmd_toc

<> :
"HELP_CONTENTS" ;
"HELP_HELPONHELP" Windows ;
"HELP_PARTIALKEY" (Index)
, help <>;
, .

6.

373

help <> nil .


, "" nil.

6.1.4. WIN-

HELP- Windows acad.pgp (. . 1.2).
, HELPRU,
our_rules.hlp d:\AppAutoCAD.
acad.pgp .
HELPRU,start d:\AppAutoCAD\our_rules.hip,0
AutoCAD acad.pgp
(REINIT) HELPRU,
.

6.1.5. WIN-
startapp
AutoCAD Windows AutoLISP startapp. :
(startapp <> [<>])

.
, , .
( ).
startapp ,
Windows
winhlp32,
. . 6.1.4 :
(startapp "winhlp32" "d:\AppAutoCAD\our__rules.hlp")
(, "d:\AppAutoCAD\our r u l e s . h i p " ) ,

:
(startapp "winhlp32" "\"d:\AppAutoCAD\our rules.hlp\"")
<>
, , PATH.

374

Visual LISP AutoCAD

6.2. HTML-
Web, HTML (
htm, html).
(, Microsoft Internet
Explorer). HTML-
HTML-, , , Microsoft Word,
HTML.

6.2.1. HTML-
CNT-
, rules.htm.
, , CNT- :
1 =!("rules.htm","",4)


. (Show)
Web- rules.htm.
HTML-
,

,
:
"http://
www.our.rules.ru/rules.html".

6.2.2. HTML-

HELP- Windows, HTML-
,
acad.pgp (. . 1.2).
HTMLRU. rules.htm
d:\AppAutoCAD, acad.pgp :
HTMLRU,start d:\AppAutoCAD\rules.htm, 0
HTMLRU ,
HTML- (, Internet
Explorer).

6.2.3. HTML-
startapp
AutoCAD HTML-
startapp , .

6,

375

:
(setq webrdr "\"C: WProgram FilesWlnternet Explorer\\IEXPLORE.EXE\"")
(startapp webrdr "d:\AppAutoCAD\rules.htm")

setq
webrdr (Internet Explorer), , . 6.1.5,
. startapp HTML-.

6.3.
AutoCAD
AutoCAD
ahp, .

6.3.1. acad_helpdlg

AutoLISP :
(acad_helpdlg <> <>)

(
ahp ).
help (. . 6.1.3).

6.4. -

<F1>
- ,
. AutoCAD
. ,
(LINE) <F1>, , .

6.4.1. setfunhelp
setfunhelp -
, . :
(setfunhelp <-> [<> [<> [<>]]])

376

Visual LISP AutoCAD

: <-> ,
: : AutoCAD; <> ; <> ; <>
. .
, ,
: : ( ).
, , :crown,
CROWN.
,
help (. . 6.1.3). <> ,
AutoCAD ,
ahp .
setfunhelp , nil.

6.4.2.
setfunhelp
. 2.16.2, , , defun.

setfunhelp. .

ActiveX
AutoLISP, AutoCAD 2000 ActiveX,
Microsoft.
ActiveX (, ActiveX Automation, OLE
Automation) - , , , .
, Microsoft Word, Microsoft Excel .
, .
Visual LISP AutoLISP ActiveX
(, ), ,
. ActiveX ObjectARX VBA.

7.1. AutoLISP
ActiveX , , .

() , .

7.1.1.
(objects) ActiveX AutoCAD , , (,
. .). (collec-

378

Visual LISP AutoCAD

tions). Application,
.
Application :

Preferences ()

Documents ()
MenuBar ( )
MenuGroups ( )
Preferences
(, . .). Documents
Document (). MenuGroups
MenuGroup ( ), MenuBar
PopupMenu ( ).
. MenuGroups MenuGroup,
PopupMenus Toolbars. :
PopupMenus PopupMenu PopupMenuItem
Toolbars Toolbar Toolbarltem
AutoCAD
VBA. Document.
Document :
Blocks ()
ModelSpace ( )
Paperspace ( )
Dictionaries ()
Dimstyles ( )
Groups ()
D Layers ()
Layouts ()
Linetypes ( )
. .

, AutoCAD ( ):

3DFace

Arc

3DPoly

Attribute

3DSolid

AttributeRef

7. ActiveX

CJ

BlockRef
Circle
Dim3PointAngular
DimAligned
DimAngular
DimDiametric
DimOrdinate
DiroRadial
DimRotated
Ellipse
ExternalReference
Hatch
Leader,
LightweightPolyline
Line

MinsertBlock

379

C\

MLine
MText
Point
PolyfaceMesh
Polyline
PolygonMesh
Raster
Ray
Region
Shape
Solid
Spline
Text
Tolerance
Trace

XLine

Hyperlinks

Hyperlink.

ActiveX
(). , AutoLISP.
via-, vlax- vir- ( ) . 5.
, , ActiveX AutoCAD. vl-ioad-com, . 7.1.2.

7.1.2. vHoad-com
, AutoLISP, , , ActiveX.
(vl-load-com)

7.1.3.
, ActiveX,
,
AutoLISP.

380

Visual LISP AutoCAD


AutoCAD ( Application, , ).
, , , . 7.1.47.1.7.
, AutoLISP (
VBA ObjectARX).
. (color, layer), , radius, area, length, perimeter . . vla-get-color, vla-get-radius, vla-get-area . .

VBA,
via-get-.
, via-put- (, via-put-coior, via-putlayer), .
via-get- via-put-
. 7.1.13.

7.1.4. vlax-get-acad-object
AutoCAD ( Application).
(vlax-get-acad-object)

VLA- ( Application).
:
#<VLA-OBJECT IAcadApplication 00adc088>
VLA- . . 7.1.10.

7.1.5. vla-get-activedocument
( ).
(vla-get-activedocument <>)

<> ,
vlax-get-acad-object.
VLA- ( ).
:
#<VLA-OBJECT IAcadDocument 00f6d534>

7. ActiveX

381

7.1.6. vla-get-modelspace
.
(vla-get-modelspace <>)

<> , viaxget-activedocument.

VLA- ( ).
:
#<VLA-OBJECT IAcadModelSpace 01923224>

7.1.7. vla-get-paperspace
.
(vla-get-paperspace <>)

<> , viaxget-activedocument.

VLA- ( ).
:
0 #<VLA-OBJECT IAcadPaperSpace 01920344>

7.1.8. ActiveX
VLA-, , . 7.1.47.1.7,
. ,
. 7.1
begin_activex,
, ActiveX.
1 7.1. begin_activax

,
(defun begin_activex ( /)
(vl-load-com)
(setq acad_application (vlax-get-acad-object))
(setq active_document (vla-get-activedocument acad_application))
(setq model_space (vla-get-modelspace active_document))
(setq paper_space (vla-get-paperspace active_document))
); defun

j
.J

begin_activex
, .

382

Visual LISP AutoCAD

7.1.9.
ActiveX
(), . , .
Modeispace
, . AutoLISP, ,
: via-add
. 7.1.1, :
vla-add3DFace
vla-add3DPoly
vla-add3DSolid
vla-addArc
vla-addftttribute
vla-addAttributeRef
vla-addBlockRef
vla-addCircle
vla-addDim3PointAngular
. .

.
. (
Add3DFace, Add3DPoly, AddCircle . .).
( AutoLISP
), . AutoCAD
. , (COPY) (MIRROR)
Mirror. vla-copy vla-mirror
( via-).
. , (ARRAY)
(ArrayRectangular ArrayPolar), : vla-arrayrectangular vla-arraypolar.

7.1.10. VLA-
ActiveX VLA-.
vlax-get-acad-object, vla-get-active-document, vla-get-modelspace, vlaget-paperspace, via-add
VLA-. VLA- () -

7. ActiveX

383

, AutoCAD, , .
VLA- . vlax-ename->vla-object vlaxvia-object->ename, . 7.1.11 7.1.12.

7.1.11. vlax-ename->vla-object
VLA-.
(vlax-ename->vla-object <>)
,
entlast.
VLA-.
, ,
VLA-:
(setq viol (vlax-ename->vla-object (entlast))) #<VLA-OBJECT
IAcadLine 01925274> ( - )

7.1.12. vlax-vla-object->ename
VLA- .
(vlax -vla-object->ename <>)
<> VLA- () , vlax-ename->vla-object.
.
( . 7.1.11):

(setq el (vlax-vla-object->ename
4002ed88> ( )

viol))

<

7.1.13.
VLA- (
via-get-) ( via-put-). ,
v i o l , . 7.1.11 v l a x - e n a m e -

>via-object, :

(via-get-coior viol) i;

(vla-get-layer viol) "0";


(vla-get-linetype viol) "ByLayer".

384

Visual LISP AutoCAD

, startPoint EndPoint
, ActiveX:
D

(setq val ( v l a - g e t - s t a r t p o i n t v i o l ) ) #<variant 8197 ..:>


(setq va2 (vla-get-endpoint v i o l ) ) #<variant 8197 ...>


, .
, get put, VLA-, :

(via-put-coior viol 3) viol

7.1.14.
VLA- via-add
(, via-addcircie) AutoLISP .
Addcircie VBA ,: , ,
.
via-addcircle.
. . 7.1.24.
, .
vlax-make-variant (. . 7.1.15).
, (vlax-variant-type, vlax-variantvalue, vlax-variant-change-type) . 7.1.167.1.18.

viax-3d-point (. . 7.1.19).
, (, ).

7.1.15. vlax-make-variant
.
(vlax-make-variant [<> [<>]])

: <> , ; <>
, . ,
<> . , viax-vbEmpty (. . 7.1).
().

7. ActiveX

385

,
<>, . 7.1.
7.1. ,

vlax-vbEmpty

( )

vlax-vbNull

( )

vlax-vblnteger

vlax-vbLoiig

viax-vbSingle

viax-vbDouble

vlax-vbString

vlax-vbObject

vlax-vbBoolean

11

vlax-vbArray

8192

, . , , ,
, .
vlax-make-variant:

(vlax-make-variant nil) #<variant 0>

(setq vr (vlax-make-variant 17.25 vlax-vbDouble)) #<variant


5 ,25>

(setq vs (vlax-make-variant "tools")) #<variant 8 tools>

viax-vbArray, ,
AutoCAD (safeanay).
. . 7.1.20.
sf ,

vlax-vbArray:

(setq vas

( v l a x - m a k e - v a r i a n t s f ) ) # < v a r i a n t 8197

7.1.16. vlax-variant-type
.
(vlax-variant-type
13 . 1J5

<>)

...>

386

Visual LISP AutoCAD

<> .
, . 7.1. viax-vbArray,
8192 + N, N , .
( . 7.1.15):

(vlax-variant-type vr) 5

(vlax-variant-type vs) 8

(vlax-variant-type vas) 8197

7.1.17. vlax-variant-value
.
(vlax-variant-value <>)
<> .
, .
( . 7.1.15):
(vlax-variant-value vr) 17. 25

(vlax-variant-value vs) "tools"

(vlax-variant-value vas) #<safearray...>

7.1.18. vlax-vahant-change-type
, .
(vlax-variant-change-type <> <>)
: <> , <> . 7.1.
. , nil.
D

(vlax-variant-change-type vr vlax-vblnteger) #<variant 2


17> ( 17.25 17)

(vlax-variant-change-type vr viax-vbstring) #<variant


17,25> ( 17.25 "17,25")

7.1.19. vlax-3D-point
( ).
:
(vlax-3D-point <>) (vlax-3D-point <x> <y> [<z>])

7. ActiveX

387

: <> ; <>,
<>, <z> .

( Z , 0.0).
:

(setq vptl (vlax-3d-point 4 0 13.2)) #<variant 8197 ...>

( )
D

(setq

vptl

(vlax-3d-point

'(-12.4

6.0)))

#<variant

8197

.. .> ( )

7.1.20.
ActiveX ( , AutoLISP ).
(safearrays), .
\0ax-makesafearray, viax-sareatray-put -element, -/lax-oa' .'array -til 1, . 7.1.217.1.23. ,
.

7.1.21. vlax-make-safearray
1 16 .
(vlax-make-safearray <> '(<1> . <1>) ['(<2> . <2>) ...
[' (<16> . <16>) ]...] )

<> .
,
.
(
, ). ,
,
.
vlax-vblnteger, vlax-vbLong, vlax-vbSingle, vlax-vbDouble,
vlax-vbString, vlax-vbObject, vlax-vbBoolean . 7.1,

viax-vbvariant, 12
.
(, ).

13*

388

Visual LISP AutoCAD

, ,
. 7.2.
7.2.

vlax-vblnteger

vlax-vbLong

vlax-vbSingle

0.

vlax-vbDouble

0.

vlax-vbString

"" ( )

vlax-vbObject

nil

vlax-vbBoolean

.-vlax-false ( , "")

vlax-vbVariant

(vlax-vbEmpty)

:
0

(setq sf (vlax-make-safearray vlax-vbBoolean '(-2 . 2) ) ) #<safearray... >

:
- 2 , - 1 , 0, 1, 2.

7.1.22. vlax-safearray-put-element
.
(viax-safearray-put-element <> <> <>.)
: <> ; <> ( ), ;
<> .
.
( , . 7.1.21, ):
0

(vlax-safearray-put-element sf -2 :vlax-false) :vlax-false

(vlax-safearray-put-element sf -1 :vlax-false) :vlax-false

(vlax-safearray-put-element sf 0 :vlax-true) :vlax-true

(vlax-safearray-put-element sf 1 :vlax-false) :vlax-false

(vlax-safearray-put-element sf 2 :vlax-true) :v.lax-true

7. ActiveX

389

7.1.23. vlax-safearray-fill
.
(vlax-safearray-fill <> <>)

: <> ; <> , . <> <>.


<>.
( , . 7.1.21):

(vlax-safearray-fill sf ' (:vlax-false :vlax-false


false :vlax-true) ) Ksafearray. . . >

:vlax-true

:vlax-

7.1.24. VLA-
VLA-
, , add (
vla-add).

. 7.1.14 , viaaddcircie , ( ).
:
VLA-, .
ActiveX (.
modei_space 7.1 . 7.1.8).

(124.4, 25.9, 40.7) 100 ( 7.2).
I 7.2. ActiveX

(setq center (vlax-3d-point '(124.4 25.9 40.7)))


(setq ax_circle (vla-addcircle model__space center 100.0))


. VLA- (#<VLA-OBJECT
iAcadCircie 019204>). ,
viax-dump-object (. ).

7.1.25. vlax-dump-object
, ,
.
(vlax-dump-object <> [<>])

390

Visual LISP AutoCAD

: <> VLA-, <>


nil, , VLA-.
, VLA. .
, .
7.3 ax_circie,
. 7.1.24.
; 7.3.
lAcadCircle: AutoCAD .
:
Application (R0) - #<VLA-OBJECT JAcadApplication 00adcO88>
Area - 31415.9
Center - (124.4 i. 5. 9 40.7)
Cixcumierence - 628.319
Color - 256
Diameter - 200.0
Document (RO) = #<VLA-OBJECT IAcadDocument 00f6d534>
Handle (RO) = "33"
HasKxtensionDict.i onary (RO) = 0
Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0192fc94>
Layer = "0"
Linetype = "ByLayer"
LinetypeScale =1.0
Lineweight = -1
Normal =- (0.0 0.0 1.0)
ObjectID (RO) - 1073933720
ObjectName (RO) = "AcDbCircle"
OwnerID (RO) - 1073933560
PlotStyleName = "ByLayer"
Radius -^ 100.0
Thickness = 0.0
Visible = -1
:
ArrayPolar (3)
ArrayRectangular (6)
Copy ()
Delete ()
GetBoundingBox (2)
GetExtensionDictionary ()

7. ActiveX

391

GetXData (3)
H i g h l i g h t (1)
I n t e r s e c t w i t h (2)
M i r r o r (2)
Mirror3D (3)
Move (2)
O f f s e t (1)
R o t a t e (2)
Rotate3D (3)
S c a i e E n t i t y (2)
SetXData (2)
TransfonnBy (1)
Update ()

7.1.26. ActiveX
AutoLISP ActiveX. :
;
;
;
;
;
.
. 7.27.7. ,
. 7.8 .
, ActiveX,
Sample AutoCAD 2000.

7.2.
: viax-add-ond,
vlax-remove-cmd, vlax-invoke-method vlax-product-key.

7.2.1. vlax-add-cmd
AutoCAD , :. (
:).
(vlax-add-cmd <> <> [<> <>])

392

Visual LISP AutoCAD

: <> ; <>
,
( ); <> ; <> (. ).
, <>.
<>. nil.
ObjectARX acedRegCmds
ObjectARX, AcEdcommandstack.
, viax-add-cmd, ( VLX-
).
,
(. . 7.8).
<> ,
. 7.3. - , . <> 4.
7.3. , viax-add-cmd

2
4

ACRX_CMD_TRANSPARENT

ACRX_CMD_USEPICKSET
ACRX_CMD_REDRAW

, . . AutoCAD



,
,

7.2.2. vlax-remove-cmd
AutoCAD.
(vlax-remove-cmd <>)

7. ActiveX

393

. ,
. ,
, .
( ) nil ( ).

7.2.3. vlax-invoke-method
.
(vlax-invoke-raet'nod

<>

<>

<1>

[<2>

...

[<aprN>]...]])

: <> - VLA-; <>


; <apri>, <2>, ... <> , ( ).
.
, <1>, <2>, ... <>.

AutoCAD v l a x invoke.

7.2.4. vlax-product-key
AutoCAD Windows.
(vlax-product-key)
-- .

7.3.
, VLA-. . 7.1.47.1.7, 7.1.25.

7.3.1. vlax-erased-p
, .
(vlax-erased-p <>)

<> VLA-.
, , nil, .

394

Visual LISP AutoCAD

7.3.2. vlax-method-applicable-p
, .
(vlax-method-applicable-p <> <>)

: <> VLA-; <> ( )


.
, <>,
nil, .

7.3.3. vlax-typeinfo-available-p
, .
(vlax-typeinfo-available-p <>)

<> VLA-.
() nil ( ).
, AutoCAD
.

7.3.4. vlax-object-released-p
, (. . ).
(vlax-object-released-p <>)

<> VLA-.
AutoCAD , . . . (.
. 2.17.5), vlax-release-object
(. . 7.3.5), AutoCAD.
, , nil
.

7.3.5. vlax-release-object
( . . 7.3.4).
(vlax-release-object <>)

<> VLA-.
.

7. ActiveX

395

7.3.6. vlax-read-enabled-p
, .
(vlax-read-enabled-p <>)
<> VLA-.
( ) :-,:! (
).

7.3.7. vlax-write-enabled-p
, .
(vlax-write-enabled-p <>)
<> VLA- .
( ) i-.ii ( ).

7.3.8. vlax-create-object

.
(vlax-create-object <>)
<> , .
; "<>.<>.<>" "<>. <>".
: "AutoCAD.Drawing.15", "Excel.Application".
VLA-.
(VLA-) , .

7.3.9. vlax-get-object
(VLA-)
( Application),
(vlax-get-object <>)
<> , (. vlax-create-object).
VLA-. nil.

7.3.10. vlax-get-or-create-object
, .
(vlax-get-or-create-object <>)

396

Visual LISP AutoCAD

<> , (. vlax-create-object).
VLA-.

7.3.11. vlax-import-type-library
.
(vlax-import-type-library :tlb-filename <> [:methods-prefix
<> :properties-prefix <> :constants-prefix
<>])

<>
:
( tlb);
( olb);
( );
( dll);
, ;
, .
<> , .
<> ,
, .
.
< ,
(,
- Marvel xxx-get-marvel
xxx-put-marvel). .
< ,
.
.
, n i l .

7.3.12. vlax-map-collection
.
(vlax-map-collection <>

'<>)

7. ActiveX

397

: <> VLA-, ; <>


LISP-, (. lambda, . 2.16.1).
<>.

7.3.13. vlax-for
.
(vlax-for <> <> [<1> [<2> ...
[<> ]...]])

: <> , ; <> VLA-, , ;


<1>, <2>, ... <> LISP-,
.
,
.

7.4.

, .

7.4.1. vlax-ldata-put
LlSP- .
(vlax-ldata-put <> <> <> [<>))

: <> VLA-, , ; <> ;


<> , AutoLISP (,
, . .); <> nil, .
<>.
,
.

7.4.2. vlax-ldata-get
LISP- .
(vlax-ldata-get <> <> [<> [<>]])

398

Visual LISP AutoCAD

: <> VLA-, , ; <> ;


<> , , ( nil); <> nil, .
.

7.4.3. vlax-ldata-list
LISP- .
(vlax-ldata-list <> [<>])

: <> VLA-, , ; <>


nil,
.
(
, ), : (("tank" . "-34") ("bank" .

'(57))).

7.4.4. vlax-ldata-delete
LISP- .
(vlax-ldata-delete <> <> [<>])

: <> VLA-, , ; <> ;


<> nil,
.
nil
.

7.4.5. vlax-ldata-test
,
AutoCAD.
(vlax-ldata-test <>)

<> LISP-, .
( ) nil ( ).

7. ActiveX

399

7.5.
, , . 7.1. ,
vlax-tmatrix.

7.5.1. vlax-safearray-get-dim
.
(vlax-safearray-get-dim <>)

<> .
( ). <> , .

7.5.2. vlax-safearray-get-1-bound
() .
(vlax-safearray-get-1-bound <> <>)

: <> ; <> , (
1, 2 . .).
.
, .

7.5.3. vlax-safearray-get-u-bound
() .
(vlax-safearray-get-u-bound <> <>)

: <> ; <> , (
1, 2 . .).
.
,
.

7.5.4. vlax-safearray-get-element
.
(vlax-safearray-get-element <> <1> [<2> ... [<>] ..])

400

Visual LISP AutoCAD

: <> ; <1>, <2>, ... <>


( , ).
( ).
.

7.5.5. vlax-safearray-type
.
(vlax-safearray-type <>)

<> .
(2, 3, 4, 5, 8, 9 11), . 7.1. 12. ,
.

7.5.6. vlax-safearray->list
.
(vlax-safearray->list <>)

<> .
, .

7.5.7. vlax-tmatrix
(viax-vbArray) ,
, 4x4.
(vlax-tmatrix <>)

<> ,
.
4x4.
,
.

7.6.
, . 7.1,
Auto LISP : vlax-get-property, viaxput-property, vlax-property-available-p.

7. ActiveX

401

7.6.1. vlax-get-property
.
(vlax-get-property <> <>)

: <> VLA-, <> ( )


.
(
).

AutoCAD v l a x - g e t .

7.6.2. vlax-put-property
.
(vlax-put-property <> <> <>)

: <> VLA-, <> ( )


; .
nil. .

AutoCAD v l a x - p u t .

7.6.3. vlax-property-available-p
, .
(vlax-property-available-p <> <> [<>])

: <> VLA-; <> ( )


; <> ( , ).
nil, :
1. <> nil, , , nil
.
2. <> - , ,
, nil
.

402

Visual LISP AutoCAD

7.7.
AutoLISP
(
).
, , .
.

7.7.1. vlax-curve-get Area


.
(vlax-curve-getArea <>)

<> VLA-, .
.
nil.

7.7.2. vlax-curve-getStartPoint
.
(vlax-curve-getStartPoint <>)

<> VLA-.
().
nil.

7.7.3. vlax-curve-getEndPoint
.
(vlax-curve-getEndPoint <>)

<> VLA-.
().
nil.

7.7.4. vlax-curve-getPointAtDist
( ),
.
(vlax-curve-getPointAtDist <> <>)

7. ActiveX

403

: <> VLA-, ; <>


, .
().
nil.

7.7.5. vlax-curve-getDistAtPoint

.
(vlax-curve-getDistAtPoint <> <>)

: <> VLA-; <> .


. nil.

7.7.6. vlax-curve-getStartParam
.
(vlax-curve-getStartParam <>)

<> VLA-.
.
nil.

7.7.7. vlax-curve-getEndParam
.
(vlax-curve-getEndParam

<>)

<> VLA-.
.
nil.

7.7.8. vlax-curve-getParamAtPoint
.
(vlax-curve-getParamAtPoint <> <>)

: <> VLA-; <> .


. nil.

404

Visual LISP AutoCAD

7.7.9. vlax-curve-getPointAtParam
, .
(vlax-curve-getPointAtParam <> <>)

: <> VLA-;
( ).

<>

( ). nil.

7.7.10. vlax-curve-getParamAtDist
,
.
(vlax-curve-getParamAtDist <> <>)

: <> VLA-; <> .


. nil.

7.7.11. vlax-curve-getDistAtParam

.
(vlax-curve-getDistAtParam <>

<>)

: <> VLA-; <> .


. nil.

7.7.12. vlax-curve-isClosed
, (. .
).
(vlax-curve-isClosed <>)

<> VLA-.
() nil ().

7.7.13. vlax-curve-isPehodic
, , . .
,

7. ActiveX

405

dT (),
.
(vlax-curve-isPeriodic <>)

<> VLA-.
() nil ().

7.7.14. vlax-curve-isPlanar
, .
(vlax-curve-isPlanar <>)

<> VLA-.
() nil ().

7.7.15. vlax-curve-getClosestPointTo
( ),
.
(vlax-curve-getClosestPointTo <> <> [<>])

: <> VLA-; <> ; <> (


nil, ).
( ), . nil.

7.7.16.
vlax-curve-getClosestPointToProjection
( ),
.
(vlax-curve-getClosestPointToProjection <> <> <>
[<>])

: <> VLA-; <> ( , ); <>


( ), ; <>
( nil, ).

406

Visual LISP AutoCAD

( ),
. nil.

7.7.17. vlax-curve-getFirstDeriv
( ) .
(vlax-curve-getFirstDeriv <> <>)

: <> VLA-, ; <>


, .
(
). nil.

7.7.18. vlax-curve-getSecondDeriv
( ) .
(vlax-curve-getSecondDeriv <> <>)

: <> VLA-, ; <>


, .
(
). nil.

7.8.
, ,
. ( , , . .).
ActiveX , ,
. VLR-.

7.8.1.
,
. () ,
AutoLISP ( ,
action t i l e ).
, vir-, : , , . .

407

7. ActiveX

, vi-ioad-com, AutoLISP.
vl-load-com v l - l o a d - r e a c t o r s .

, , . 7.4.
7.4.

:VLR-AcDb-Reactor

:VLR-DocManager-Reactor

:VLR-Linker-Reactor

:VLR-Object-Reactor

:VLR-Editor-Reactor

( )

. , (, , . .).
ARX-.
.
AutoCAD 2000
. , . 7.5.
7.5.

:VLR-Command-Reactor

:VLR-DeepClone-Reactor

:VLR-DWG-Reactor

DWG-

:VLR-DXF-Reactor

DXF-

:VLR-Insert-Reactor

(INSERT)

:VLR-Lisp-Reactor

LISP-

:VLR-Miscellaneous-Reactor

:VLR-Mouse-Reactor

408

Visual LISP AutoCAD


7.5 ()

:VLR-SysVar-Reactor

:VLR~Toolbar-Reactor

:VLR-Undo-Reactor

(UNDO)

:VLR-wbiock-Recator

(WBLOCK)

:VLR-window-Reactor
:VLR-XREF-Reactor

AutoCAD

,
.

7.8.2. vIMypes
.
(vlr-types)

, ( . 7.4 7.5).

7.8.3. vlr-reactors
.
(vlr-reactors [<1> [<2> ... [<>]...]])
. 7.4 7.5
. ,
.
, .
: (<> <> <> ...),
:

(:VLR-Object-Reactor #<VLR-Object-Reactor> #<VLR-Object-Reactor>)


,
VLR- ().
(VLR-).
, nil.

7. ActiveX

409

7.8.4. vlr-type
.
{vlr-type <>)

<> VLR-.

.

7.8.5.
(callback events),
. , ,
vlr-reaction-names

(. . 7.8.6).
(callback function)
( defun), :
command;
entmod
entget, ActiveX.
(
):
VLR- ( , ' );
, AutoCAD.
. VLA- (), VLR- .

, .
(. . 7.8.9).
AutoCAD (vir-beepreaction vl::-trace-reaction), .

7.8.6. vlr-reaction-names
, .
(vlr-reaction-names <>)

<> (. . 7.4 7.5).

410

Visual LISP AutoCAD

,
.
:

( v l r - r e a c t i o n :VLR-Undo-Reactor)
(:VLR-undoSubcommandAuto :VLR-undoSubcommandControl
:VLR-undoSubcommandBegin :VLR-undoSubcoiranandEnd
:VLR-undoSubcommandMark :VLR-undoSubcommandBack
:VLR-undoSubcommandNumber)

7.8.7. vlr-beep-reaction
.
(vlr-beep-reaction [<>])

. (
).
nil.

7.8.8. vlr-trace-reaction
, ,
(Trace) Visual LISP.
(vlr-trace-reaction [<>])

.
.
nil.
. vir-reaction-set (. 7.8.29).

7.8.9.
(VLR-),
, (
:VLR-object-Reactor, . . ).
, , ,
. 7.4 7.5, : :VLR-LinkerReactor ( ARX-) vir-iinker-reactor.
.
(
, ).

7. ActiveX

411

.
VLA- ,
(owners) . . vir-objectreactor.

vir-reactionset (. ).

7.8.10. vlr-acdb-reactor
:VLR-AcDb-Reactor ( , ).
(vlr-acdb-reactor <> <>)

: <> (, ,
. .), AutoLISP (nil, ); <>
.
VLR- ().
<> :
(<> . <>)

:
D

(:vlr-objectAppended . myrfun)

. 7.6.
, .

, . .
. 7.8.5.
7.6. , :VLR-AcDb-Reactor

:vir-objectAppended

:vlr-objectunAppended

(,
(UNDO))

:vlr-objectReAppended

(,
(REDO))

:vir-objectOpenedForModify

412

Visual LISP AutoCAD


7.6 ()

:vir-objectModified

:vir-objectErased

:vir-objectunErased

7.8.11. vlr-docmanager-reactor

, ).

:VLR-DocManager-Reactor

( -

(vlr-docmanager-reactor <> <>)


: <> , AutoLISP
(nil, ); <> .
. 7.7.
, . 7.8.
VLR- ().
7.7. ,
:VLR-DocManager~Reactor

:vlr-documentcreated

(
)

: vi r-documentToBeDest royed

: vir-documentLockModeWiilcharige

:vlr-documentLockModeChangeVetoed



:vlr-documentLockModeChanged

:vir-documentLockModeChanged
:vir-documentBecameCurrent

( , )

7. ActiveX

413
7.7 ()

:vlr-documentToBeActivated

, ,

:vlr-documentToBeDeactivated

(
, AutoCAD)

. 7.8 , ,
AutoCAD.
7.8. ,
:VLR-DocManager-Reactor

vlr-documentCreated,
1
vlr-documentToBeDestroyed,
vlr-documentBecameCurrent,
vlr-documentToBeActivated,
vlr-documentToBeDeactivated
vlr-documentLockModeCbangeVetoed 2

:vlr-documentLockModeWillChange,
:vlr-documentLockModeChanged

VLA- ()

1 VLA- ; 2
,
(
,
#)
1 VLA- ;
2 ,
; 3 , ; 4
; 5
, ( ,

#).

: 1
; 2 ;
4 ; 8 ; 10

414

Visual LISP AutoCAD

7.8.12. vlr-Hnker-reactor
:VLR-Linker-Reactor (
ARX-).
(vlr-linker-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.9.
, AutoCAD
,
.
VLR- ().
7.9. ,

:VLR-Lnker-Reactor

:vir-rxAppLoaded

ObjectARX,

:vir-rxAppUnLoaded

ARX-,

7.8.13. vlr-object-reactor
:VLR-object-Reactor ( ). , .
(vlr-object-reactor <> <> <>)

: <> VLA-,
; <> , AutoLISP (nil,
); <>
.
. 7.10.
VLR- (), .
, . 7.11.

415

7. ActiveX

7.10.,

:VLR-Object-Reactor

:vlr-cancelled

:vlr-copied

:vlr-erased

:vlr-unerased

:vlr-goodbye

:vlr-openedForModify

:vlr-modified

. ,
: v l r - c a n c e l l e d
:vlr-modifyUndone

:vlr-subObjModified

(,
)

:vlr-modifyUndone

:vlr-modifiedXData

:vlr-unappended

:vlr-reappended

:vlr-obj ectClosed

7.11. ,

:VLR-Object-Reactov

0
:vlr-cancelled, :vlr-erased,
: vlr-unerased, :vlr-goodbye,
:vlr-openedForModify,
: vlr-modif ied, : vlr-modif yUndone,
: vlr-modif iedXData, : vlr-unappended,
:vlr-reappended, :vlr-objectClosed
:vlr-copied

:vlr-subObjModified

416

Visual LISP AutoCAD

:
(setq myVLR (vlr-objeet-reactor (list linel) " "
1
((:vir-modified . showien)))) linel (,
VLA-);
showien (,
)

7.8.14.vlr-editor-reactor
:VLR-Editor-Reactor ( ).
.
(vlr-editor-reactor <> <>)
: <> , AutoLISP
(nil, ); <> .
. 7.12.
- VLR- ().
, . 7.13.
7.12. ,
:VLR-Editor-Reactor

:vlr-beginciose
:vlr-beginDxfin


DXF-

DXF-

:vlr-abortDxfin
: vir-dxf incomplete

DXF-

:vir-beginDxtOut

DXF-

:vir-abortDxfOut

DXF-

DXF-

:vir-dxfoutcompiete
:vir-databaseToBeDestroyed

7. ActiveX

417
7.12 ()

:vlr-unknownCommand

, AutoCAD

:vlr-commandWillStart

AutoCAD

:vlr-commandEnded

:vlr-commandCancelled

:vlr-commandFailed

:vlr-lispWillStart

LISP-

:vlr-lispEnded

LISP-

:vlr-lispCancelled

LISP-

:vlr-beginDwgOpen

:vlr-endDwgOpen

:vlr-dwgFileOpened

:vlr-beginSave

:vlr-saveComplete

:vlr-sysVarWillChange

:vlr-sysVarChanged

7.13. ,

:VLR-Editor-Reactor

:vlr-lispEnded,
:vlr-lispCancelled,
:vlr-beginClose,
:vlr-beginDxfIn,
:vlr-abortDxfIn,
:vlr-dxfIncomplete,
:vlr-beginDxfOut,
:vlr-abortDxfOut,
:vlr-dxfOutComplete,
:vlr-databaseToBeDestroyed
14 155

418

Visual LISP AutoCAD


7.13 ()

:vlr-unknownCoinmand,
:vlr-commandWillStart,
:vlr-commandEnded,
:vlr-commandCancelled,
:vlr-comnandFailed

:vlr-lispWillStart


( LISP-)

:vlr-beginDwgOpen,
:vlr-endDwgOpen,
:vlr-dwgFileOpened

:vlr-beginSave

, (
)

:vir-saveComplete

:vlr-sysVarWillChange

:vlr-sysVarChanged

1 , 2
(1
, 0
)

7.8.15. vlr-command-reactor
:VLR-command-Reactor ( ).
(vlr-connnand-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.14.
, AutoCAD
,
.
VLR- ().

419

7. ActiveX

7.14. ,
:VLR-Command-Reactor

:vlr-unknownCommand

, AutoCAD

:vlr-commandWillStart

AutoCAD

: vlr-coimandEnded

:vlr-commandCancelled

:vlr-cornmandFailed

7.8.16. vlr-deepclone-reactor
:VLR-DeepCione-Reactor ( , . . ).
(vlr-deepclone-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.15.
VLR- ().
, . 7.16.
7.15. ,

:VLR-DeepClone-Reactor

:vlr-beginDeepClone

:vlr-beginDeepCloneXlation

:vlr-abortDeepClone

:vlr-endDeepClone

14*

420

Visual LISP AutoCAD


7.16. ,

:VLR-DeepClone~Reactor

:vlr-beginDeepClone,
: vlr-abortDeepClone,
:vlr-endDeepClone
:vlr-beginDeepCloneXlation


(
,
)

7.8.17. vlr-dwg-reactor
:VLR-DWG-Reactor ( , DWG-).
(vlr-dwg-reactor <> <>)
: <> , AutoLISP
(nil, ); <> .
. 7.17.
VLR- ().
, . 7.18.
7.17. , :VLR-DWG-Reactor

:vlr-beginClose

:vlr-databaseConstructed

:vlr-databaseToBeDestroyed

:vlr-beginDwgOpen

DWG-

:vlr-endDwgOpen

DWG-

:vlr-dwgFileOpened

AutoCAD

7. ActiveX

421

7.17 ()

:vlr-beginSave

:vlr-saveComplete

7.18. ,
-.VLR-DWG-Reactor

:vlr-beginClose,
: vlr-databaseConstructed,
:vlr-databaseToBeDestroyed

:vlr-beginDwgOpen,
:vlr-endDwgOpen,
:vlr-dwgFileOpened

:vlr-beginSave

:vlr-saveComplete

7.8.18. vlr-dxf-reactor
:VLR-DXF-React ( , DXF-).
(vlr-dxf-reactor <> <>!

: <> , AutoLISP
(nil, ); <> - .
. 7.19.
VLR- ().
.

422

Visual LISP AutoCAD


7.19. , -.VLR-DXF-Reactor

vlr-beginDxf i n

DXF-

vir-abortDxf i n

DXF-

v i r - d x f incomplete

DXF-

vir-beginDxfOut

DXF-

vlr-abortDxfOut

DXF-

v i r - d x f Outcomplete

DXF-

7.8.19. vlr-insert-reactor
.-VLR-insert-Reactor ( ,
).
(vlr-insert-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.20.
VLR- ().
, . 7.21.
'
7.20. ,
:VLR-Insert-Reactor

:vir-begininsert

:vir-begininsertM

:vir-otherinsert

:vir-endinsert

, (
:vlr-commandEnded)

.-vir-abortinsert

( )

423

7. ActiveX

7.21. ,

:VLR-Insert-Reactor

:vlr-beginlnsert

1 VLA- ( ,
); 2 ;
3 VLA- ( ,
)

:vlr-beginlnsertM

1 VLA- ( ,
); 2
; 3 VLA- ( ,
)

:vlr-otherlnsert

1 VLA- ( ,
); 2 VLA- (
, )

:vlr-endlnsert,
:vlr-abortInsert

VLA- ( , )

7.8.20. vlr-lisp-reactor
:VLR-Lisp-Reactor ( , LISP-).
(vlr-lisp-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.22.
VLR- ().
, . 7.23.
7.22. , -. VLR-Lisp-Reactor

:vlr-lispWillStart

LlSP-

:vlr-lispEnded

LlSP-

:vlr-lispCancelled

LlSP-

424

Visual LISP AutoCAD


7.23. ,
:VLR-Lisp-Reactor

:vlr-lispEnded,
:vlr-lispCancelled

:vir-lispwiiistart

LISP-

7.8.21.vlr-miscellaneous-reactor
:VLR-Misceiianeous-Reactor ( ,
).
(vlr-miscellaneous-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.24.
VLR- ().
, . 7.25.
7.24. ,
:VLR-Miscellaneous-Reactor

:vlr-pickfirstModified

: vlr-layoutswitched

7.25. ,
:VLR-Miscellaneous-Reactor

:vlr-pickfirstModified

:vlr-layoutswitched

7. ActiveX

425

7.8.22.vlr-mouse-reactor
:VLR-Mouse-Reactor ( ,
).
(vlr-mouse-reactor <> <>)
: <> , AutoLISP
(nil, ); <> .
. 7.26.
VLR- ().

.
7.26. ,

:vlr-beginDoubleClick
:vlr-beginRightciick

:VLR-Mouse-Reactor

7.8.23.vlr-sysvar-reactor
:VLR-SysVar-Reactor ( ,
).
(vlr-sysvar-reactor <> <>)
: <> , AutoLISP
(nil, ); <> .
. 7.27.
VLR- ().
, . 7.28.
7.27. ,

-.VLR-SysVar-Reactor

-.vlr-sysVarWillchange

Visual LISP AutoCAD

426

7.27 ()

:vlr-sysVarChanged

7.28. ,
:VLR-SysVar~Reactor

:vlr-sysVarWillChange

:vlr-sysVarChanged

1 ;
2
( , n i l )

7.8.24. vir-toolbar-reactor
:VLR-Tooibar-Reactor ( ,
).
(vir-toolbar-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.29.
VLR- ().
7.29. ,
:VLR-Toolbar-Reactor

:vlr-toolbarBitmapSizeWillChange

:vlr-toolbarBitmapSizeChanged

,
AutoCAD, : ,
, nil .

427

7. ActiveX

7.8.25.vlr-undo-reactor
:VLR-undo-Reactor ( ,
(UNDO)).
(vlr-undo-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.30.
VLR- ().
, . 7.31.
7.30. ,
:VLR-Undo-Reactor

:vlr-undoSubcommandAuto

(UNDO) (Auto)

:vlr-undoSubcommandControl (UNDO) (Control)

:vlr-undoSubcommandBegin

(UNDO) (Begin) (Group)


( ,
)

:vlr-undoSubcommandEnd

(UNDO) (End) ( ,
)

:vlr-undoSubcommandMark

(UNDO) (Mark) (
(Back)
(UNDO))

:vlr-undoSubcommandBack

(UNDO) (Back) (
,
(Mark))

:vlr-undoSubcommandNumber

(UNDO) ,

428

Visual LISP AutoCAD


7.31. ,

:VLR-Undo-Reactor

:vlr-undoSubcommandAuto

1
( 4, . . ); 2
, (Auto) ( , n i l )

:vlr-undoSubcommandControl

1
( 4, . . ); 2
, (Control)
( (None),
1 (One), 2
())

: vlr-undoSubcommndBegin,
:vlr-undoSubcommandEnd,
:vlr-undoSubcommandMark,
:vlr-undoSubcommandBack

( (UNDO))

: vlr-undoSubcommandNuinber

1 0 ( ); 2
,

7.8.26.vlr-wblock-reactor
:VLR-wbiock-Reactor ( ,
(WBLOCK)).
(vlr-wblock-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.32.
VLR- ().
, . 7.33.

7. ActiveX

429
7.32. ,

:VLR-Wblock-Reactor

:vlr-wblockNotice

(WBLOCK)

:vlr-beginWblockPt

:vlr-beginWblockId

:vlr-beginWblock

(
,
)

:vlr-otherWblock

( , ).

(, )

beginDeepCloneXlation

:vlr-abortWblock

:vlr-endWblock

:vlr-beginWblockObjects

7.33. ,
:VLR-Wblock-Reactor

:vlr-wblockNotice

VLA-,

:vlr-beginWblockPt

1 VLA- , ; 2 VLA-
; 3
,

:vlr-beginWblockld

1 VLA- , ; 2 VLA-
; 3

:vlr-beginWblock:,
vlr-otherWblock

1 VLA- , ; 2 VLA-

430

Visual LISP AutoCAD


7.33 ()
-

:vlr-abortWblock,
:vlr-endWblock

VLA- ,

:vlr-beginWblockObjects

1 VLA- , ; 2

7.8.27. vlr-window-reactor
:VLR-window-Reactor ( ,
, AutoCAD).
(vlr-window-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.34.
VLR- ().
, . 7.35.
7.34. ,
:VLR-Window-Reactor

:vlr-docFrameMovedOrResized

:vlr-mainFrameMovedOrRes i zed

7.35. ,
:VLR-Window-Reactor

:vlr-docFrameMovedOrResized,
:vlr-mainFrameMovedOrResized

1 ; 2 (
, n i l
)

431

7. ActiveX

7.8.28. vlr-xref-reactor
:VLR-XREF-Reactor ( , ).
(vlr-xref-reactor <> <>)

: <> , AutoLISP
(nil, ); <> .
. 7.36.
VLR- ().
, . 7.37.
7.36. ,
:VLR-XREF-Reactor

:vlr-beginAttach

:vlr-otherAttach

,
.

beginDeepCloneXlation

:vlr-abortAttach

:vlr-endAttach

:vlr-redirected

:vlr-comandeered

:vlr-beginRestore

( )

:vlr-abortRestore

:vlr-endRestore

(, )

432

Visual LISP AutoCAD


7.36 ()

: vlr-xref SubcornmandBindltem

(Bind) (XREF)
.

:vlr-xrefSubcommandAttachltem

(Attach)
(XREF)
.

:vlr-xrefSubcommandOverlayltem

(Overlay)
(XREF)
.

:vlr-xrefSubcommandDetachltem

(Detach)
(XREF).

:vlr-xrefSubcommandPathltem

(Path)
(XREF).

:vlr-xrefSubcommandReloadltem

(Reload)
(XREF)
.

:vlr-xrefSubcommandUnloadltem

(Unload)
(XREF)

7.37. ,

:vlr-beginAttach

: VLR-XREF-Reactor

1 VLA- (
,
); 2 ; 3 VLA-
( ,
)

7. ActiveX

433

7.37 ()

:vlr-otherAttach

1 VLA- (
,
); 2 VLA- (
,
)

:vlr-abortAttach

VLA- (
,
)

:vlr-endAttach

VLA- ( , )

:vlr-redirected

1

; 2

:vlr-comandeered

1 VLA- (
,
); 2 ; 3
VLA- ( ,
)

:vlr-beginRestore

1 VLA- (
,
); 2
;
3 VLA- (
,
)

:vlr-abortRestore,
:vlr-endRestore

VLA- ( , )

:vlr-xrefSubcommandBindltem

1 ,
() (Bind) (0
(Bind); 2
; 3
; 4 (Bind) ; 5 (Bind)

434

Visual LISP AutoCAD


7.37 ()

(.)

; 6 (Bind) ;
7 XDep
(XBIND); 8 : , ,
, );
2

: vlr-xrefSubcontmandAttachltem

1 ,

() (Attach) (0

(Bind); 2
; 3
; 4
(Bind) ; 5
(Bind)
; 6 (Bind) );
2
n i l

:vlr-xrefSubcommandOverlayItem

:vlr-xrefSubcommandDetachltem

1 ,
() (Overlay) (0 (Bind);
2 ; 3 ; 4
(Bind) ; 5
(Bind)
; 6 (Bind) );
2
n i l
1 ,
() (Detach) (0
(Bind); 2
; 3

7. ActiveX

435
7.37 ()

(.)

; 4 (Bind) ; 5 (Bind)
; 6 (Bind) );
2

:vlr-xrefSubcoim\andPathItem

1 ,
() (Path) (0 (Bind); 2
; 3
; 4 (Bind) ; 5 (Bind)
; 6 (Bind) );
2
0;
3
n i l

:vlr-xrefSubcommandReloadItem

1 ,

() (Reload) (0 (Bind);
2 ; 3 ; 4
(Bind) ; 5
(Bind)
; 6 (Bind) );
2
0

:vlr-xrefSubcommandUnloadltem

1 ,
() (Unload) (0 (Bind);
2 ; 3 ; 4

436

Visual LISP AutoCAD


7.37 ()
-

(.)

(Bind) ; 5
(Bind)
; 6 (Bind) );
2

7.8.29. vlr-reaction-set
.
(vlr-reaction-set <> <> '<>)
: <> VLR-; <> ,
; <> ( ) .
.
:

(vlr-reaction-set vrl2

:vlr-commandWillStart

'vlr-trace-reaction) -

vri2 ,
:vlr-commandWillStart, vlr-trace-reaction

7.8.30.
AutoLISP
. , , , . , ,
, , .
. 7.8.31
7.8.48.

7.8.31. vlr-reactions
.
(vlr-reactions <>)

<> VLR-.
(<> . <>).

7. ActiveX

437

7.8.32. vlr-remove
, ( ).
(vlr-remove <>)
<> VLR-.
<>. nil.

7.8.33. vlr-remove-all
.
(vlr-remove-all [<>])
<> , (. . 7.4 7.5). , .
.
: (<> <-> ...), (, :VLR-CommandReactor), VLR- ().
, nil.

7.8.34. vlr-add
() .
(vlr-add <>)

<> VLR-.
<>.

7.8.35. vlr-added-p
, .
(vlr-added-p <>)

<> VLR-.
( ), nil ( ).

7.8.36. vlr-current-reaction-name
, .
(vlr-current-reaction-name)

438

Visual LISP AutoCAD

, .

7.8.37. vlr-data
, ( , , . . 7.8.9).
(vlr-data <>)

<> VLR-.
, .

7.8.38. vlr-data-set
, .
(vlr-data-set <> <>)

: <> VLR-; <> , .


<>.

7.8.39. vlr-owner-add
:VLR-object-Reactor
( . . 7.8.9 7.8.13).
(vlr-owner-add <> <>)

: <> VLR- (); <> VLA-,


(,
).
<>.

7.8.40. vlr-owner-remove
:VLR-object-Reactor.
(vlr-owner-remove <> <>)
: <> VLR- (); <> VLA-,
.
<>.

7.8.41. vlr-owners
: VLR-j ect-Reactor.
(vlr-owners <>)

7. ActiveX

439

<> VLR- ( ).
, VLA-.

7.8.42. vlr-notification
.
(vlr-notification <>)

<> VLR-.
:
ail-documents ;
active-document-only .

7.8.43. vlr-set-noiification
, .
(vlr-set-notification <> \<>)

: <> VLR- (); <>


(all-documents , active-document-only ). .
<>.

7.8.44.
(transient), . .
. ActiveX
AutoCAD 2000 .
(persistent)
AutoCAD ( ,
).
vir-pers,
vlr-pers-release.
vir-pers-p, , vir-pers-iist,
.
, . 7.8.457.8.48.

440

Visual LISP AutoCAD

7.8.45. vlr-pers
.
(vlr-pers <>)

<> VLR- ().


vlr-pers <>. , nil.

7.8.46.vlr-pers-release
.
(vlr-pers-release

<>)

<> VLR-.
vlr-pers-release <>. nil.

7.8.47.vlr-pers-p
.
(vlr-pers-p <>)

<> VLR- ().


<>, . ,
nil.

7.8.48.vlr-pers-list
.
(vlr-pers-list [<>])

<> ,
(. . 7.4 7.5).
VLR- ( ). <> ,
.

7.8.49.
, ActiveX.
,

7. ActiveX

441

,
AutoCAD.
Autodesk .
1. .
, (OPEN) :vircommandWillStart, :vlr-beginDwgOpen, :vlr-endDwgOpen, :vlr-commandEnded.

. , -.vircommandwilistart :vir-commandEnded,
:vlr-beginDwgOpen :vlr-endDwgOpen.

2. , .
3. , getkword, getpoint, entsei . . ,
command.

4. . , ,
.
5. , , , .
6. , , , (
).
7. ,
.
.
8. AutoCAD
.

7.8.50.
, :VLR-object-Reactor
.
:vir-modified.
, , showien. , :
VLA-;
VLR- ();
( ,
. 7.11).

442

Visual LISP AutoCAD

7.4 , . (star) AutoLISP, . (showien)


.
! 7.4.

; .., 2001 .
(defun star ( / ww i wl ae)
(princ "\ : ")
(setq ww (ssget))
(if ww
(progn
(princ (strcat "\ " (itoa (sslength ww)) " . "))
(vl-load-com)
(setq axl nil)
;
(setq i -1 wl (sslength ww))
(repeat wl
; ww VLA-
(setq i (1+ i) ae (vlax-ename->vla-object (ssname ww i)))
(setq axl (append axl (list ae)))
); repeat
(setq liner
(vlr-object-reactor axl " ; "
(list '(:vlr-modified . showien))
)
);setq

(defun showien (vlao reac args /)


(princ (strcat "\n" (vlr-data reac) (rtos (vla-get-length vlao) 2 2)))
);defun

, . 7.1, . .
star
,
:VLR-object-Reactor ( liner).
( , ,
).
-

7. ActiveX

443

:vir-modified, liner :
; 172.42
; 261.51
viaget-iength, VLA- .
star :
(vlr-pers liner)


AutoCAD showien, .
\St AutoCAD 2000 - [Diawingi]
| $ 2 ^ 2

-|||

D * | # ' <* i * to ft rfI "> ' ! "S ss, JS,! ; * < QJ

| ; 172.42
; 261.51
{

ijii'sfe^&^1"~^1~1:1. i!iii!tft 51^',: act;


. 7 . 1 .

~^LJ"JJ"

AutoCAD 2000i
AutoCAD 2000i , AutoCAD 2000
.
, ,
.
AutoCAD 2000i
(Startup), . 1.1,
AutoCAD Today (AutoCAD ) (. 8.1).
:
My Drawings ( );
Bulletin Board ();
Autodesk Point A.
Autodesk Point ,
, , Autodesk, .
, Autodesk
.
AutoCAD Today (AutoCAD )
My Drawings ( )
(Startup) AutoCAD 2000. :
Open Drawings ( );
Create Drawings ( );
Symbol Libraries ( ).

445

8. AutoCAD 2000\
"AutoCAD Today

p
nth
D
a
rw
nigo
s
i
Soe
e
lec
ow
t \b|e
Hgsn
itoyi(byDate)j^Jorptpvyge,
Norecentfe
lis
*-

You can include a bulletin board to post


your own Web page. CAO managers
can use this feature to communicate
with their design team, providing links to
block libranes, CAD standards, or other
files and folders available on the
company intranet
Edit this default view by clicking the edit
button above.

*,

. 8 . 1 . AutoCAD Today

Open Drawings ( )
. Create Drawings ( )
Autodesk
.

Symbol Libraries ( ) (. 8.2).
'<:'..

" -. "". ".'!*. "21 sVmWLibraries \

DesignCenter Symbol Libraries orEdJi^


1
2
3
4
5
6
7

House Designer.
Kitchens
Fasteners - US
Hydraulic - Pneumafc
Basic Eledronict
Home - Space Planner
Landscaping
HVAC - Healing Ventilation Air Conditioning
Plant Process

ft:
4

. 8.2.
Symbol Libraries

AutoCAD (.
. 1.6), .
Edit (),
Edit DesignCenter Symbol Libraries ( ) (. 8.3).

446

Visual LISP AutoCAD

' Edit DesignCenter Symbol Libiaiies


. Symbol libraries; J:
;: Library name!
jHouse Designef
Ktichens

Fasteners - US
Hydrauc
li Pneumatc
i
Basc
i Electronics
Home - Space Pa
l nner
Landscapn
ig

Brpwie--v
Library drawing file'
p:WTOMD20O0l\Sarnple\DesignCenter\Hoased

HVAC - Heating Ventilation Air


Plant Process
;
Fasteners Metric
"*
Welding
Pipe Fittings
il PniAiar
^

._ flemove link

. 8.3. Edit DesignCenter Symbol Libraries


.
Bulletin Board ()
.
Edit (), (. 8.4) , AutoCAD.

.
I 3|D:\AutoCAD2000i\e(licaclmgi.htm - Microsoft Internet Explorer
CAD managers can connrnunicate directly -with their local user base
throughout the day with messages, reminders; calendars, and links to things
like standards and content libraries stored locally.
Enter Path to the Local Server:

. Browse...

. 8.4.

. 8.5 Bulletin Board () .

447

8. AutoCAD 2000i

2111

. 8.5.

, (Startup) AutoCAD 2000, AutoCAD Today (AutoCAD


). Options () Tools () System ()
Options () (. 8.6).

' '-W^"*.j.P$^i^ij^O(M^d;/^j.::^cJ^g;'l-.'iSi'^eif| ] User Preferences | Oiaffing| Selection) Profiles!


^ ^ - " - - 5 : ; r.general Optkin u.---;--^-.- -~~~
JGSHEIDI10
.''i'.'.;''~P':' Displaiji'ltE pibperties dialog
Current Pointing Device >:'-'
/ " fl&ep;on error in user input
:..'" t,obdaoad.ispwith e^erydrawing
Show TODAY startup dialog
Show traditional startup dialog
i^-rf:;;p Live Enabler fj Do not show a startup dialog
: i CHWik. Autodesk Point A for Live E hablers:
: ;| -.?*' When Autodesk Point A is available in Today
jJ />: I

15

Minimum number of unsuccessful checks

. 8.6. System Options

r[

448

Visual LISP AutoCAD

Startup (),
:
Show TODAY startup dialog ( AutoCAD );
Show traditional startup dialog ( );
Do not show a startup dialog (He ).
AutoCAD, . 1.1.

,

. 1.1 ,
AutoCAD 2000. .
1.1.

ahp

del

hdx

ini

I'm

Isp

AutoLISP

mln

mnl

AutoLISP,
( mnu)

mns

,
( mnu)

mnu

pat

pgp

(. acad.pgp
. 1.2)

ps

(PSIN) (. fontmap.ps . 1.2)

15

. 155

450

Visual LISP AutoCAD


1.1 ()

psf

(PSOUT) (PSFILL)
(. acad.psf . 1.2)

ObjectARX (. acad.rx . 1.2)

scr

, AutoCAD
AutoLISP ( )
(
shx)

shp
unt

(. acad.unt . 1.2)

ahp, -,
. AutoCAD 2000, ahp, hip, Microsoft Help Workshop.

. 1.2
, . .
1.2.

acad.dcl

Support

AutoCAD

base.del

Support

acad.lin

Support

AutoCAD

acadiso.lin

Support

,
ISO

acad.lsp

User


AutoLISP (
AutoCAD)

acaddoc.lsp

User


AutoLISP ( )

acad2000.lsp

Support


AutoLISP (
AutoCAD)

1. ,

451

1.2 ()

acad2000doc.lsp

Support


AutoLISP ( )

acad.mln

Support

AutoCAD

acad.mnl

Support

AutoLISP ( acad.mnu, acad.mns)

acad.mns

Support

,
acad.mnu

acad.mnu

Support

AutoCAD

acad.pat

Support

AutoCAD

acadiso.pat

Support

AutoCAD,
ISO

acad.pgp

User


(
Support)

fontmap.ps

Fonts

PostScript ( (PSIN))

acad.psf

Support

PostScript ( (PSOUT)
(PSFILL))

acad.rx

User

ObjectARX, AutoCAD

Itypeshp.shp

Support

,
acad.lin

acad.unt

Support

Support Fonts ( d:\AutoCAD 2000). User ,


.

15*


acad.pgp
acad.pgp
AutoCAD.
I 2.1. acad.pgp AutoCAD
:
;

AutoCAD 2000

Copyright () 1997-1999 by Autodesk, Inc.

AutoCAD (Support) acad.pgp
.

AutoCAD
, , Windows.

( AutoCAD)
( ).

'
(), acad.pgp.
AutoCAD,
.
: ,
.
:
< >,[< DOS>],< >,[*]<>,

|
1

2. acad.pgp

453

:
1: ,
2: ,
4: , ""
8: ,
.
2 4 ; ,
2 . 0 (
), 1 (
), 3 ( ) 5 ( ).
2 4 , AutoCAD
.
8 , DEL
, (, "long filename.dwg"). ,

, .
8 .;

,
DIR /W,
8, : ,
DEL,
DEL,
8, (): ,
DIR,
DIR,
8, : ,
START EDIT,
,
9, : ,
1,
r
1,* : ,
,
r
1,* : ,
SH,
t
1,* : ,
START,
START,
1, * : ,
TYPE,
TYPE,
8, : ,
;
;

Windows
. AutoLISP- (STARTAPP) .

EXPLORER,
NOTEPAD,
PBRUSH,

START EXPLORER, 1,,


START NOTEPAD, 1,* : ,
START PBRUSH,
1, ,

:
<>,*< >
.
1.
. , ,
,
. : Ctrl-N, -, - -S
, , .
2. , ,
.

454

Visual LISP AutoCAD

3.
. : , .
4.
. : , - -.

.

,
,
30,
,
,
TI,
AT,
-AT,
ATP,
-ATP,
,
-,
,
,
,

-,
,
,

,
-,
,
,
,
,

,
,
,
,
,
,
-,
,
,

,
.
,
,
-,

*3-
*3-
*3-0

*-
*THICKNESS
*TILEMODE
*
*-
*
*-
*

*-
*
*
*
*-
*0
*
*
*-
*
*
*
*
*
*
*
*
*
*
*-
*
*

*
*
*
*-
*0

2. acad.pgp
,

,
-,
,

,
-,
,
,
-,
,
,

,
,
,
-,
,
,
,
,
,
,
,
,
,
,
,
-,
,

*
*30
*-30
*30
*
^
*
*
*-
*30
*30
*
*
*
*-
*
*

*
*

*
*
*

*-
*
*
*-
*
*
,
*
,
*
,
*
,
*
,
*3-
,
*
,
*00
,
*030
,
, *-
*
,
*
,
*
,
*-
-,
,
*
,
*
*-
-,
*
,

455

456
,
,
,
,

,
,

,
,
,
,
,
-,
,

,
,
,
,
,
PACK,
,
,
,

,
,
,
,
,
,
POP,
,
,
,
,
,
,
,
,
,
,
,

,
,

,
,
,

-,

Visual LISP AutoCAD


^
*
*
*0
*
*
*
*
*
*
*
*-
*
*
*
*
*
*
*
*
*30
*
*
*
*
*-
*
*
*
*
*0
*
*
*
*
*
*00
*
*
*
^
*
*
*
*
*-

2. acad.pgp
con,
,

,
-,
.
,

'*
*
*-

-,

-,

,
,
,
,
,
,

,
,

,
,

,
-,
,
.
;

Release 14

,
, *
, *
; AutoCAD 2000:
AAD,
,
ALI,
ASQ,
ARO,
ASE,
,
,
,
,
,

DBCONNECT
DBCONNECT
DBCONNECT
DBCONNECT
DBCONNECT
DBCONNECT

457

Visual LISP AutoCAD

458
, *
,
*
,
"
,
*
,
*DDRMODES
,
*DDGRIPS
,
"DWFOUT

-,
,
,
,

*-REFEDIT
*REFEDIT
*REFCLOSE
*REFSET

j 2.2. acad.pgp AutoCAD


AutoCAD Program Parameters File For AutoCAD 2000
External Command and Command Alias Definitions
Copyright (C) 1997-1999 by Autodesk, Inc.
Each time you open a new or existing drawing, AutoCAD searches
the support path and reads the first acad.pgp file that it finds.
External Commands
While AutoCAD is running, you can invoke other programs or utilities
such Windows system commands, utilities, and applications.
You define external commands by specifying a command name to be used
from the AutoCAD command prompt and an executable command string
that is passed to the operating system.
-- Command Aliases
You can abbreviate frequently used AutoCAD commands by defining
aliases for them in the command alias section of acad.pgp.
You can create a command alias for any AutoCAD command,
device driver command, or external command.
Recommendation: back up this file before editing it.
External command format:
<Command name>,[<DOS request>],<Bit flag>,[*]<Prompt>,
The
Bit
Bit
Bit
Bit

bits of the bit flag have the following meanings:


1: if set, don't wait for the application to finish
2: if set, run the application minimized
4: if set, run the application "hidden"
8: if set, put the argument string in quotes

Fill the "bit flag" field with the sum of the desired bits.
Bits 2 and 4 are mutually exclusive; if both are specified, only
the 2 bit is used. The most useful values are likely to be 0
(start the application and wait for it to finish), 1 (start the
application and don't wait), 3 (minimize and don't wait), and 5

2. acad.pgp

459

(hide and don't wait). Values of 2 and 4 should normally be avoided,


as they make AutoCAD unavailable until the application has completed.
Bit 8 allows commands like DEL to work properly with filenames that
have spaces such as "long filename.dwg". Note that this will
interfere with passing space delimited lists of file names to these
same commands. If you prefer multiplefile support to using long file
names, turn off the "8" bit in those commands.
Examples of external commands for command.windows
CATALOG,
DEL,
DIR,
EDIT,
SH,
SHELL,
START,
TYPE,

DIR /W,
DEL,
DIR,
START EDIT,
1
f
START,
TYPE,

8,File specification: ,
8,File to delete: ,
8,File specification: ,
9,File to edit: ,
1,*OS Command: ,
1,*OS Command: ,
1,*Application to start:
8,File to list: ,

; Examples of external commands for Windows


; See also the (STARTAPP) AutoLISP function for an alternative method.
EXPLORER, START EXPLORER, 1,,
NOTEPAD,
START NOTEPAD, l,*File to edit: ,
PBRUSH,
START PBRUSH,
1, ,
Command alias format:
<Alias>,*<Full command name>
The following are guidelines for creating new command aliases.
1. An alias should reduce a command by at least two characters.
Commands with a control key equivalent, status bar button,
or function key do not require a command alias.
Examples: Control N, 0, P, and S for New, Open, Print, Save.
2. Try the first character of the command, then try the first two,
then the first three.
3. Once an alias is defined, add suffixes for related aliases:
Examples: R for Redraw, RA for Redrawall, L for Line, LT for
Linetype.
4. Use a hyphen to differentiate between command line and dialog
box commands.

Example: for Block, -B for -Block.

Exceptions to the rules include AA for Area, T for Mtext,


X for Explode.

Sample aliases for AutoCAD commands


These examples include most frequently used commands.
,
3D0,
3F,
,
A,

*3DARRAY
*3D0RBIT
*3DFACE
*3DP0LY
*ARC

460
ADC,
AA,
AL,
AP,
AR,
ATT,
-ATT,
ATE,
-ATE,
ATTE,
B,

-,
BH,
BO,
-BO,
BR,
c,
CH,
-CH,
,
COL,
COLOUR,
CO,
D,
DAL, '
DAN,
DBA,
DBC,
DCE,
DCO,
DDI,
DED,
DI,
DIV,
DLI,
DO,
DOR,
DOV,
DR,
DRA,
DS,
DST,
DT,
DV,
E,
ED,
EL,
EX,
EXIT,
EXP,
EXT,
F,
FI,
G,
-G,

Visual LISP AutoCAD


*ADCENTER
*AREA
*ALIGN
*APPLOAD
*ARRAY
*ATTDEF
*-ATTDEF
*ATTEDIT
*-ATTEDIT
*-ATTEDIT
*BLOCK
*-BLOCK
*BHATCH
^BOUNDARY
*-BOUNDARY
*BREAK
*CIRCLE
*PROPERTIES
*CHANGE
*CHAMFER
*COLOR
*COLOR
*COPY
*DIMSTYLE
*DIMALIGNED
*DIMANGULAR
*DIMBASELINE
*DBCONNECT
*DIMCENTER
*DIMCONTINUE
*DIMDIAMETER
*DIMEDIT
*DIST
*DIVIDE
*DIMLINEAR
*DONUT
*DIMORDINATE
*DIMOVERRIDE
*DRAWORDER
*DIMRADIUS
*DSETTINGS
*DIMSTYLE
*DTEXT
*DVIEW
*ERASE
*DDEDIT
*ELLIPSE
*EXTEND
*QUIT
*EXPORT
*EXTRUDE
*FILLET
*FILTER
*GROUP
"-GROUP

2. acad.pgp
GR,

DDGRIPS
BHATCH
*HATCH
,
*HATCHEDIT
HI,
HIDE
INSERT
I,
-I,
-INSERT
IAD,
IMAGEADJUST
IAT,
*IMAGEATTACH
ICL,
IMAGECLIP
IM,
IMAGE
-IM,
-IMAGE
IMP,
IMPORT
IN,
INTERSECT
INF,
INTERFERE
10,
INSERTOBJ
LINE
L,
LA,
LAYER
-LA,
-LAYER
LE,
QLEADER
LEN,
LENGTHEN
LI,
LIST
LINEWEIGHT,, LWEIGHT
L0,
-LAYOUT
LS,
LIST
LT,
LINETYPE
-LT,
-LINETYPE
LTYPE,
LINETYPE
-LTYPE,
-LINETYPE
LTS,
LTSCALE
LW,
LWEIGHT
M,
MOVE
MA,
MATCHPROP
ME,
MEASURE
MI,
MIRROR
ML,
MLINE
MO,
PROPERTIES
MS,
MSPACE
MT,
MTEXT
MV,
MVIEW
OFFSET
0,
OP,
OPTIONS
ORBIT,
3D0RBIT
OS,
OSNAP
-OS,
-OSNAP
p,
PAN
-p,
-PAN
PA,
PASTESPEC
PARTIALOPEN, *-PARTIALOPEN
PE,
PEDIT
PL,
PLINE
PO,
POINT
POL,
POLYGON
OPTIONS
PR,
PRCLOSE,
PROPERTIESCLOSE

,
-,

461_

462
PROPS,
PRE,
PRINT,
PS,
PU,
R,
RA,
RE,
REA,
REC,
REG,
REN,
-REN,
REV,
RM,
RO,
RPR,
RR,
s,
SC,
SCR,
SE,
SEC,
SET,
SHA,
SL,
SN,
SO,
SP,
SPL,
SPE,
ST,
su,
T,
-T,
,
TH,
TI,
TO,
TOL,
TOR,
TR,
UC,
UCP,
UN,
-UN,
UNI,
V,
-v,
VP,
-VP,
w,
-w,
WE,
x,

Visual LISP AutoCAD


*PROPERTIES
*PREVIEW
*PLOT
*PSPACE
*PURGE
*REDRAW
*REDRAWALL
*REGEN
*REGENALL
*RECTANGLE
*REGION
*RENAME
*-RENAME
*REVOLVE
*DDRMODES
*ROTATE
*RPREF
*RENDER
*STRETCH
*SCALE
*SCRIPT
*DSETTINGS
*SECTION
*SETVAR
*SHADE
*SLICE
*SNAP
*SOLID
*SPELL
*SPLINE
*SPLINEDIT
*STYLE
*SUBTRACT
*MTEXT
*-MTEXT
*TABLET
*THICKNESS
*TILEMODE
*TOOLBAR
*TOLERANCE
*TORUS
*TRIM
*DDUCS
*DDUCSP
*UNITS
*-UNITS
*UNION
*VIEW
*-VIEW
*DDVPOINT
^VPOINT
*WBLOCK
*-WBLOCK
*WEDGE
*EXPLODE

2. acad.pgp
,
,
-,
,
XL,
XR,
-XR,
z,

*XATTACH
*XBIND
*-XBIND
*XCLIP
*XLINE
*XREF
*-XREF
*ZOOM

The following are alternative aliases and aliases as supplied


in AutoCAD Release 13.
AV,
CP,
DIMALI,
DIMANG,
DIMBASE,
DIMCONT,
DIMDIA,
DIMED,
DIMTED,
DIMLIN,
DIMORD,
DIMRAD,
DIMSTY,
DIMOVER,
LEAD,
TM,

*DSVIEWER
*COPY
*DIMALIGNED
*DIMANGULAR
*DIMBASELINE
*DIMCONTINUE
*DIMDIAMETER
DIMEDIT
*DIMTEDIT
*DIMLINEAR
*DIMORDINATE
*DIMRADIUS
*DIMSTYLE
*DIMOVERRIDE
*LEADER
*TILEMODE

; Aliases for Hyperlink/URL Release 14 compatibility


SAVEURL, *SAVE
OPENURL,
*OPEN
INSERTURL, *INSERT
; Aliases for commands discontinued in AutoCAD 2000:
AAD,
*DBCONNECT
AEX,
*DBCONNECT
ALI,
*DBCONNECT
ASQ,
*DBCONNECT
*DBCONNECT
ARO,
*DBCONNECT
ASE,
DDATTDEF,
*ATTDEF
DDATTEXT,
*ATTEXT
DDCHPROP,
PROPERTIES
*COLOR
DDCOLOR,
*LAYER
DDLMODES,
DDLTYPE,
*LINETYPE
PROPERTIES
DDMODIFY,
DDOSNAP,
*OSNAP
DDUCS,
*UCS

463


acad.unt
cvunit (. . 2.7.11) , acad.unt, Support AutoCAD 2000.
3.1
AutoCAD.
| 3.1. acad.unt
;

ACAD.UNT

;
*meter(s) ,metre(s),m,,(.),
-1,0,1,0,-1,4.1214856408ell,0
*kilogram(s),kg,,(.),
0,0,0,0,1,1.097748101530,0
*second(s),sec,(),
-2,0,1,0,-1,1.23559048420,0
*ampere(s),amp(s),(),
2,1,-1, 0,1,0.050513907838,0
*kelvin, k,,(.),
2,0,0,-1,1,1.6863043358-10,0
*candela,cd,(),
4,0,-1,0,2,9.88522621-8,0
;
*celsius,centigrade,,,(.),
2,0,0,-1,1,1.6863043358-10,4.6061402932-8
*rankine
2,0,0,-1,1,9.3683574212-11, 0
*fahrenheit,
2,0,0,-1,1,9.3683574212-11,4.30635285578-8

3. acad.unt
*gram(s) ,gm,g,,(.) ,
= 0.001
*newton(s),n,,H

= / 2
*pascal,pa,,
/
=/ 2
*joule (s) , ( . )
=
;
*square,sq,,

*cubic,cu,

;
*centur(.ies),()
=100
*day(s),,(.)
=86400
*
=5
*decade(s)
=10 year
*fortnight(s)
=14 days
*hour(s),,,(.),
=3600
*milleni(um.a),(.)
=1000
*minute(s),min,(),
=60
*sidereal_year(s),_
=365.25636
*tropical_year(s),_
=365.24220
*week(s),wk,ee(.)
=604800
*year(s),,,
=365
;
*Angstrom(s),,(.)
= IE-10
*astronomical_unit(s),,_, ..
= 149597870000

465

466

Visual LISP AutoCAD

*bolt(s)
= 36.576
*cable(s),,(.)
;
= 219.456
*caliber,
= 0.000254
*centimeter(s),centimetre(s),cm(s),,(.),
= 0.01

;
;
*
0,0,0,0,0,10,0
*
0,0,0,0,0,100,0
*
0,0,0,0,0,1000,0
*
0,0,0,0,0,106,0
*
0,0,0,0,0,109,0
*
0,0,0,0,0,1012,0
*
0,0,0,0,0,1015,0
*
0,0,0,0,0,1018,0
*deca
0,0,0,0,0,10,0
*hecto
0,0,0,0,0,100,0
*kilo
0,0,0,0,0,1000,0
*mega
0,0,0,0,0,10,0
*giga
0,0,0,0,0,10e9,0
*tera
0,0,0,0,0,10el2,0
*peta
0,0,0,0,0,10el5,0
*exa
0,0,0,0,0,10el8,0

3. acad.unt

467

;
*
0,0,0,0,0,0.1,0
*
0,0,0,0,0,0,0.01,0
*
0,0,0,0,0,0.001,0
*
0,0,0,0,0,1-6,0
*
0,0,0,0,0,1-9,0
*
0,0,0,0,0,1-12,0
*
0,,0,0,0,1-15,0
*
0,0,0,0,0,1-18,0
*deci
0,0,0,0,0,0.1,0
*centi
0,0,0,0,0,0,0.01,0
0,0,0,0,0,0.001,0
*micro
0,0,0,0,0,le-6,0
*nano
0,0,0,0,0,le-9,0
*pico
0,0,0,0,0,le-12,0
* femto
0,0,0,0,0,le-15,0
*atto
0,0,0,0,0,le-18,0
:

CRC Handbook, 68th edition C 8 7 - ' 8 8 ) .

-1

-2
.
2

2
. 4

1
1

1-1
-

-1
1
-1
1
- 1 1
2

time /
/ time
/ ( time)
Units o f power over
solid angle, a
dimensionless value.

acad.mnu

acad.mnu. . ,
, Support AutoCAD 2000.
4.1 acad.mnu
MENUGROUP BUTTONS. 4.24.19 , , , AUX, POP0, 1, ,
500, 501, 502, 503, 504, 505, 508, TOOLBARS,
IMAGE, SCREEN, TABLET, HELPSTRINGS, ACCELERATORS.
| 4.1. MENUGROUP BUTTONS
*

**MENUGROUP=ACAD

//
//
Begin AutoCAD Digitizer Button Menus
//
***BUTTONS1
// Simple + button
// If a grip is hot bring up the Grips Cursor Menu (POP 500),
//
else send a carriage return
// If the SHORTCUTMENU sysvar is not 0
//
the first item (for button 1) is NOT USED.
$M=$(if, $(eq,$(substr,$(getvar,cmdnames) ,1,5) ,GRIP_) ,+
$P0=ACAD.GRIPS $P0=*);
$P0=SNAP $p0=*

4. acad.mnu
***BUTT0NS2
// Shift + button
$P0=SNAP $pO=*
***BUTTONS3
// Control + button
***BUTTONS4
// Control + shift + button

4.2. AUX
***AUX1
// Simple button
// if a grip is hot bring up the Grips Cursor Menu (POP 500),
//
else send a carriage return
// If the SHORTCUTMENU sysvar is not 0 the first item
//
(for button 1, the "right button") is NOT USED.
$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,5),GRIP_),+
$P0=ACAD.GRIPS $P0=*);
$P0=SNAP $p0=*

A
O

***AUX2
// Shift + button
$P0=SNAP $p0=*
$P0=SNAP $p0=*
***AUX3
//Control + button
$P0=SNAP $p0=*
***AUX4
// Control + shift + button
$P0=SNAP $p0=*

j 4.3.

***POP0
**SNAP

469

Visual LISP AutoCAD

470

// Shift-right-click if using the default AUX2 and/or BUTTONS2


// menus.
[^ ]
ID_Tracking [& ]_tt
ID_From
[& ]_f
ID_MnPointFi [- &]
ID_PointFilx
[.].
ID_PointFily [.Y].Y
ID_PointFilz [.Z].Z
[ ]
ID_PointFixy [.XY].XY
ID_PointFixz
[.XZ].XZ
ID_PointFiyz
[<-.YZ].YZ
[]
ID_OsnapEndp [&KoHTO4Ka]_endp
ID_OsnapMidp [C&epetHa]_mid
ID_OsnapInte [&nepece4eHne]_int
ID_OsnapAppa [& ]_appint
ID_OsnapExte [ &]_ext
ID_OsnapCent [&]_
ID_OsnapQuad [K&BaflpaHT]_qua
ID_OsnapTang
ID_OsnapPerp
ID_OsnapPara
ID_OsnapNode
ID_OsnapInse
ID_OsnapNear
ID_OsnapNone
ID_Osnap

[&]_
[&]_par
[&]_
[&]_1
[&]_
[ &]_non
[ ]
[& ...]'_+dsettings 2

4.4. 1
***POP1
**FILE
ID_MnFile
[&]
ID_New
[&...\tCtrl+N]_
ID_Open
[&...\tCtrl+O]_
ID_FILE_CLOSE []
ID_PartialOp [$ (if, $ (eq, $ (getvar, fullopen), 0),,
& ]/4CC_partiaload

IDSave

[SCoxpaHHTb\tCtrl+S]ACAC_qsave

471

4. acad.mnu
ID_Saveas
ID_Export

[ &...] C C_saveas
A A
[&...] C C_export
A

ID_PlotSetup [ &...] C C_pagesetup


A A
ID_PlotMgr
[& .,.] C C_plottermanager
A A
ID_PlotStyMgr [& ...] C C_stylesmanager
A A
ID_Preview
[& ] C C_preview
A A
ID_Print
[&...\tCtrl+P] C C_jplot
[]
ID_MnDrawing [->&]
ID_Audit
[&]ACAC_audit
ID_Recover
[&...]ACAC_recover
ID_MnPurge
ID_PurgeAll
ID_PurgeLay
ID_PurgeLin
ID_PurgeTxt
ID_PurgeDim
ID_PurgeMln
ID_PurgeBlk
ID_PurgePlt
ID__PurgeShp
ID_SendMail
ID_Props
ID_MRU
ID APP EXIT

[->&]
[&Bce]ACAC_purge _a
[]
[&]ACAC_purge _la
[& ]ACAC_purge _lt
[& ]ACAC_purge _st
[& ]ACAC_purge _d
[ &]ACAC_purge _m
[&]ACAC_purge _b
[ &]ACAC_purge _p
[<-<-&]ACAC_purge _sh
[&...]
[& ...]ACAC_dwgprops
[ ]
t--]
[&]

'I 4.5.
***
**VIEW
ID_MnView
ID_Redrawall
ID_Regen
ID_Regenall
ID_MnZoom
ID ZoomRealt
ID_ZoomPrevi
ID ZoomWindo

[&]
[&]'_redrawall
[&]ACAC_regen
[& ]ACAC_regenall
[->&]
[ & ]' zoom ;
[&] '_zooni _p
[&]' zoom w

Visual LISP AutoCAD

472
ID_ZoomDynam
ID_ZoomScale
IDZoomCente

[]'_zoom _d
[&]'_zoom _s
[&]'_zoom _c

ID_ZoomIn
ID_ZoomOut

[&]'_zoom 2x
[&]'_zoom .5x
t ]
ID_ZoomAll
[B&ce]'_zoom _all
ID_ZoomExten
[<-&]'_zoom _e
ID_MnPan
[->&]
ID_Pan
[ & ]'_
ID_PanPick
[]'_-pan
ID_PanLeft
[&]AP'_-pan +
(trans (list
-0.2 (getvar "viewsize")) 0) 0 1)
ID_PanRight
[&]AP'_-pan +
(trans (list
0.2 (getvar "viewsize")) 0) 0 1)
ID_PanUp
[&]AP'_-pan +
(trans (list
(* 0.2 (getvar "viewsize"))) 0 1)
ID_PanDown
[<~]AP'_-pan +
(trans (list
(* -0.2 (getvar "viewsize"))) 0 1)
IDDsviewer [& ]'_dsviewer
ID_MnTiledVi [-> ]
ID_Ai_tiledv
[ ...]ACAC_+vports 1
ID_VportsSav
[ ...]ACAC_+vports 0
ID_VportsSin
[&1 ]$=$(if,$(eq,$(getvar, tilemode) ,1),+
A A
C C_-vports _si,ACAC_-vports)
ID_Vports2
[&2 ]ACAC_-vports _2ID_Vports3
[&3
A A
] C C_-vports _3
ID_Vports4
[&4 ]ACAC_-vports _4
ID_VportsRes [$(if,$(eq,$(getvar,tilemode) , 1) , ~) +
A A
] C C_-vports _p
ID_VportsDel
[$(if,$(eq,$(getvar,tilemode),1),~)]+
A A
C C_-vports _o
ID_VportsJoi
[<-$(if,$(eq,$(getvar,tilemode),0),~)]+
A A
C C_-vports _j
ID_Ddview
[ . . . ]/vCAC_view
ID_MnViewpoi [->$(if,$(and,$(eq,$(getvar,tilemode),0) ,+
$ (eq, $ (getvar, cvport) , 1) ) , ~,) &3M ]
ID_Ddvpoint
[& ...]ACAC_ddvpoint
ID_VpointTri
[ ]ACAC_vpoint ;
ID_MnPlanView [-> ]
ID_PlanCurre
[ ]ACAC_plan ;

4. acad.mnu
ID_PlanWorld
ID_PlanUCS

473

[&] C C_plan _w
A A
[<~& ] C C_plan _u
t 1
A A
ID_VpointTop
[&] C C_-view _top
A A
IDJVpointBot
[&] C C__-view _bottom
A A
ID_VpointLef
[&] C C_-view _left
A A
ID_VpointRig
[&] C C_-view _right
A A
ID_VpointFro
[&] C C_-view _f ront
ID_VpointBac
[& ]ACAC_-view _back
[]
ID VpointSW
[& ]ACAC_-view _swiso
ID_VpointSE
[KB &]ACAC_-view _seisoID_VpointNE
[&CB ]ACAC_-view _neiso
ID VpointNW
[<-C3 &]ACAC_-view _nwiso
ID_3dorbit
[$(if,$(and,$(eq,$(getvar,tilemode), 0) ,+
$(eq,$(getvar,cvport),1)),~,)& ]ACAC_3dorbit
[ ]
ID_Hide
[&]ACAC_hide
ID_MnPersShad [->$(if,$(and,$(eq,$(getvar,tilemode) , 0) , +
$(eq,$(getvar,cvport),1)),~,)&]
ID_2doptim
[&2M ]$M=$(if,$(and,$(eq,$(getvar,tilemode),0),+
$(eq,$(getvar,cvport),1)),ACAC_shademode,ACAC_shademode _2)
ID_Wireframe
[&3M ]$M=$(if,$(and,$(eq,$(getvar,tilemode),0),+
$(eq,$(getvar,cvport),1)),ACAC_shademode,ACAC_shademode _3)
ID Hidden
[& ]$M=$(if,$(and,$(eq,$(getvar,tilemode),0),+
$ (eq, $ (getvar, cvport) , 1) ) ,ACAC__shademode,ACAC_shademode _h)
ID_Flat.
[&]$=$(if,$(and,$(eq,$(getvar,tilemode),0),+
$(eq,$(getvar,cvport),1)),ACAC_shademode,ACAC_shaderuode _f)
ID_Gouraud
[ &]$M=$(if,$(and,$(eq,$(getvar,tilemode),0),+
$(eq,$(getvar,cvport),1)),ACAC_shademode,ACAC_shademode _g)
ID_FlatEdges
[&, ]$M=$(if,$(and,+
$(eq,$(getvar,tilemode),0),$(eq,$(getvar,cvport),1)),+
A A
A A
C C_shademode, C C_shademode _1)
ID_GourEdges
[<- &, ]$M=$(if,$(and,+
$(eq,$(getvar,tilemode),0),$(eq,$(getvar,cvport),1)) ,+
A A
C C_shademode,ACAC_shademode _o)
ID_MnRender [->$(if,$(and,$(eq,$(getvar,tilemode),0),+
$(eq,$(getvar,cvport),1)),~,)&]
A A
ID_Render
[^...] C C_render
ID_Scene
ID_Light
ID__Rmat
ID Matlib
ID_Setuv

[&...]ACAC_scene
[&...]ACAC_light
[&. . . ]ACAC_rmat
[& ...]ACAC_matlib
[& ...]ACAC_setuv

Visual LISP AutoCAD

474
ID_Backgroun
ID_Fog
ID_Lsnew
ID_Lsedit
ID_Lslib
ID__Rpref
ID_Stats

[&...]ACAC_background
[&...]ACAC_fog
[& ...]ACAC_lsnew
[& ...]ACAC_lsedit
[& ...]ACAC_lslib
[&. . . ]ACAC_rpref
[<-&...]ACAC_stats

ID_MnDisplay [->&]
ID_MnUCSicon
[->& ]
ID_UcsiconOn
[$(if,$(and,$(getvar,ucsicon), 1), !.)&] +
$M=$(if,$(and,$(getvar,ucsicon),1),ACAC_ucsicon _off,ACAC_ucsicon _on)
ID_UcsiconOr
[<-$(if,$(and,$(getvar,ucsicon),2),!.)&]+
$M=$(if,$(and,$(getvar,ucsicon),2),ACAC_ucsicon _no,ACAC__ucsicon _or)
ID_MnAttribu
[->&]
ID_AttdispNo
[$(if,$(eq,$(getvar,attmode),1),!.)&]+
'_attdisp _n
ID_AttdispOn
[$(if,$(eq,$(getvar,attmode),2),!.)&]'_attdisp _on
ID_AttdispOf
[<-$(if,$(eq,$(getvar,attmode),0),!.)&0]+
'_attdisp _off
[]
ID__Textscr
[<-& OKHo\tF2]'_textscr
ID Toolbar
[&...] A C A C toolbar

I 4.6. 500
***POP500
**GRIPS
// When a grip is hot, then display the following shortcut menu
//
for grips. See also AUX1 menu.
[& ]
ID Enter
[fiEnter];
ID_GripMove
ID_GripMirro
ID_GripRotat
ID_GripScale
ID_GripStret

[&IIepeHecTM]_move
[&3]_1
[IIo&BepHyTb]_rotate
t&MacmTa6]_scale
[PacT&HHyTb]_stretch
[]
ID_GripBase [^ ]_base
ID_GripCopy [&]_
ID_GripRefer [$(if,$(or,$(eq,$(getvar,cmdnames),GRIP_SCALE) ,+
$(eq, $(getvar,cmdnames),GRIP_ROTATE)),,~)&CcbmKa]_reference
ID GripUndo [&] u

4. acad.mnu

475

A A

ID_Modify [&] C C_properties


A A
ID_GotoURL [& URL...] C C_gotourl
ID GripExit

[ ]
[B&bKOfl]_exit

; 4.7. 501

***501
**CMDEFAULT
[ ]
A A
ID_CMNonLast [& %s] C C;
ID_Cutclip
ID_Copyclip
ID_Copybase
ID_Pasteclip
ID_Pastebloc
ID_Pasteorig

A A

[&] C C_cutclip
A A
[&] C C_copyclip
A A
[ &] C C_copybase
A A
[&] C C_pasteclip
[& ]ACAC_pasteblock
[ & ]ACAC_pasteorig

ID_U
[&]ACAC_u
ID_Redo
[&]ACAC_redo
ID_Pan
[&]'_
ID_ZoomRealt [&3]'_zoom ;
ID_Filter
[& ...]ACAC_qselect
IDJTextFind [&...]ACAC_find
ID_Preferenc [&...]ACAC_options
i 4.8. 502

***POP502
**CMEDIT
[ ]
ID_CMSelLast [& %s]ACAC;
ID_Cutclip
ID_Copyclip
ID_Copybase
ID_Pasteclip
ID_Pastebloc
ID_Pasteorig

[&]ACAC_cutclip
[&]ACAC_copyclip
[ &]ACAC_copybase
[&]ACAC_pasteclip
[& ]ACAC_pasteblock
[ & ]ACAC_pasteorig

ID Erase

[&] erase

476

Visual LISP AutoCAD

ID_Move
[&]$M=$(if,$(eq,+
$(substr,$(getvar,cmdnames),1,4),GRIP),_move, A C A C_move)
ID_Copy
[& ]$M=$(if,$(eq,+
$(substr,$(getvar,cmdnames),1,4),GRIP),_copy, A C A C_copy)
ID_Scale
[] $M=$ (if, $ (eq, +
$(substr,$(getvar,cmdnames),1,4),GRIP),_scale,ACAC_scale)
ID_Rotate
[&]$M=$(if,$(eq,+
$(substr,$(getvar,cmdnames),1,4),GRIP),_rotate,ACAC_rotate)
[]
ID_Deselectall [& ]ACACAP(ai_deselect) A P
ID_Filter
[& ...]ACAC_qselect
ID_TextFind [&...]ACAC_find
ID_Ai_propch [&]ACAC_properties
; 4.9. 503
***POP503
**CMCOMMAND
[ ]
[SEnter];
[]
[]
ID_Pan
[$(if, $(eq,$(substr,+
$(getvar, cmdnames),1,4),ZOOM),~,)&]'_pan
ID_ZoomRealt [$(if,$(eq,$(substr,+
$(getvar,cmdnames),1,4),ZOOM),~,)&3]'_zoom ;
ID_Enter
ID_Cancel

j 4.10. 504
***POP504
* *OBJECTS_DIMENSION
ID_DimText
IDJDimAbove
ID_DimTxtCen
ID_DimHome
ID_DimTxtMove2
ID_DimTxtMovel
ID_DimTxtMoveO
ID_DimPrec
ID_DimPrecO
ID_DimPrecl
ID_DimPrec2

[ ]
[->& ]
[& ]ACAC_ai_dim_textabove
[ &]ACAC_ai_dim_textcenter
[ ]ACAC_ai_dim_texthome
[& ]ACAC_aidimtextmove _2
A A
[ &] C C_aidimtextmove _1
A A
[<- & ] C C_aidimtextmove _0
[->&]
[0]ACAC_aidimprec _0
[0.0]ACAC_aidimprec _1
[0.00]ACAC_aidimprec _2

477

4. acad.mnu
ID_DimPrec3
ID_DimPrec4
ID_DimPrec5
ID_DimPrec6
ID_DimStyl
ID_DimSty2

[0.000]ACAC_aidimprec _3
[0.0000]ACAC_aidimprec _4
[0.00000]ACAC_aidimprec _5
[<-0.000000]ACAC_aidimprec _6
[->& ]
[& ...' A C A C _ a i d i m s t y l e
4

ID_DimSty3
ID_DimSty4
ID_DimSty5
ID_DimSty6
ID_DimSty7
ID_DimSty8
ID_DimSty9

[ MRU1]'' C C_aidimstyle
4 A
[ MRU2]'' C C_aidimstyle
4 A
[ MRU3]'' C C_aidimstyle
A
[ MRU4]'^C C_aidimstyle
4 A
[ MRU5]'' C C_aidimstyle

[ MRU6]' aidimstyle
[<-&...] aidimstyle

4.11. 505
***505
* *JECTJVIEWPORT
ID_VpClip
ID_Vport_disp
ID_Vport_dispon
ID_Vport_dispoff
ID_Vport_lock
ID_Vport_lockon
ID_Vport_lockoff
ID_Vport_hide
ID_Vport_hideon
ID_Vport_hideoff

[ ]
[& ] A C A C_vpclip
[->& ]
[&] _- _ _ ; ;
[<-&] A C A C_-vports _off _ p ; ;
[->& ]
[&] A C A C_-vports _lock _on _ p ; ;
[<-&] A C A C_-vports _lock _off _ p ; ;
[-> &]
[&] A C A C_-vports _hide _on _ p ; ;
A
A
[<-&] C C_-vports _hide _off _ p ; ;

I 4.12. 508
***POP508
**OBJECT_TEXT
ID Ddedit

[ ]
[& ...]ACAC_ddedit

4.13. TOOLBARS
***TOOLBARS
** DIMENSION
ID TbDimensi [ Toolbar("",

Floating,

Hide, 100, 130, 1)]

478

Visual LISP AutoCAD

ID_Dimlinear [_Button(" " , IC0N_16_DIMLIN, +


IC0N_16_DIMLIN)] A C A C_dimlinear
ID_Dimaligne [_Button(" " , IC0N_16_DIMALI, +
IC0N_16_DIMALI)]~C A C_dimaligned
ID_Dimordina [_Button(" " , ICON_16_DIMORD, +
ICON_16_DIMORD) ] A C A C _ d i m o r d i n a t e
[ ]
ID_Dimradius [_Button("", ICON_16_DIMRAD, ICON_16_DIMRAD)]+
A A
C C_dimradius
ID_Dimdiamet [^Button("", ICON_16_DIMDIA, ICON_16_DIMDIA)]+
A A
C C_dimdiameter
ID_Dimangula [_Button(" ", ICON_16_DIMANG, ICON_16_DIMANG)]+
A A
C C_dimangular
[--]ID_QDim
[_Button(" ", ICON_16_QDIM,
ICON_16_QDIM)]+
A A
C C_qdim
ID_Dimbaseli [_But.ton(" ", ICON_16_DIMBAS, ICON_16_DIMBAS)]+
'sC'4C_dimbaseline
ID_Dimcontin [_Button(" ", ICON_16_DIMCON, ICON_16_DIMCON)]+
A /4
C C_dimcontinue
ID_Leader
[_Button(" ", ICON_16_QLEADER, +
ICON_16_QLEADER)]ACAC_qleader
ID_Tolerance [_Button("", ICON_16_TOLERA, ICON_16_TOLERA)]+
A A
C C_tolerance
ID_Dimcenter [_Button(" ", ICON_16_DIMCEN, ICON_16_DIMCEN)]+
A A
C C_dimcenter
ID_Dimedit
[_Button(" ", ICON_16_DIMNEW, +
ICON_16_DIMNEW) ]/4C/4C_dimedit
ID_Dimtedit [_Button(" ", ICON_16_DIMHOM, +
A A
ICON_16_DIMHOM)] C C_dimtedit
ID_DimUpdate [_Button(" ", ICON_16_DIMUPD, +
ICON_16_DIMUPD)]ACAC_-dimstyle _apply
[ ]
ID_DimStyle [_Control(_dimstyle)]
ID_Ddim
[_Button(" ", ICON_16_DIMSTY, +
ICON_16_DIMSTY)]'_dimstyle
**TB_DRAW
ID_TbDraw
ID_Line
ID_Xline
ID_Mline
A
A
C C mline

[_Toolbar("", _Left, _Show, 0, 0, 1)]


[_Button("", ICON_16_LINE, ICON_16_LINE)]ACAC_line
[_Button("", ICON_16_XLINE, ICON_16_XLINE)]ACAC_xline
[_^("", ICON_16_MLINE, ICON_16_MLINE)]+

4. acad.mnu

479

ID_Pline
tButton("", ICON_16J?LINE, ICON_16_PLINE)]+

_
ID_Polygon
[_Button("", ICON__16_POLYGO, ICON_16_POLYGO)]+
A A
C C_polygon
ID_Rectang
[_Button("", ICON_16_RECTAN, ICON_16_RECTAN)]+
A A
C C_rectang
ID_Arc
[_Button("flyra", ICON_16_ARC3PT, ICON_16_ARC3PT)]ACAC_arc
ID_Circle
[_Button("Kpyr", ICON_16_CIRRAD, ICON_16_CIRRAD)]ACAC_circle
ID_Spline
[_Button("", ICON_16_SPLINE, ICON_16_SPLINE)]+
A A
C C_spline
ID_Ellipse
[_Button("", ICON_16_ELLAE, ICON_16_ELLAE)]+
*C*C_ellipse
I D _ T b I n s e r t [ _ F l y o u t ( " ^ O K " , ICON_16_BLOCK, ICON_16_BLOCK, _ O t h e r I c o n , +
ACAD.TB_INSERT)]
ID_Bmake
[_Button(" ", ICON_16_BLOCK, ICON_16_BLOCK)]+

ID_Point
[_Button("", ICON_16_POINT, ICON_16_POINT)]*CC_point
ID_Bhatch
[_Button("", ICON_16_BHATCH, ICON_16_BHATCH)]+
A A
C C_bhatch
ID_Region
[_Button("", ICON_16_REGION, ICON_16_REGION)]+

_1
ID_Mtext
[_Button(" ", ICON_16_MTEXT, +
ICON 16 )] mtext

4.14. IMAGE
***IMAGE
**image_3DObjects
[ ]
[acad(Box3d, )]_1_
[acad(Pyramid,)]ACAC_ai_pyramid
[acad(Wedge,)]ACAC_ai_wedge
[acad(Dome,)]ACAC_ai_dome
[acad(Sphere,)]ACAC_ai_sphere
A A
[acad(Cone,)] C C_ai_cone
A A
[acad(Torus,Top)] C C_ai_torus
[acad(Dish,)]ACAC_ai_dish
A A
[acad(Mesh,)] C C_ai_mesh
* * image_poly
[ ]
[acad(pm-quad, )]'_surftype 5
[acad(pm-cubic, )]'_surftype 6
[acad(pm-bezr, )]'_surftype 8
[acad(pl-quad, )]'_splinetype 5
[acad(pl-cubic, )]'_splinetype 6

480

Visual LISP AutoCAD

\ 4.15. SCREEN ( )

// AutoCAD Screen Menus


//
// There are two types of screen menus: command menus and options menus
// Command menus provide access to the lists of AutoCAD commands.
// Options menus provides access to the options available
//
for individual commands.
//
// There are 22 lines between menu titles.
//
This is one method for assuring that each time
// that a menu is called that it overwrites the previous menu.
/

***SCREEN
**S
[AutoCAD

] (1_)

[* * * * ]$s=ACAD.OSNAP
[

]$S=ACAD.01_FILE

[]$S=ACAD.02_EDIT
[ 1]$S=ACAD.O3_VIEW1
[ 2]$S=ACAD.04_VIEW2
[]$S=ACAD.05_INSERT
[]$ S=ACAD.0 6_FORMAT
[ 1]$S=ACAD.07JTOOLS1
[ 2]$S=ACAD.08JTOOLS2
[ 1]$S=ACAD.O9_DRAW1
[ 2]$S=ACAD.10_DRAW2
[]$S=ACAD.11 DIMENSION

4. acad.mnu
[ 1]$ S=ACAD.12_MODIFY1
[ 2]$ S=ACAD.i 3_M0DIFY2
[]$S=ACAD.14_HELP
[]$S=ACAD.ASSIST
[]$ S=ACAD.

! 4.16. SCREEN ( )
**01_FILE 3
[] A C A C_new
[] _
[] A C A C_qsave
[ ] A C A C _ s a v e a s
[] A C A C_export
[] A C A C_config
[ ] A C A C__plot
[] A C A C_audit
[] A C A C_recover
[] A C A C_purge
[] A C A C_quit

**02_EDIT 3
A
A
[] C C_u
A
A
[] C C_redo
[]ACAC_cutclip
[] A C A C_copyclip

[] copybase
A
[] C A C_copylink
[]ACAC_pasteclip
[] A C A C_pasteblock
A
A
[] C C_pasteorig
A
A
[ ] C C _ p a s t e s p e c
[] d e l i n k s

16 . 155

481

482

Visual LISP AutoCAD

\ 4.17. TABLET
***TABLET1
**TABLET1STD
[A-2]\
[A-3]\
[A-4]\
[A-5]\
[A-6]\
[A-7]\
[A-8]\
[A-9]\
[A-10] \

\
\

[A-12]
\
[A-13] \
[A-14] \
[A-15] \
[A-16] \
[A-17] \
[A-18] \
[A-19] \
[A-20] \
[A-21] \
[A-22] \
[A-23] \
[A-24] \
[A-25] \

[1-20] \
[1-21] \
[1-22] \
[1-23] \
[1-24] \
[1-25] \
**ENDTAB1
//

TABLET2 m e n u .

//
//

Rows:

J to R

Columns:

*TABLET2

11

(9)

4. acad.mnu
**TABLET2STD
// Row J View
A A
C C_regen
'_zoom _e
' zoom a
'_zoom _w
'_zoom _p
[Draw]\
A A
C C_box
A A
C C_mtext
A A
C C__circle
A A
C C_line
A A
CC
// Row View
A A
C C_regenall
1
dsviewer
1
zoom _c
'_zoom .5x
'_zoom 2x
[Draw]\
A
C A C sphere
A A
C C_dtext
/s A
C C_donut

_
'_zoom ;
// Row L View
' attdisp

ucsicon

tilemode 1

_
A A A
A
C C P_pspace P
[Draw]\
A
C A C cylinder
A
C A C solid
A A
C C_spline
A A
C C_xline
'_zoom ;
// Row M View
A
C A C render
A A
C C_hide
A A
C C__vports
A A
C C__vports
A A
C C_view
[Draw]\
A A
C C_cone
A A
C C_3dface
16*

484

Visual LISP AutoCAD

CAC_ellipse
CX_raline
' zoom ;
// Row N View
A
CTC_scene
A
C A C_shade
A
C A C_plan
A
C A C_vpoint
A A
C C_ddvpoint
[Draw]\
A
C A C_wedge
$I=ACAD. image__3dob j ects $I=ACAD. *

_
A
CAC_pline
'_pan
// Row View
A
CAC_light
A A
C C_shademode
//
'_-view _nwiso
'__-view _back
' -view neiso
[Draw]\
A
C A CJ;orus
A A
C C__revsurf
* A C A C_point
A
C A C_3dpoly
' _pan
// Row P View
A
C A C_rmat
A
C A C_fog

'

'

'

'

// Row Q View
CAC_matlib
A A
C C_background
//
' -view swiso
A

4, acad.mnu

485

'_-view _front
'_-view _seiso
[Draw]\
A A
C C_revolve
A A
C C_rulesurf
A A
C C_boundary
A A
C C__rectang
'_redrawall
// Row R View
A A
C C_setuv
A A
C C_rpref
//
A A
C C_toolbar
'_-view _bottom
A A
C C_3dorbit
[Draw]\
A A
C C_qleader
A A
C C_edgesurf
A A
C C_region
A A
C C_arc
'_redrawall
**ENDTAB2
I 4.18. HELPSTRINGS
* "HELPSTRINGS
ID_2doptim
[ 2 : +
2]
ID_3darray
[ : 3-]
ID 3dclip
[ 3- +
: 3-]
ID 3dclipbk [ +
: 3]
ID 3dclipfr [ +
: ]
ID_3dcorbit [ 3- +
: 3-]
ID 3ddistanc [ 3- +
: 3-]
ID_3dface
[ : 3-]
ID 3dmesh
[ : 3-]
ID 3dorbit
[ : +
3-]

486

Visual LISP AutoCAD

ID_3dpan
[ 3- +
: 3-]
ID_3dpoly
[ , +
: 3-]
ID_3dsin
[ 3D Studio: ]
ID_3dsurface [' +
]
ID_3dswivel [ 3- +
: 3-]
ID_3dviews
[ ]
ID_3dzoom
[ 3- +
: 3-]
ID_About
[ , :+
]
ID_Acisin
[ ACIS: ]
ID_AddPlotter [ : +
(STARTAPP "ADDPLWIZ.EXE")]
ID_AddPlStyle [ : +
(STARTAPP "STYSHWIZ.EXE")]
ID_Ai_box
[ +
: 1_]
ID_Ai_cone
[ : +
AI_CONE]
ID_Ai_dish
[ : +
AI_DISH]
ID_Ai_dome
[ :+
AI_DOME]ID_Ai_fms
[
+
: AI_FMS]
ID_Ai_molc
[ , +
: AI_MOLC]
ID_Ai_propch [ : ]

; 4.19. ACCELERATORS
***ACCELERATORS
// Bring up hyperlink dialog
ID_Hyperlink [CONTROL+"K"]
// Toggle Orthomode
[CONTROL+"L"]"O
// Next Viewport
[CONTROL+"R";rv
ID_Copyclip
[CONTROL+-C"]

4. acad.mnu
ID_New
ID_Open
ID_Print
ID_Save
ID_Pasteclip
ID_Cutclip
ID_Redo
ID_U
ID_Modify
ID_Content
ID_dbConnect
ID_VBARun
ID VBAIDE

[CONTROL+"N"]
[CONTROL+"O"]
[CONTROL+"P"]
[CONTROL+"S"]
M
[CONTROL+"V ]
[CONTROL+"X"]
[CONTROL+"Y"]
[CONTROL+"Z"]
[CONTROL+"1M]
[C0NTR0L+"2"]
[C0NTR0L+"6"]
[ALT+"F8"]
[ALT+"F11"]

487


AutoLISP
. 5.1 AutoLISP, 27, .
5.1.

2.4.1

2.4.2

2.4.3

2.4.4

2.5.1

2.5.2

<

2.5.3

<=

2.5.4

>

2.5.5

2.5.6

-1

2.4.7

1+

2.4.5

1-

2.4.6

abs

2.4.8

acad c o l o r d l g

2.10.19

5. AutoLISP

489

5.1 ()

acad_helpdlg

6.3.1

acad_strlsort

2.9.18

action_tile

DCL-

5.4.1

add_list

5.5.2

alert

2.11.12

alloc

2.17.3

and

2.5.7

angle

2.6.6

angtof

2.7.7

angtos

2.7.8

append

2.9.2

apply

2.9.12

arx


ARX-

2.17.10

arxload

ARX-

2.17.11

arxunload

ARX-

2.17.12

ascii

2.8.2

assoc

2.9.11

atan
atof
atoi

2.6.11

2.7.6
2.7.5


atom
atoms-family
autoarxload

2.5.19


ARX-

2.16.16
2.17.14

Visual LISP AutoCAD

490

5.1 ()

autoload

2.17.13

Boole

2.6.18

boundp

2.5.21

caaar, caddr...

(car (car (car . . . ) ) ) ,


(car (cdr (cdr ...) ) )

2.9.7

caar, cadr

(car

car

2.9,5

cdr

2.9.6

chr

2.8.1

c l i e n t data t i l e

5.4.6

close

2.11.3

command


AutoCAD

2.3.1

cond

2.5.13

cons

2.9.8

cos

2.6.10

cvunit

2.7.11

defun

2.16.2

defun-q

2.16.4

defun-q-list-ref

2.16.5

defun-q-list-set

2.16.6

dictadd

2.15.5

dictnext

2.15.4

dietremove

2.15.6

dictrename

2.15.7

(car . . . ) ) ,

(car

(cdr ...) )

2.9.7

5. AutoLISP

491

5.1 ()

dictsearch

2.15.3

dimx_tile

5.6.6

dimy_tile

5.6.7

distance

2.6.7

distof

2.7.9

done_dialog

5.2.5

end_image

5.6.2

end_list

5.5.3

entdel

()

2.12.4

entget

2.12.5

entlast

2.12.1

entmake

2.12.6

entmakex

2.12.7

entmod

2.12.8

entnext


()

2.12.2

entsel

2.12.3

entupd

2.12.9

eq

2.5.22

equal

2.5.23

*error*

2.16.11

eval

2.9.16

exit

2.16.9

exp

2.6.12

expand

2.17.4

492

Visual LISP AutoCAD


5.1 ()

expt

2.6.13
5.6.3
2.11.1
2.6.1

foreach

2.9.15

function

2.16.7

gc

2.17.5

gcd

2.6.5

get_attr

,
DCL-

5.4.5

get_tile

5.4.4

getangle

2.10.6

getcfg

2.10.15

getcname

2.10.17

getcorner

2.10.9

getdist

2.10.5

getenv

2.10.13

getfiled

2.10.18

getint

2.10.3

getkword

2.10.2

getorient

2.10.7

getpoint

2.10.8

getreal

2.10.4

getstring

2.10.10

fill_image
findfile
fix
float

2.7.2

5. AutoLISP

493

5.1 ()

getvar

2.10.11

graphscr

2.18.3

grclear

2.18.9

grdraw

2.18.7

grread

2.18.10

grtext

2.18.6

grvecs

2.18.8

handent

2.12.10

help

6.1.3

if

2.5.11

initdia

2.18.11

initget

2.10.1

inters

2.6.19

itoa

2.7.3

lambda

2.16.1

last

2.9.19

layoutlist

2.15.8

length

2.9.20

list

2.9.1

listp

2.5.17

load

2.2.4

load_dialog

DCL-

5.2.1

log

2.6.14

logand

2.6.15

logior

2.6.16

Visual LISP AutoCAD

494

5.1 ()

lsh

2.6.17

mapcar

2.9.13

max

2.6.3

mem

2.17.2

member

2.9.10

menucmd

4.3.2

menugroup

4.3.1

min

2.6.4

minusp

2.5.14

mode_tile

5.4.2

namedobjdict

2.15.2

nentsel

2.12.11

nentselp

2.12.12

new_dialog

5.2.3

not

2.5.9

nth

2.9.3

null

n i l

2.5.10

numberp

2.5.16

open

2.11.2

or

2.5.8

osnap

2.18.1

polar

2.6.20

prinl

2.11.7

princ

2.11.6

5. AutoLISP

495

5.1 ()

print

2.11.8

progn


if

2.5.12

prompt

2.11.11

quit

2.16.10

quote

(
)

2.9.17

read

2.8.3

read-char

2.11.9

read-line

2.11.4

redraw

2.18.2

regapp

2.14.2

rem

2.6.2

repeat

2.5.25

reverse

2.9.4

rtos

2.7.4

set

2.6.24

set_tile

5.4.3

setcfg

2.10.16

setenv

2.10.14

setfunhelp

6.4.1

setq


AutoLISP

2.1.2

setvar


AutoCAD

2.10.12

setview

2.13.6

sin

2.6.9

496

Visual LISP AutoCAD


/75.7 ()

slide_image

5.6.4

snvalid

2.13.7

sqrt

2.6.8

ssadd

2.12.15

ssdel

2.12.16

ssget

2.12.14

ssgetfirst

2.12.22

sslength

2.12.17

ssmemb

2.12.18

ssname

2.12.19

ssnamex

2.12.20

sssetfirst

2.12.21

startapp

6.1.5

start_dialog

DCL-

5.2.4

start_image

5.6.1

start_list

5.5.1

strcase

2.8.4

strcat

()

2.8.5

strlen

2.8.6

subst

2.9.18

substr

2.8.7

tablet

2.18.12

tblnext

2.13.3

5. AutoLISP

497

5.1 ()

tblobjname

2.13.4

tblsearch

2.13.2

term_dialog

5.2.6

terpri
textbox

()

2.11.13

2.6.21

textpage

textscr

2.18.5

trace

2.18.4

trans

2.16.17
2.7.10

2.7.1

DCL-

5.2.2

2.16.18

5.6.5

type
unload_dialog
untrace
vector_image
ver
vl-acad-defun
vl-acad-undefun


AutoLISP

2.17.1

2.16.12
2.16.13

vl-arx-import


VLX-

2.17.15

vl-bb-ref

2.17.26

vl-bb-set

2.17.25

vl-catch-all-apply

2.9.32

vl-catch-all-error-message

2.9.33

498

Visual LISP AutoCAD

5.1()

vl-catch-all-error-p

2.9.34

vl-cmdf

2.3.2

vl-consp

n i l

2.5.18

vl-directory-files

2.11.14

vl-doc-export


VLX-

2.17.16

vl-doc-import



VLX-

2.17.17

vl-doc-ref

2.17.28

vl-doc-set

2.17.27

vl-every


, . . -

2.9.14

vl-exit-with-error


*error*

2.16.14

vl-exit-with-value

2.16.15

vl-file-copy

2.11.15

vl-file-delete

2.11.16

vl-file-directory-p

2.11.17

vl-file-rename

2.11.18

vl-file-size

2.11.19

vl-file-systime

2.11.20

5. AutoLISP

499

/75.1 ()

vl-filename-base

2.11.21

vl-filename-directory

2.11.22

vl-filename-extension

2.11.23

vl-filename-mktemp

2.11.24

vl-get-resource


,
VLX-

2.17.22

vl-list*

2,9.9

vl-list->string

2.8.10

vl-list-exported-functions

2.17.18

vl-list-length

2.9.22

vl-list-loaded-vlx


VLX-

2.17.19

vl-load-all



,
AutoCAD

2.17.29

vl-load-com


Visual LISP AutoLISP

7.1.2

vl-load-reactors

7.8.1

vl-member-if

2.9.23

vl-member-if-not

n i l

2.9.24

vl-position

2.9.25

vl-prinl-to-string


p r i n l

2.11.26

500

Visual LISP AutoCAD


5.1 ()

vl-princ-to-string


p r i n c

2.11.25

vl-propagate



,
AutoCAD

2.17.30

vl-registry-delete


Windows

2.17.8

vl-registry-descendents


Windows

2.17.9

vl-registry-read


Windows

2.17.6

vl-registry-write


Windows

2.17.7

vl-remove

2.9.26

vl-remove-if

2.9.27

vl-remove-if-not

2.9.28

vl-some

,


-

2.9.29

vl-sort

2.9.30

vl-sort-i

2.9.31

2.8.9

2.8.11

2.8.12

vl-string->list

vl-string-elt

vl-string-left-trim

5. AutoUSP

501

5.1()

vl-st r ing-mismatch

2.8.15

vl-string-position

2.8.16

vl-string-right-trim

2.8.13

vl-string-search

2.8.17

vl-string-subst

2.8.18

vl-string-translate

2.8.19

vi-string-trim

2.8.14


vl-symbol-name

2.8.20

2.6.23

VLX-,

2.5.20

vl-vbaload
vl-vbarun

VBA

2.17.23
2.17.24

vl-vlx-loaded-p

,
VLX-

2.17.20'

vla-get-activedocument

7.1.5

vla-get-modelspace

7.1.6

vla-get-paperspace

7.1.7

vlax-3D-point

7.1.19

vlax-add-cmd

AutoCAD

7.2.1

vlax-create-object

VLA-

7.3.8

vlax-curve-getArea

VLA-

7.7.1

vlax-curvegetClosestPointTo

7.7.15

vl-symbol-value
vl-symbolp
vl-unload-vlx

VBA-

2.17.21

502

Visual LISP AutoCAD


/75.1 ()

vlax-curvegetClosestPointToProjection

7.7.16

vlax-curve-getDistAtParam

7.7.11

vlax-curve-getDistAtPoint

7.7.5

vlax-curve-getEndParam

7.7.7

vlax-curve-getEndPoint

7.7.3

vlax-curve-getFirstDeriv

7.7.17

v l ax-curve-get ParainAtDist

7.7.10

vlax-curve-getParamAtPoint

7.7.8

vlax-curve-getPointAtDist

7.7.4

vlax-curve-getPointAtParam

,
,

7.7.9

vlax-curve-getSecondDeriv

7.7.18

vlax-curve-getStartParam

7.7.6

vlax-curve-getStartPoint

7.7.2

vlax-curve-isClosed

7.7.12

vlax-curve-isPeriodic

7.7.13

vlax-curve-isPlanar

7.7.14

vlax-dump-object

,
,

7.1.25

5. AutoLISP

503

5.1 ()

vlax-ename->vla-object


VLA-

7.1.11

vlax-erased-p

, VLA-

7.3.1

vlax-for

7.3.13

vlax-get-acad-object


A p p l i c a t i o n

7.1.4

vlax-get-obj ect

7.3.9

vlax-get-or-create-object

7.3.10

vlax-get-property

VLA-

7.6.1

vlax-import-type-library

7.3.11

vlax-invoke-method

ActiveX

7.2.3

vlax-ldata-delete

LlSP-

7.4.4

vlax-ldata-get

LlSP-

7.4.2

vlax-ldata-list

LlSP-

7.4.3

vlax-ldata-put

LlSP-

7.4.1

vlax-ldata-test


LlSP-

7.4.5

vlax-make-safearray

7.1.21

vlax-make-variant

7.1.15

vlax-map-collection

7.3.12

vlax-method-applicable-p

7.3.2

vlax-object-released-p

7.3.4

vlax-product-key

AutoCAD
Windows

7.2.4

504

Visual LISP AutoCAD


5.1 ()

vlax-property-available-p

7.6.3

vlax-put-property

VLA-

7.6.2

vlax-read-enabled-p

7.3.6

vlax-release-6bject

7.3.5

vlax-remove-cmd

7.2.2

vlax-safearray-fill

7.1.23

vlax-safearray-get-dim

7.5.2

vlax-safearray-get-element

7.5.4

vlax-safearray-get-1-bound

7.5.2

vlax-safearray-get-u-bound

7.5.3

vlax-safearray-put-element

7.1.22

vlax-safearray-type

7.5.5

vlax-safearray->list

7.5.6

vlax-tmatrix

4x4,
ActiveX

7.5.7

vlax-typeinfo-available-p

7.3.3

vlax-variant-change-type

7.1.18

vlax-variant-type

7.1.16

vlax-variant-value

7.1.17

vlax-vla-obj ect->ename

VLA-
AutoCAD

7.1.12

vlax-write-enabled-p

7.3.7

vlisp-compile

LSP-
FAS-

2.16.8

vlr-acdb-reactor

7.8.10

5. AutoLISP

505

5.1 ()

vlr-add

7.8.34

vlr-added-p

7.8.35

7.8.7

7.8.15

,
,

7.8.36
7.8.37

vlr-data-set

7.8.38

vlr-deepclone-reactor

7.8.16

vlr-docmanager-reactor

7.8.11

vlr-dwg-reactor

,
,
,

7.8.17

vlr-dxf-reactor

,
DXF-

7.8.18

vlr-editor-reactor

7.8.14

vlr-insert-reactor

7.8.19

vlr-linker-reactor

/ ARX-

7.8.12

vlr-lisp-reactor

7.8.20

vlr-beep-reaction
vlr-command-reactor
vlr-current-reaction-name
vlr-data

LISP-
vlr-miscellaneous-reactor

7.8.21

7.8.22

vlr-object-reactor

7.8.13

vlr-owner-add

7.8.39

vlr-mouse-reactor
vlr-notification

7.8.42

506

Visual LISP AutoCAD


5.1 ()

vir-owner-remove

7.8.40

vlr-owners

7.8.41

vlr-pers

7.8.45

vlr-pers-list

7.8.48

vlr-pers-p

7.8.47

vlr-pers-release

7.8.46

vlr-reaction-names

7.8.6

vlr-reaction-set

7.8.29

vlr-reactions

7.8.31


vlr-reactors

7.8.3

7.8.32
7.8.33

7.8.43

vlr-sysvar-reactor

7.8.23

vlr-toolbar-reactor

7.8.24

vlr-trace-reaction


(Trace)

7.8.8

vlr-type

7.8.4

vlr-types

7.8.2

vlr-remove
vlr-remove-all

vlr-set-notification

5. AutoLISP

507

5.1 ()

vlr-undo-reactor

7.8.25

vlr-wblock-reactor

,
(WBLOCK)

7.8.26

vlr-window-reactor

,

AutoCAD

7.8.27

vlr-xref-reactor

7.8.28

vports

2.6.22

wcmatch

2.8.8

while

2.5.24

write-char

2.11.10

write-line

2.11.5

xdroom

2.14.5

2.14.4

2.5.15

xdsize

zerop

. 5.1 via-, via-get- via-put-:


ActiveX (, via-addLine AddLine);
(, via-get-Layer );
(, via-put-Layer
).
VLA-.

ending
ending rem, if, and, or.
! 6.1. ending
1
**** .
**** .., 1999 .

****
****

****
****
****
****
****
****
****
****
****
****
****
****

****
****
****
****
****
****
****
****
****
****
****
****

.
:
rnm - ;
si - - mm=l,21,31, ...;
s2 - - mm=2, 3,4,22, 23,24, 32, 33,34, ...;
s3 - - mm.
:
nunm - (abs mm)/100;
ml - mmm/10;
let - .
:
(let).

(defun ending (mm si s2 s3 / mmm ml let)


(setq
let s3
mmm (rem (abs mm) 100)
ml (rem mmm 10)
) ; setq
(if
(and
(= ml 1)

6. ending

509

( o r (= mmm 1) (>= mmm 2 1 ) )


) ; and

(setq let si)


); if
(if
(and
(>= ml 2)
(<= ml 4)
(or (<= mmm 4)(>= mmm 22))
) ; and
(setq let s2)
) ; if
; let
let
); defun
. -,
mm mmm, mm 100 (. . (rem
mm 100)). -, (, ,
), , :
mmm= 1, 21, 31, 41, ..., 91 ( 1, );
mmm = 2, 3, 4, 22, 23, 24, 32, 33, 34, ..., 92, 93, 94 ( 2, 3 4,
12, 13 14);
mmm = 0, 5, 6, 7, 8, 9, 10, 25, 26, ..., 95, 96, 97, 98, 99 ( 0, 5, 6, 7, 8,
9), mmm = 11, 12, 13.
, " 3 " 3 ,
.
ending :
( s t r c a t "" (ending nn "" "" "") " " (itoa nn) " "
(ending nn "" "" "") " " (ending nn "" "" "")
" " (ending nn "" "" "")
)
=1 : " 1 ", =14
" 14 ", 1002 " 1002
".

divpts
divpts AutoCAD
(DIVIDE) command, entsei,
entlast, entnext, entget, assoc, trans, entdel, alert.
i 7.1. divpts
****
****
****
****


****
(DIVIDE) , ****
.
****
.., 1999 .
****

**** .
**** :
****
kols - .
**** :
****
spit - ;
****
sp - , entsei
****
;
****
elast -
****
;
,
****
els - () ;
****
list els - els;
****
koor - "POINT".
**** :
****
(spit).

(defun divpts (kols / spit sp elast els list_els koor)


(setq spit ' ) ; ,

****
****
****
****
****
****
****
****
****
****
****
****
****
****

7. divpts
;
(if (< kols 2)
(progn
(alert " 2")
(princ);
); progn
(progn
(setq sp nil)
; (, )
(while (null sp)
(setq sp (entsel
(strcat
" , "
(itoa kols)
" : "
); strcat
)); entsel, setq
); while
;
(setq elast (entlast))
;
; (, "VERTEX")
;
(while (setq els (entnext elast))
(setq elast els)
); while
; (DIVIDE)
(command "_DIVIDE" sp (itoa kols))
; ( "POINT"),
; (DIVIDE)
(setq els elast)
(while (setq els (entnext els))
(setq list_els (entget els))
(setq koor (cdr (assoc 10 list_els)));
; koor
(setq koor (trans koor els 0))
; spit
(setq spit (append spit (list koor)))
; "POINT"
(entdel els)
); while

511

512

Visual LISP AutoCAD

; - spit
spit
); progn
);if
);defun divpts

divpts , "POINT" .
(DIVIDE) PDSIZE PDMODE, , . . , ,
.
, : (150 27.88),
(233.5 5.8) (64.03 71.519), (divpts 5)

(61.1354

({225.254
162.629

79.3208
0.0)).

0.0)

(219.338

170.284

0.0)

(138.055

211.544

0.0)

strcaser
strcaser , - ( ascii, chr, substr, strlen, strcase,
strcat). , , strcase
.
| 8.1. s t r c a s e r

. * * -
.
.

, ,
.
.., 2000 .

.
:
. -kic-kk str - ;
. -
- (nil - ,
.
- ).
. + - :
.-
strn - ;
. -
lens - str;
.-
i - str;
.
sy - ;
.
as - sy.
. :
.
(strn).

---
*

-- -

. ****

---

. ***

---

(defun strcaser (str pr / strn lens i sy as)


(setq strn "" lens (strlen str))
(if (> lens 0)
(progn
(setq i 0)

17 155

- -*
---
-- *
- --
---
- --
---
--

514

Visual LISP AutoCAD


(while (< i lens)

(setq i (1+ i) sy (substr str i 1) as (ascii sy))

; sy ( )
(setq sy
(if pr
;
(if (and (>= as 192) (<= as 223)); -
(chr (+ as 32))
(strcase sy pr)
); if 192-223
;
(if (and (>= as 224) (<= as 255)); -
(chr (- as 32))
.
(strcase sy pr)
); if 224-255
); if pr
); setq sy
(setq strn (strcat strn sy))
); while
); progn
); if lens
; strn
strn
); defun

s t r (sy). sy
( 192223 224255), , pr, sy
. strn.


mapko ,
ssget ( ),
command, ssnarae, sslength, while, getvar

(UNDO), (LAYER),
(EXPLODE), (AREA).

(ERASE),

i 9.1. mapko

**** ****
**** ( DET). ****
**** , - ****
**** POLYLINE CONTOUR,
****
**** , POLYLINE
****
**** HOLE. X Y ****
**** .
****
**** (0,0). ****
**** (. . ) - ****
**** USERR2 USERR3.
****
**** CONTOUR HOLE ( - ****
**** ),
****
**** POLYLINE, - ****
**** DET - ****
**** . ,
****
**** - ****
**** . .****
**** - ****
**** .
****
**** .., 2000 .
****
**** .
**** .

+***
****

516

Visual LISP AutoCAD

**** :
****
****
pll,pl2 - ;

****
****
sscon - POLYLINE CONTOUR; ****
****
sshol - POLYLINE HOLE;
****
****
ssins - INSERT ( );****
****
lss - sscon sshol;
****
****
j_ _ ;
****
****
- ;
****
****
arhol - ;
****
****
artot - .
****
**** :
****
****
.'
****

(defun mapko ( / pll pl2 sscon sshol ssins lss i arcon arhol artot)
USERR2, USERR3
(setq pll (getvar "USERR2") 12 (getvar "USERR3"))
(UNDO) ,

(command "JJNDO" "_M")
CONTOUR HOLE
(command "_LAYER" "_0N" "CONTOUR,HOLE" "")
POLYLINE
CONTOUR HOLE (ERASE)
(if
(setq sscon
(ssget "_C"
1
(0.0 0.0) (list pll pl2)
'((0 . "POLYLINE") (8 . "CONTOUR"))
); ssget
)
(command "_ERASE" sscon "")
);if
(if
(setq sshol
(ssget "_C"
1
(0,0 0.0) (list pll pl2)
'((0 . "POLYLINE") (8 . "HOLE"))
); ssget
)
(command "_ERASE" sshol "")
);if
DET
(EXPLODE)

9. mapko
(if
(setq ssins
(ssget "_C"
1
(0..0 0.0) (list pll pl2)
1
((0 . "INSERT") (8 . "DET"))
); ssget
)
(command "_EXPLODE" ssins)

POLYLINE
CONTOUR ( )
(setq sscon
(ssget "_C"
'(0.0 0.0) (list pll pl2)
'((0 . "POLYLINE") (8 . "CONTOUR"))
); ssget
)
POLYLINE
HOLE ( )
(setq sshol
(ssget "_C"
1
(0.0 0.0) (list pll pl2)
'((0 . "POLYLINE") (8 . "HOLE"))
); ssget


(setq arcon 0.0)
(if sscon
(progn
(setq i 0 lss (sslength sscon))
(while (< i lss)
(command "_AREA" "_E" (ssname sscon i))
;
; AREA
(setq arcon (+ arcon (getvar "AREA")))
(setq i (1+ i))
)/while
);progn
);if

(setq arhol 0.0)
(if sshol
(progn

517

518

;
;
;
;
;

Visual LISP AutoCAD

(setq i 0 lss (sslength sshol))


(while (< i lss)
(command "_AREA" "_E" (ssname sshol i))
(setq arhol (+ arhol (getvar "AREA")))
(setq i (1+ i))
);while
);progn
);if

(setq artot (- arcon arhol))


(command "JJNDO" "_")
-
; artot <= 0,
(if (> artot 0.0)
(/ artot (* pll pl2))
0.0

mapko (UNDO), (Mark), ,


, (Back),
.
(LAYER) CONTOUR HOLE (
, ). ssget, ""
(,
" " ) , sscon, sshol ssins. ,
, "",
( , ).
(POLYLINE INSERT)
(CONTOUR, HOLE DET). sscon sshol
(ERASE), . ssins (EXPLODE) ( ,
" <Enter>).
CONTOUR
, HOLE .
sscon sshol .

519

9. mapko

sscon ' . sshol


arhoi.
(AREA) (Entity). AREA.
, arhoi,
artot.
(if) . artot , (
, ).
artot , (. . USERR2 USERR3).
mapko
( , ,
). . 9.1
.
AutoCAD 2000 -
$' > * EsJB* 0*>

. Igl ||

~3||

J Utwrt /
[
[
(

.
. 9.1.

1ft

1 0

xdapp
xdapp . entget, cons, append,
entmod.
: 10.1. xdapp

****
****
****
****
****
****

entrb ,
:
- ( ),
- ( ).
.., 2000 .

****
****
****
****
****
****

****
****
****
****
****
****
****
****
****
****
****
****
****

.
****
:
****
entrb - , ****
;
****
- , ;
****
gabl - ( );
****
2 - ( );
****
mat - ( ).
****
:
****
elist - , entget
****
entrb;
****
xd_list - .
****
( ).
****

(defun xdapp (entrb aname gabl gab2 mat / elist xd list)


10. xdapp

;
;
;
;
;
;
;
;
;
;
;

521

(setq e l i s t (entget entrb))


aname
(regapp aname)
,

(DXF- 1002)
(setq x d ^ l i s t ( l i s t '(1002 . "}")))
(DXF- 1000)
(setq xd_list (cons (cons 1000 mat) xd_list))
2 (DXF- 1040)
(setq xd_list (cons (cons 1040 gab2) xd_list))
1 (DXF- 1040)
(setq xd_list (cons (cons 1040 gabl) xd_list))
(DXF- 1002)
(setq xd_list (cons '(1002 . "{") xd_list))
DXF- -3
(setq xd_list ( l i s t -3 (cons aname x d _ l i s t ) ) )
e l i s t
(setq e l i s t (append e l i s t ( l i s t x d _ l i s t ) ) )
entrb
(entmod e l i s t )
( )
(prinl)

xdapp entrb
entget. aname (
) .
,
, DXF- 1002 (
). xd_iist, . xd_iist elist. entmod
entrb elist.

'

1 1

setiout
setiout .
initget, getvar, getkword, layoutlist,
load_dialog, unload_dialog, new_dialog, start_dialog, done_dialog, exit,
mapcar, start_list, add__list, end_list, action_tile, mode_tile.
11.1 setiout.
j 11.1. eetlout

.****************************J*****************************************
**** ,
**** .
**** .., 2000 .

****
****
****

**** :
****
****
loname - , (
****
****
- );
****
****
kl_new - (1 - , 0 - ). ****
**** :
****
****
fdcl - DCL-, ****
****
.
****
**** :
****
**** - ( , "Y" " N " ) ;
****
****
all_loutn - , ****
****
;
****
****
dcl_id - .
****
**** ( ).
****

(defun setiout (fdcl / yn all_loutn dcl_id)


: ?
(if (/= (getvar "TILEMODE") 0)
(progn

11. setlout

523

(initget "Y N")

;
;
;

(setq yn (getkword " [Y/N]? <Y> "))


(if (or (null yn) (= yn "Y"))
(progn


(setq all_loutn (layoutlist) loname (car all_loutn) kl_new 0)
DCL-
(if (< (setq dcl_id (load_dialog fdcl)) 0)
(progn
(alert "He DCL-")
(exit)
);progn
);if

(if (not (new_dialog "lout" dcl_id))
(progn
(alert "He ")
(exit)
);progn
);if

(start_list "louts_old")
(mapcar 'add_list all_loutn)
(end_list)

i
;
; -
(action_tile "louts_old"
"(setq loname (nth (atoi $value) all_loutn))"
);action_tile
;
(action_tile "lout_new" "(setq loname $value)")
;
(action_tile "kl_new"
(strcat
"(mode_tile \"lout_new\" (- 1 (setq kl_new (atoi $value))))"
"(mode_tile \"louts_old\" kl_new)"
);strcat
);action_tile
; "" ( )
(action_tile "accept" "(done_dialog)")
; "" ( )
(action_tile "cancel" "(setq kl_new -1)(done_dialog)")

524

Visual LISP AutoCAD

;
(start_dialog)
; DCL-
(unload_dialog dcl_id)
; .
(command "TILEMODE" 0)
; (LAYOUT)
(if (= kl_new 1)(command "_-LAYOUT" "_N" loname))
; loname,
; ""
(if (>= kl_new 0)(command "" loname))
);progn
);if
);progn
) ; if
(princ)
11.2 setlout.dcl,
setlout.

; 11.2. setlout.dcl

// " ".
// .
// .., 2000 .
/ft********************************************************************
lout: dialog
{
label = " ";
: column
{
: row
{
: toggle {label = " ^HCT";key="kl_new";value="0";}
: edit_box
{
is_enabled=false;
label = "";
edit_width = 4 0;
alignment = centered;
value = "";
key = "lout_new";
}// edit box

11. setiout

525

}11 row
: spacer {height=l;}
: popup_list
{
key = "louts_old";
is_enabled = true;

label = " ";


list = "";
edit_width = 20;
value = "0";
fixed_height = true;
alignment = left;
}// popup_list
: spacer {height=l;}
ok_cancel;
}// column
}// dialog
setiout TILEMODE. 0 (
), . TILEMODE 0 ( , ), initget
getkword. loaddialog DCL- (
fdci). "
DCL-" (
exit).
lout
.
,
(. 11.1).

B I

"

-.:

'
"

'

"

.
..

.
'

.
'

'

'

" "

"

-.1
rj:

|1
:

.'

" . '

-:

:
-

'
'

/ .

'
"

' : '

"

. . .

:; '[': '' '':''' " "


.

"

'

"

'

"

"

"

. 11.1.

526

Visual LISP AutoCAD

, ( .
1). layoutiist.
start_list, add_list, end_list mapcar.


,
.
, ,
, .

,
.
mode_tile.

, . (LAYOUT),
(
_-LAYOUT).
,
.

(, ),
(LAYOUT) .

1 2

al_vps
ai_vps , . (MVSETUP)
AutoCAD LSP- mvsetup.lsp.
command.

(SCRIPT). getvar, initget,
getkword, while, entget, command, assoc, entsel, open, close, write-line, rtos,
strcat, car, cdr, caddr.

LSP-, -
AutoCAD, , 12.1
ai_vps , 12.2 .
; 12.1. al_vps ( )

****
****
****
****
****

( )
.
, ( ).
.., 2000 .

****
****
****
****
****

**** .
****
**** .
****
**** :
****
**** vh - (, );
****
**** svl - , 1- ****
****
entsel;
****
**** lcvpl - 1- ;
****
**** nl - 1- ;
****
**** sv2 - , 2- ;
****

528

Visual LISP AutoCAD

**** Icvp2 - 2- ;
****
**** 2 - 2- ;
****
**** fscr - ****
****
(MVSETUP).
****
**** ( ). .
****

(defun al_vps ( / vh svl lcvpl nl sv2 Icvp2 n2 fscr)



(if (= (getvar "TILEMODE") 0)
(progn

(princ "\ .")
(initget " ")
(setq vh
(getkword
" [/] <>: "
);getkword
) ; set'q
(if (not vh) (setq vh "B") )

(command "_PSPACE")
1-
(setq svl nil)
(while (null svl)
(setq svl (entsel " : "))
(if svl
(progn
(setq lcvpl (entget (car svl)))
(if (/= "VIEWPORT" (cdr (assoc 0 lcvpl)))
(progn
(setq svl nil)
(princ " . ")
);progn
);if
);progn
);if
);while
1-
(setq nl (cdr (assoc 69 lcvpl)))
1-
(command "_MSPACE" "CVPORT" nl)
, 1-
( )
(initget 1)

12. al_vps

529

(setq pi (getpoint " : "))


;

;
;

;
;
;

2-
(command "_PSPACE")
(setq sv2 nil)
(while (null sv2)
(setq sv2 (entsel "\ : "))
(if sv2
(progn
(setq Icvp2 (entget (car sv2)))
(if (/= "VIEWPORT" (cdr (assoc 0 Icvp2)))
(progn
(setq sv2 nil)
(princ " . ")
);progn
2-
( )
(if (= (setq n2 (cdr (assoc 69 Icvp2))) nl)
(progn
(setq sv2 nil)
(princ " .")
);progn
);if =
);if /=
);progn
);if sv2
);while
2-
(command "_MSPACE" "CVPORT" n2)
, 1-
( )
(initget 1)
(setq p2 (getpoint " : "))

(MVSETUP)


(setq fscr (open "al-vps.scr" "w"))

(write-line "_PSPACE" fscr)

(write-line " " fscr)
( )
(write-line vh fscr)
1-

;
;
;
;

530

Visual LISP AutoCAD

(write-line (strcat "'CVPORT " (itoa nl)) fscr)


; 1-
(write-line
(strcat
(rtos (car pi) 2 6)
(rtos (cadr pi) 2 6)
IT Tl
I
(rtos (caddr pi) 2 6)
)/strcat
fscr .
);write-line
; 2-
(write-line (strcat "'CVPORT " (itoa n2)) fscr)
; 2-
(write-line
(strcat
(rtos (car p2) 2 6)
II I
I
(rtos (cadr p2) 2 6)
II M
/
(rtos (caddr p2) 2 6)
);strcat
fscr)
(MVSETUP)
(write-line " " fscr)
;
(close fscr)
;
(command "_SCRIPT" "al-vps.scr")
);progn
(alert " ")
);if
(princ) 12.2 ,

12.1.
I 12.2. al_vps ( )
(defun al_vps ( / vh svl lcvpl nl sv2 Icvp2 n2 fscr)
;
(if (= (getvar "TILEMODE") 0)
(progn

12. al_vps
;

;
;

;
;
;
;

531


(princ " .")
(initget "Vertical Horizontal")
(setq vh
(getkword
"\ [Vertical/Horizontal] <V>: "
);getkword
);setq
(if (not vh) (setq vh "V"))

(command "_PSPACE")
1-
(setq svl nil)
(while (null svl)
(setq svl (entsel " : "))
(if svl
(progn
(setq lcvpl (entget (car svl)))
(if (/= "VIEWPORT" (cdr (assoc 0 lcvpl)))
(progn
(setq svl nil)
(princ " . ")
);progn
) ; if
);progn
) ; if
);while
1-
(setq nl (cdr (assoc 69 lcvpl)))
1-
(command "_MSPACE" "CVPORT" nl)
, 1-
( )
(initget 1)
(setq pi (getpoint " : "))
2-
(command "__PSPACE")
(setq sv2 nil)
(while (null sv2)
(setq sv2 (entsel " : "))
(if sv2
(progn
(setq Icvp2 (entget (car sv2)))
(if (/= "VIEWPORT" (cdr (assoc 0 Icvp2)))

532

Visual LISP AutoCAD


(progn
(setq sv2 nil)

;
;
;

(princ " . ")


);progn
2-
( )
(if (= (setq n2 (cdr (assoc 69 Icvp2))) nl)
(progn
(setq sv2 nil)
(princ " .")
);progn
);if =
);if /=
);progn
);if sv2
);while
2-
(command "_MSPACE" "CVPORT" n2)
, 1-
( )
(initget 1)
(setq p2 (getpoint " : "))

; (MVSETUP)
;
(setq fscr (open "al-vps.scr" "w"))
;
(write-line "_PSPACE" fscr)
; MVSETUP Align
(write-line "MVSETUP A" fscr)
; (Vertical Horizontal)
(write-line vh fscr)
; 1-
(write-line (strcat "'CVPORT " (itoa nl)) fscr)
; 1-
(write-line
(strcat
(rtos (car pi) 2 6)
(IfII
(rtos (cadr pi) 2 6)
IIII?
(rtos (caddr pi) 2 6)
);strcat
fscr

12. al_vps

;
;

;
;
;

533

);write-line
2-
(write-line (strcat "'CVPORT " (itoa n2)) fscr)
2-
(write-line
(strcat
(rtos (car p2) 2 6)
H II
/
(rtos (cadr p2) 2 6)
(I II
t
(rtos (caddr p2) 2 6)
);strcat
. fscr)
(MVSETUP)
(write-line "' " fscr)

(close fscr)

(command "_SCRIPT" "al-vps . scr")
);progn
(alert " ")
);if
(princ)


(MVSETUP).
command, al_vps.scr,
(SCRIPT) ( command).
(

(SCRIPT)
AutoCAD, command.

12.3 al_vsp.scr .
\ 12.3. al_vps.scr
_PSPACE
MVSETUP
V
'CVPORT 3

534

Visual LISP AutoCAD

116.359383,0,-262.203237
'CVPORT 2
116.359383,0,-262.203237
,
.
<Enter> (
(MVSETUP)).
, a l v s p ,
: al_vsp.scr
.

1 3

vl_fs
v i f s
(, , ),
. getfiled, vl-filename-base,
vl-filename-directory, vl-filename-extension, vl-file-delete, substr, strlen,
strcat, rtos, getvar, write-line, alert, open, close.
j 13.-1. vl_f s
****
****
****
****
****
****

() . ****
:
*+**
<>$<>.txt, , ,
****
. , ****
, , .****
.., 2000 .
****

**** .
**** .

**** :
****
fname - ; ****
fbase - fname;
****
fdir - , fname;
****
fdirl - fdir, "\";
****
fext - ( );
****
ffnam - ;
****
fa - ;
****
strd - .
**** :
**** nil.

(defun vl fs ( / fname fbase fdir fdirl fext ffnam fa strd)

****
****
****
****
****
****
****
****
****
****
****
****
****

536
;
;

;
;
;
;

;
;
;

;
;
;

Visual LISP AutoCAD


( , AutoCAD)
(setq fname (getfiled " " "" "*" 16))
(if fname
(progn

(setq fbase (vl-filename-base fname))

(setq fdir (vl-filename-directory fname))
(":\"),
"\"
(setq fdirl
(if (= (substr fdir (strlen fdir)) "\\")
(substr fdir 1 (1- (strlen fdir)))
fdir
);if
);setq

(setq fext (vl-filename-extension fname))

(if (not fext) (setq fext ""))
,
(vl-file-delete
(setq ffnam
(strcat fdirl "\\" fbase "$" (substr fext 2) ".txt")
) ; setq
);vl-file-delete

(setq fa (open ffnam "w"))
CDATE
(setq strd (rtos (getvar "CDATE") 2 0))

(write-line
(strcat
": "
(substr strd 7 2)
(substr strd 5 2)

(substr strd 1 4)
);strcat
fa
);write-line
; ,
(write-line (strcat " : " fbase) fa)
(write-line (strcat ": " fext) fa)

13. vl_fs

537
\

(write-line (strcat ": " fdir) fa)


;
(close fa)
(alert (strcat " - . " ffnam))
);progn
(alert " ")

vi_fs ,
g e t f i l e d . g e t f i l e d

,
( ,
AutoCAD). "*",
. getfiled fname (, "d:\Archive\Drawl.dwg").

fbase
("Drawl"),
fdir
("d-. Wrchive"), fext (".dwg"). ("d:\")
fdir \ ,
fdirl, \.
ffnam
("d:\Archive\Drawi$dwg.txt"). ,
vl-f ile-delete.

.
, . . , .

CDATE : 20010327.09123045.
( , ,
). ( , , ,
). CDATE 27 2001
9 12 30 .

( ).
alert.

1 4

ffp flp
14 (LINE, POLYLINE, LWPOLYLINE, ARC, SPLINE). entsel, entget, assoc, cond, append, list, princ,
trans, entnext.
14.1 ffp,
.
j 14.1. ffp
**** - ****
**** LINE, POLYLINE, LWPOLYLINE, ARC, SPLINE.
****
**** .., 2000 .
****
**** .
****
**** .
****
* * * * :
****
****
w - , entsel;
****
**** _ ;
****
****
1 - ;
****
****
ten - ;
****
****
- DXF- 10;
****
**** pt - .
****
**** :
****
****
nil ( ****
****
).
*+**

(defun ffp ( / w le e ten calO pt)



(setq w
(entsel

14. ftp flp

;
;
;
;
;

539

" LINE, ARC, POLYLINE, LWPOLYLINE, SPLINE: "


);entsel
);setq; ,
(while (null w) (setq w (entsel " , : ")))
, DXF- 0 10
(setq
le (entget (setq e (car w) ) )
ten (cdr (assoc 0 le))
calO (cdr (assoc 10 le))
);setq

(princ (strcat "\n" ten " "))

(setq pt
(cond
LINE SPLINE
((or (= ten "LINE")(= ten "SPLINE")) calO)
LWPOLYLINE ( calO )
((= ten "LWPOLYLINE") (append calO (list (cdr (assoc 38 le)))))
ARC ( , )
((= ten "ARC")
(list
(+
(car calO)
(* (cdr (assoc 40 le)) (cos (cdr (assoc 50 le))))

(cadr calO)
(* (cdr (assoc 40 le)) (sin (cdr (assoc 50 le))))
); +
(caddr calO)
);list
)
; POLYLINE ( )
((= ten "POLYLINE")(cdr (assoc 10 (entget (entnext e)))))
; nil
(
(princ "\ . ")
nil
);
);cond
);setq pt
;
(if pt (trans pt e 1))
);defun ffp

540

Visual LISP AutoCAD

entget
, . cond.
LINE SPLINE
DXF- 10.
ARC 10 ,
(
40) ( 50).
( LWPOLYLINE)
DXF- 10 . 38.
POLYLINE
VERTEX, entnext , -
POLYLINE.

trans 1.
fip,
, 14.2.
| 14.2. f l p
****
**** LINE, POLYLINE, LWPOLYLINE, ARC, SPLINE.
**** .., 2000 .

|
****
****
****

**** .
****
**** .
****
**** :
****
**** w _ , e n t s e l ;
****
**** - ;
****
**** 1 - ;
****
**** ten - ;
****
**** - DXF- 10;
****
**** el - ( );
****
**** pt - .
****
**** : ,
****
****
n i l ( ****
****
).
****

14. ffp flp

541

(defun flp ( / w le e ten calO el pt)

;
(setq w
(entsel
" LINE, ARC, POLYLINE, LWPOLYLINE, SPLINE: "
);entsel
);setq (while (null w) (setq w (entsel "\ , :
")))
;
(setq
le (entget (setq e (car w)))
ten (cdr (assoc 0 le))
calO (cdr (assoc 10 le))
);setq
;
(princ (strcat "\n" ten " "))
;
(setq pt
(cond
; LINE
( (= ten "LINE") (cdr (assoc 11 le)))
; SPLINE
((= ten "SPLINE") (cdr (assoc 10 (reverse le))))
; LWPOLYLINE ( )
( (= ten "LWPOLYLINE")
(append
(if (= 1 (cdr (assoc 70 le))) ; ?
calO;
=
(cdr (assoc 10 (reverse le)))
);if
(list (cdr (assoc 38 le)))
);append
);LWPOLYLINE
; ARC ( , )
((= ten "ARC")
(list
(+
(car calO)
(* (cdr (assoc 40 le)) (cos (cdr (assoc 51 le))))

(cadr calO)
(* (cdr (assoc 40 le)) (sin (cdr (assoc 51 le))))

542

Visual LISP AutoCAD

(caddr calO)
) /ARC
POLYLINE ( , SEQEND)
((= ten "POLYLINE")
(if (= 1 (cdr (assoc 70 le))); ?
(cdr (assoc 10 (entget (entnext e)))); =
(progn
(setq el (entnext e))
(while (= "VERTEX" (cdr (assoc 0 (entget (entnext el)))))
(setq el (entnext el))
);while
(cdr (assoc 10 (entget el)))
);progn
);if
) ; POLYLINE
; nil
(
(princ "\ . ")
nil
);
);cond
);setq pt

(if pt (trans pt e 1))
);defun flp
;

f lp , f fp.
LINE
DXF- 11. SPLINE
10.
ARC 10, , 40 () ( 51).
( LWPOLYLINE)
DXF- 10, .
, ffp,
38. (. .
70 1), ,

LWPOLYLINE .

14. ffp flp

543

POLYLINE , VERTEX, ( SEQEND), . LWPOLYLINE,


70, 1 .
trans.

1 5

DXF- AutoCAD
AutoCAD ( )
DXF-. . 15.1 15.2 , .
. 2.12 , AutoCAD
DXF-, .
, AutoLISP ObjectARX, ,
DXF ( DXF
(SAVEAS)). , DXF,
"DXF". ,
AutoLISP ObjectARX, "".
15.1. DXF-

09

( , 2000 )

1059

( )

6079

16-

9099

32-

100

( 255 ;
Unicode)

102

( 255 ;
Unicode)

105

(handle)

140147

170175

16-

15. DXF- AutoCAD

545

15.1 ()

280-289

8-

300-309

310-319

320-329

330-369

370-389

8-

390-399

400-409

16-

410-419

999

1000-1009

( DXF- 09)

1010-1059

1060-1070

16-

1071

32-

15.2.

-5

-4

: ( ssget)

-3

: ()

-2

: ()

-1

: . AutoCAD
( ). ()

()

(, . .)

3-4

( 16 , )

18

. 155

546

Visual LISP AutoCAD


15.2 ()

()

()

()

DXF: (
HEADER DXF-)

10

( , . .).
DXF: - ( Y Z 20 30)
: ( )

1118

.
DXF: - ( Y 21-28,
Z 31-38);
: ( )

20, 30

DXF: Y Z (. 10)

2128

DXF: Y (. 1118)

3137

DXF: Z (. 1118)

38

DXF: ( )

39

(thickness) , ()

4047

( , . .)

48

( )

49

(
49 , 7). 49
(, LTYPE)

5058

( DXF-; AutoLISP ObjectARX)

60

, (1 ; 0
60 )

62

()

66

()

67
68

( , )
: , ' ,
;

69

547

15. DXF- AutoCAD

15.2 ()

7078

, , ,

9099

32-

100

( ). ,
. ,
ObjectARX

102

, "{<>" "}". 1002


. { ,
. , ,
}. AutoCAD ( (AUDIT)),

105

DIMVAR

210

().
DXF: X ;
:

220

DXF: Y

230

DXF: Z

280289

8-

290299

( )

300309

310319

,
1004: 254
127

320329

, " ".
(INSERT) (XREF)

330339

.
DXF-.
(INSERT) (XREF)

340349

.
DXF-.
(INSERT) (XREF)

350359

. DXF. (INSERT) (XREF)

18*

548

visual LISP AutoCAD


15.2 ()

360369

. DXF. (INSERT) (XREF)

370

"" (enum).
(AcDb::LineWeight)

371379

""

380

"".
(AcDb::PlotStyleNameType)
""

381389
390

(
; , , )

391399

400409

16-

410419

999

DXF: . (SAVEAS) DXF- 999 ,


DXF-

1000

255 - ( )

1001

( 31 ),

1002

({ })

1003

1004

( 127 ),

1005

, 16
( )

1010

, .
DXF: X (Y Z DXF- 1020 1030);
:

1011

, ( ).
DXF: X (Y Z DXF- 1021 1031);
* :

15. DXF- AutoCAD

549
15.2 ()

1012

, ( ).
DXF: X (Y Z DXF- 1022 1032);
:

1013

, ( ).
DXF: X (Y Z DXF- 1023 1033);
:

1020

DXF: Y , DXF- 1010 ( )

1021

DXF: Y , DXF- 1011 ( )

1022

DXF: Y , DXF- 1012 ( )

1023

DXF: Y , DXF- 1013 ( )

1030

DXF: Z , DXF- 1010 ( )

1031

DXF: Z , DXF- 1011 ( )

1032

DXF: Z , DXF- 1012 ( )

1033

DXF: Z , DXF- 1013 ( )

1040

1041

1042

1070

16- ,

1071

32- ,

DXF :
HEADER (
);

550

Visual LISP AutoCAD

CLASSES , , BLOCKS, ENTITIES


OBJECTS;
TABLES (APPID,
BLOCK_RECORD, DIMSTYLE, LAYER, LTYPE, STYLE, UCS, VIEW,
VPORT . 2.13.1);
BLOCKS
;
ENTITIES ;
OBJECTS , ;
THUMBNAILIMAGE ( ).
,
ENTITIES. . 15.3 DXF-,
.
(15.45.10),
.
, , , DXF-,
,
AutoCAD .
15.3. DXF-, ENTITIES

-1

: (
)

(BYLAYER)

48

1.0

60
62

(0 , 1 )
; 0
(BYBLOCK)

(BYLAYER)

67

1 , 0

15. DXF- AutoCAD

551

15.3 ()

92

100

( : "AcDb" + )

102

(
{<>, <> ) ( }).

{ A C A D _ R E A C T O R S . {ACAD_XDICTIONARY

(
)
310

( ,
256 )

330

360

410

:
3DFACE

ELLIPSE

OLE2FRAME

TEXT

3DSOLID

HATCH

POINT

TOLERANCE

ACAD_PROXY_ENTITY

IMAGE

POLYLINE

TRACE

ARC

INSERT

RAY

VERTEX

ARCALIGNEDTEXT

LEADER

REGION

VIEWPORT

ATTDEF

LINE

RTEXT

WIPEOUT

ATTRIB

LWPOLYLINE

SEQEND

XLINE

BODY

MLINE

SHAPE

CIRCLE

MTEXT

SOLID

DIMENSION

OLEFRAME

SPLINE

. 15.415.10 DXF- : LINE, CIRCLE, LWPOLYLINE, POLYLINE, VERTEX, SEQEND,


INSERT. DXF- . 15.3.

552

Visual LISP AutoCAD


15.4. DXF-,
ENTITIES LINE

100

("AcDbLine")

39

( )

10

( ).

DXF: X ( Y Z
20 30);
:
20

DXF: Y

30

DXF: Z

11

( ).

DXF: X ( Y Z
20 30);
:
21

DXF: Y

31

DXF: Z

210

(
(0,0,0)).

DXF: 0

DXF: X ( Y
Z 220 230);

: (0, 0, 1)

:
220

DXF: Y

230

DXF: Z

15.5. DXF-,
ENTITIES CIRCLE

100

("AcDbCircle")

39

( )

10

( ).

DXF: X ( Y Z
20 30);
:

15. DXF- AutoCAD

553

15.5 ()

20

DXF: Y

30

DXF: Z

40

210

DXF: 0

( 0 0 ) )

: (0,0,1)

DXF: X ( Y
Z 220 230);
:
220

DXF: Y

230

DXF: Z

15.6. DXF-,
ENTITIES LWPOLYLINE

100

("AcDbPolyline")

90

70

, (1 ; 128
, )

43

.
(. DXF- 40 41)

38

39

( )

10

( ). ,
.

DXF: X ( Y 20);
:
20

DXF: Y

40

. , .
(. DXF- 43)

41

. , .
(. DXF- 43)

554

Visual LISP AutoCAD


15.6 ()

42

(buldge) , . , 1
. ,
.
,

210

(
( 0 0 ) )

DXF: X ( Y
Z 220 230);

DXF: 0
: (0,0,1)

:
220

DXF: Y

230

DXF: Z

. 15.7 POLYLINE.
: .
POLYLINE ( VERTEX
SEQEND, ). VERTEX SEQEND
. 15.8 5.9.
POLYLINE :
, .
15.7. DXF-,
ENTITIES POLYLINE

100

("AcDb2dPolyline" "AcDb3dPolyline")

10

DXF: 0

: ,
X Y 0, Z (
, )
20

DXF: 0

30

DXF: ,

39

( )

15. DXF- AutoCAD

555

15.7 ()

70

, (1 , ;
2 (Fit)
; 4 (Spline)
; 8 ; 16
; 32
N; 64
; 128 , )

40

41

71

72

73

74

75

. : 0 ; 5
-; 6 -; 8

210

(
(0,0,0)).

DXF: 0

DXF; X ( Y
Z 220 230);

; (0, 0, 1)

:
220

DXF: Y

230

DXF: Z


"AUTOCAD_
POSTSCRIPTFIGURE",
PostScript.
(

POLYLINE. 64 DXF- 70. DXF-


71 , DXF- 72 .
()
. (PFACE). -

556

Visual LISP AutoCAD


POLYLINE VERTEX, , .
15.8. DXF-,
ENTITIES VERTEX

100

("AcDbVertex", "AcDb2dVertex"
"AcDb3dPolylineVertex")

10

( ,
).

DXF: X ( Y Z
20 30);
:
20

DXF: Y

30

DXF: 2

40

41

42

(buldge) ,
. 0 ,
1 .
,

70

, (1
, (Fit) ; 2
(Fit); 8

(Spline) ; 16 ; 32 ; 64 ; 128
). 4

50

(Fit)

71

72

73

74

VERTEX , 64 128, DXF- 10, 20 30


.

15. DXF- AutoCAD

557

VERTEX ,
128 64. DXF- 10, 20 30
. DXF- 71
74 .
, . , , , .
, (PFACE),
, AutoCAD
.
15.9. DXF-,
ENTITIES SEQEND

-2

: ( POLYLINE
INSERT)

SEQEND , .
INSERT,, . 15.10,
(. . , (INSERT) ).
15.10. DXF-,
ENTITIES INSERT

100

("AcDbBlockReference")

66

,
INSERT (1 - , 0 - )

10

( ).

DXF: X ( Y Z
20 30);
:
20

DXF: Y

30

DXF: Z

41

42

558

visual LISP AutoCAD


15.10 ()

43

50

70

71

44

45

DXF: 0

210

(0

0))

'- DXF: X ( Y
Z 220 230);

: (0,0,1)

:
220

DXF: Y

230

DXF: 2

INSERT (. DXF 66), INSERT


ATTRIBUTE. SEQEND.

1 6


DIESEL
. 16.1 DIESEL (Direct Interpretively Evaluated String Expression Language),
. . 4.14.
16.1. DIESEL

..:tv*]...m
${-,1[,2[, ... [9]...]])
${*,1[,2[, ... [9]...]])
9U.4ll.42l, ... []...]])
${=1,2)
$(<,2,2)
$(>,1,2)
$(<=,1,2)
$=,1,2)
${>=1,2)

1-9

1, 2, ..., 9

1 2
, 1
2
, 1
2
1 2
, 1 2
, 1 2

1-9 .
1-9
1-9
2
2
2
2
2
2

560

Visual LISP AutoCAD


16.1 ()
-

$(and, 1[,2[,

19

$ (angtos,yt,


\ ,

(UNITS).

<>
<> AutoLISP
angtos (. . 2.7.8)

13

$(edtime,,)

(. )

$(eq,cl,c2)

1\
2 (1 , 0 )

$ (eval, )

$(fix, w)

$ (getenv, )

( , )

$ (getvar, )

$ ( i f , , [,])


"--"

23

$ (index, , )


(
)

$(linelen)

,
;
,

MODEMACRO
( 240)

16. DIESEL

561
16.1 ()
-

$ ( n t h , H , a O [ , a l [ , ... , [a?]...]]!

,
( 0 7)

29

$ ( o r , 1[,2[,

19

$(rtos,4t,*[,T]])



; ,
(UNITS)

13

$ (strlen, )


( )

$ (substr, , [,] )


,
; ,
,

23

$ (upper, )



(XOR)

19

...

edtime DATE
. , (. 16.2).
(, . .) .
16.2. , edtime

YY

( )

61

YYYY

( )

1961

( )

( )

01

562

Visual LISP AutoCAD

16.2 ()

MON

( )

MONTH

( )

( )

DD

( )

08

DDD

( !/
)

DDDD

( )

( )

( )

04

( )

37.

SS

( )

24

MSEC

( )

827

am/pm

, ,
DIESEL.
:

$ (edtime,$ (getvar,date) , DDD", " DD MON YYYY) ,


28 2001

, AutoLISP,
,
:
(setvar "MODEMACRO" "$(edtime,$(getvar,date),DDD\",\" DD MON YYYY)")

ARX- 204

D
DCL- 320
DVB- 211
DXF- 90, 112, 156, 172, 544

F
FAS- 244, 256, 259, 261

ObjectARX 51

V
Visual Basic 51
VLA- 382
VLR- 406
VLX- 198, 256, 262

w
wild-card-characters 105

HELP- Windows 367

MNL- 316

X
- 184, 185

564

267
259
56
189, 215
78, 116
:
action 337, 348
alignment 326, 327, 337, 343
big_increment 341
children_alignment 326, 343
childrenJlxedjieight 327, 343
childrcn_fixed_width 327, 343
color 338
editjimit 337
edit_width 337
fixedjieight 343
fixed_width 337, 338, 343
fixed_width_font 339
height 326, 339
initial_focus 326
key 326
label 325, 341, 343, 346
layout 341
max_value 341
min_value 341
multiple_select 339
smalMncrement 341
value 326, 340, 342, 350
width 326

55
387
48
26, 29
Windows 46

384
99
154
55
:
20
0 155
439


:
0 221
0 , 221
50
:
0 AutoLISP54
.0 DIESEL 314
546

216
284
44, 45, 48
160
308
271

265
0 LISP-
(LISP Files to Include) 264
0 (Select Font) 247
0 (Inspect) 238
0 (Symbol Service)
239
0 Visual LISP (Visual LISP
Console) 257
0 (Watch) 240
0 (Startup) 20
0 (New Project) 259
0 (General Options) 248
0 (Format
options) 248
0 (Window Attributes)
247
0 (Toolbars) Visual
LISP 243
0 (Application
Directory) 263
0 (Application
Options) 263
0
(Apropos) 241
0 (Page Setup) 249
0 /
(Review Selections/Build
Application) 266
(Wizard Mode) 262

565


(Object Properties) 259
(Breakpoints) 242
(Resource Files to
Include) 264
(Color Style) 246
363
229
320
0 324
0 331

:
0 - LISP- 61
0 169, 267
0 191
105

217
0 60, 212, 219
215
0 207, 209
0 209, 217
<Enter> 63
:
162
0 98, 153
0 156
0 170
156
include 324
AutoLISP 53

dialog 324
26
160
:
0 (3D) 209
0 EXIT 29
0 EXPRESSTOOLS 209, 274
0 SH28
0 START 27
0 VBASTMT218
0 VLIDE233
0 VLISP233

(ATTDEF) 228
() 228
(BLOCK) 228
(BROWSER) 35
(COPYBASE) 46
(CUTCLIP) 46
(VIEW) 228
(RSCRIPT) 50
(INSERT) 30, 33, 44, 229,
547, 557
0 (PASTEBLOCK) 46
0 (PASTECLIP) 46
0 (PASTEORIG) 46
0 (GRAPHSCR) 221
0 (GROUP) 160
0 1 28
0 (MSLIDE) 48
0 (ARC) 287
0 (DELAY) 50
0 (IMAGE) 229
(IMAGEATTACH) 48
0 (IMAGEADJUST) 229
0 (DXBIN) 30
(PSIN) 451
0 (COPYCLIP) 46
0 () 229
0 (MENU) 35, 270, 273
0 (MENUUNLOAD) 273
0 (MENULOAD) 272
0 () 229
0 (OPTIONS) 20, 31
0 (RENAME) 229
0 (REDRAW) 220, 224
0 (OPEN) 218
0 (UNDO) 515
0 (UNDO) 427, 518
0 (LINE) 62
0 (SCRIPT) 50, 527, 533
(TOOLBAR) 229, 277
0 (WBLOCK) 428
0 (PFACE) 555, 557
0 (REIN1T) 31, 373
0 (PLOT) 229
0 (TABLET) 302
0 (AREA) 515, 519
0 (DIVIDE) 510, 512
0 (ZOOM) 63
0 (HELP) 52
0 (AUDIT) 547
0 (PSF1LL) 451
. . 566

0
0
0
0
0
0
0
0
0

566
():
(DIM) 286
(STRETCH) 176
(EXPLODE) 515
(REGEN) 221, 224
(LAYOUT) 526
(VSLIDE) 49
(LAYER) 229, 515, 518
(SAVEAS) 24, 544,
548
(LIST) 157
(HELP) 286
(XREF) 547
(ERASE) 515
(STYLE) 229
(TEXTSCR) 221
(LINETYPE) 229
(SETVAR) 52
(MVSETUP) 209, 527
(COLOR) 63, 229
(ADCENTER) 47
(ADCCLOSE) 47
(PSOUT) 36, 451
26
25
42, 44
56, 324
195
:
0 58
0 58
:
0 90
0 156

LSP- 256

284
156, 546
269
0 (View) Visual LISP 237
0 (Window) Visual LISP 250
0 (Debug) Visual LISP 245
0 (Search) Visual LISP 236
0 (Edit) Visual LISP 235
0 (Project) Visual LISP 244, 259
0 (Tools) Visual LISP 246, 250
0 (File) Visual LISP 234
0 283


291
0 309
0 273
0 272
545
555
45
0 218
0 219

160
0 160
156


VL-CATCH-ALL-APPLY-ERROR 126
:
0 < > (<Builder Ouput>)
242
0 AutoCAD Shell Active 28
0 Visual LISP (Visual LISP
Console) 243
0 243
0 (Error Trace) 239
0
(Apropos results) 241
0 (Trace Stack) 239
:
0 165
164
0 165

Visual LISP 234


0 (View) Visual LISP 254
0 (Debug) 253
0 (Search) 252
0 (Tools) 252
0 (Standard) 251
0 279
287
acad.pgp 31
:
0 /43
0 / 42


/nologo 44
/44
/ 43
/s43
43
/v44
42
56
355
189, 215
PATH 373
TEMP 149
149
189,215
ACAD 25, 43
229
:
boxed_radio_vow 341
button 336
column 342
- concatenation 345
edit_box 337
entile 338
image 338
image_button 338
listjrax 338, 357
ok_button 345
ok_cancel 346
ok_cancel_err 346
ok_cancel_help 346
ok_cancel_help_entile 346
ok_cance1_help_jnfo 346
ok_oniy 345
paragraph 345
popupbox 357
popupjist 339
radio_button 340
radio_column 340, 341
radiorow 340
row 342, 343
slider 341
spacer 346
spacerj) 346
spacer_l 346
text 344
text_part 345
toggle 341
555
268
439

567
:
LWPOLYL1NE 154
POLYLINE 154
SEQEND 154
VERTEX 154
160
160
Visual LISP 236
259
Visual LISP 244
43
38
39
39
25, 30
128
33, 34

25
41, 42
45
175, 185
177
166

202
:
0 AutoLISP 56, 57
0 nil 59, 60
0 pause 59
0 pi 59
0 59
0 59
0 59
:
0 99
0 99
0 99
0 99
0 99
:
0 ACADLSPASDOC 232
0 ANGBASE97, 133
0 ANGDIR 133
0 APERTURE 220
. . 568

568
():
AREA 519
AUNITS 96, 97
AUPREC97
CDATE537
CECOLOR 135
CLAYER 135
CURSORSIZE 135
CVPORTS 173
DCTMAIN36
DIMZIN 95
ELEVATION 100
EXTNAMES 174
F1LEDIA273
FONTALT36
FONTMAP36
INETLOCATION 35
LIMCHECK 128
LOGFILEPATH 37
LUNITS 95, 98
LUPREC95
MENUCTL298
MENUECHO 286
MODEMACRO 222, 314
MTEXTED36
PDMODE 135, 512
PDSIZE512
POPUPS 128
PROJECTNAME 35
PSPROLOG 36
RE-INIT31
SCREENBOXES 223, 295
SDI 218
TABMODE 229
TEMPPREFIX 37
TILEMODE90
UNITMODE 95, 97
XCLIPFRAME 316
XLOADPATH38
48
179
181
217
:
21
AutoCAD 192
20
48
188
54
366


:
275
312
:
284
DXF 549
52

546
189
ActiveX 45
:
546
152, 156, 545
141, 142
112, 116
117
199
270

172
slidelib.exe 51

:
0 acad.dcl 450
0 acad.lin41,450
0 acad.lsp 41, 230, 450
0 aead.mln 451
0 acad.mnl 451
0 acad.mns 451
0 acad.mnu 451
0 acad.pat 451
0 acad.pgp 25, 41, 52, 451
acad.psf451
0 acad.rx 451
0 acad.unt 451
0 acad2000.1sp 230, 450
0 acad2000doc.lsp 231, 451
0 acaddoc.lsp 41, 231,450
0 acadiso.lin 450
0 acadiso.pat 451
0 base.dcl 450
fontmap.ps 451
0 Itypeshp.shp 451


269
269
43
269
269
WinHelp 366
278
DXF 544
:
AutoLISP488
64
188
88
81
93
208
:
0-65
0 *65
0 ** 196
0/66
0 /=68
0 ~ 67
0+64
0 <69
0 <=69
0 =68
0 > 70
0 >=70
0 1-67
0 1+ 66
0 abs67
0 acadcolordlg 138
0 acad_helpdlg 375
0 acad_strlsort 121
0 actionjile 329, 337, 348, 522
0 add_list357
0 add_list522
0 alert 143, 349, 510, 535
alloc201,202
and 71, 508
angle 83
angtof 96, 97
angtos 96, 97
append 113, 520, 538
apply 118, 126, 188
204
arxload 205
arxunload 205
ascii 101, 143, 513
assoc 118, 156, 510, 527, 538

569

atan 85
atof96
atoi 59, 96
atoms-family 187, 199
autoarxload 206
autoload 206
Boole 88
boundp 78
115
caddr527
cadrll5
114, 168,527
cdr 114, 156, 527
chr 101, 513
client_data_tile 349
close 140, 152, 527, 535
command 59, 61, 64, 231, 348, 510,
515, 527
cond 74, 538
cons 116, 520
cos 85
cvunit 100
defun 60, 188, 376
defun-q 192
defun-q-list-ref 194
dictadd 183
dictnext 181
dictremove 184
dictrename 184
dictsearch 180
dimxjile 361
dimy_tile 361
distance 84
' distof 98
donejiialog 329, 330, 522
end_image 338, 359
endjist 339, 340, 358, 522
ending 111
entdel 155, 510
entget 155, 161, 168, 172, 175, 510, 520,
521, 527, 538
entlast 98, 153, 510
entmake 99, 157, 177
entmakex 157
entmod 158, 177, 520, 521
entnext98, 153,510,538
entsel 98, 130, 154, 168, 510, 527, 538
entupd 158
eq 68, 79
equal 68, 79
. . 570

570
():
eval 120
0 exit 196, J97, 522
0 85
expand 201
expt 86
ffll_image 359
findfile 139, 148
fix 59, 81
float 59, 94
foreach 120
function 119, 122126, 195
gc 201, 202, 217
gcd83
get_attr 355
getjile 354
getangle 132
getcfg 136
<> getcname 136
getcorner 134
getdist 132
getenv 135
getfiled 137, 152, 535
gctint 58, 131
getkword 130, 522, 527
getorient 133
getpoint 133
getreal 132
getstring 130, 134
getvar 134,515, 522, 527, 535
graphscr221
grclear 225
grdraw 224
grread 225
grtext221
grvecs 224
handent 158
help 371
if 73, 508
initdia 228
initget 128, 522, 527
inters 89
itoa 94
lambda 119, 122126, 188
last 121
layoutlist 185, 522
length 121
list 112, 538
listp 77
load 54, 60, 196, 257, 267
load_dialog 321, 328, 522


log 86
logand 86, 88
logior 87, 88
Ish 87
mapcar 119, 188, 522
max 82
mem 201
member 117
menucmd 280
menugroup 279
min 83
minusp 76
modejile 349, 522
namedobjdict 180
nentsel 98, 130, 158
nentselp 130, 159, 224
new_dialog 329, 348, 522
not 72
nth , 168
null 72
numberp 76
open 140, 151, 152, 527, 535
or 71, 508
osnap219
polar 89
prinl 142, 150
princ 141, 150, 152, 538
print 142
progn 73
prompt 143
quit 196
quote 120
read 102
read-char 142, 152
read-line 141
redraw 220, 224
regapp 177
82, 508
repeat 80
reverse 114
rtos 59, 95, 98, 527, 535
s::startup 232
set 213
setjile 326, 344, 350
set_tile 338
setcfg 136
setenv 136
setfunhelp 375
setq 56, 59
setvar 135
setview 172

sin 84
slide_image 360
snvalid 174
sqrt 84
ssadd 162
ssdel 163
ssget 160, 168, 515, 518
ssgetfirst 167
sslength 163, 168, 515
ssmemb 163
ssname 98, 164, 168, 515
ssnamex 161, 164
sssetfirst 166
stait_dialog 329, 330, 348, 522
start_image 338, 358
startjist 339, 340, 357, 522
startapp 373, 374
strcase 103, 513
strcaser 111
strcat 103, 513, 527, 535
strlen 104, 513, 535
subst 121
substr 104, 513, 535
tablet 229
tblnext 170, 171
tblobjname 171
tblsearch 170
term_dialog .330
terpri 144
textpage 221
textscr221
trace 199, 200
trans 98, 510, 538
type 57, 93
unload_dialog 328, 522
untrace 199
vector_image 360
ver201
vla-add3DPoly 382
vla-addcircle 384
vla-arraypolar 382
vla-arrayrectangular 382
vl-acad-defun 197
vl-acad-undefun 198
vla-copy 382
vla-get-activedocument 380
vla-get-area 380
vla-get-color 380, 383
vla-get-endpoint 384
vla-get-layer 383
vla-get-linetype 383

571
vla-get-modelspace 381
vla-get-paperspace 381
vla-get-radius 380
vla-get-startpoint 384
vla-mirror 382
vla-put-color 380, 384
vl-arx-import 207
vlax-3d-porat 386
vlax-add-cmd 391
vlax-create-object 395
vlax-curve-getarea 402
vlax-curve-getclosestpointto 405
vlax-curve-getclosestpointtoprojection 405
vlax-curve-getdistatparam 404
vlax-curve-getdistatpoint 403
vlax-cui-ve-getendparam 403
vlax-curve-getendpoint 402
vlax-curve-getfirstderiv 406
vlax-cui-ve-getparamatdist 404
vlax-curve-getparamatpoint 403
vlax-curve-getpointatdist 402
vlax-curve-getpointatparam 404
vlax-curve-getsecondderiv 406
vlax-curve-getstartparam 403
vlax-curve-getstartpoint 402
vlax-curve-isclosed 404
vlax-curve-isperiodic 404
vlax-curve-isplanar 405
vlax-dump-object 389
vlax-ename->vla-object 383
vlax-erased-p 393
vlax-for 397'
vlax-get-acad-object 380
vlax-get-object 395
vlax-get-or-create-object 395
vlax-get-property 401
vlax-import-type-library 396
vlax-invoke 393
vlax-invoke-method 393
vlax-ldata-delete 398
vlax-ldata-get 397
vlax-ldata-list 398
vlax-ldata-put 397
vlax-ldata-test 398
vlax-make-safearray 387
vlax-make-variant 384
vlax-map-collection 396
vlax-method-applicable-p 394
vlax-product-key 393
vlax-property-available-p 401
. . 572

572
():
vlax-put-property 401
0 vlax-read-enabled-p 395
0 vlax-release-object 394
0 vlax-remove-cmd 392
0 vlax-safearray->list 400
0 vlax-safearray-fill 389
vlax-safearray-get-dim 399
vlax-safearray-get-element 399
vlax-safearray-get-1-bound 399
vlax-safearray-get-u-bound 399
vlax-safearray-put-element 388
vlax-safearray-type 400
vlax-tmatrix 400
vlax-typeinfo-available-p 394
0. vlax-variant-change-type 386
vlax-variant-type 385
vlax-variant-value 386
vlax-vla-object->ename 383
vlax-write-enabled-p 395
vl-bb-ref 212
vl-bb-set 211
vl-catch-all-apply 126, 197
vl-catch-all-apply-error-message 126
vl-catch-all-error-message 127, 197
vl-catch-all-error-p 197
vl-cmdf 64, 231
vl-directory-files 144
vl-doc-export 207, 218
vl-doc-imporf 207, 218
vl-doc-ref213, 218
vl-doc-set213, 218
vl-every 119
vl-exit-with-error 197, 198
vl-exit-with-value 197, 198
vl-file-copy 145
vl-file-delete 146, 152, 535
vl-file-directoiy-p 146
vl-filename-base 148, 152, 535
vl-filename-directory 148, 152, 535
vl-filename-extension 148, 152, 535
vl-filename-mktemp 149
vl-file-rename 146
vl-file-size 147
vl-file-systime 147
vl-get-resource 210
vlisp-compile 195
vl-list* 116
vl-list->string 106
vl-list-exported-functions 192, 208
vl-list-length 122

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

vl-list-loaded-vlx 209
vl-Ioad-all 61, 214, 219
vl-load-com 379
vl-load-reactors 407
vl-member-if 122
vl-member-if-not 123
vl-position 123
vl-prinl-to-string 150
vl-princ-to-striiig 150
vl-propagate 214, 219
vlr-acdb-reactor 411
vlr-add437
vlr-added-p 437
vlr-beep-reaction 410
vlr-command-reactor 418
vlr-current-reaction-name 437
vlr-data 438
vlr-data-set 438
vlr-deepclone-reactor 419
vlr-docmanager-reactor 412
vlr-dwg-reactor 420
vlr-dxf- reactor 421
vlr-editor-reactor 416
vl-registry-delete 203
vl-registry-descendents 204
vl-registry-read 202
vl-registry-write 203
vl-remove 123
vl-remove-if 124
vl-remove-if-not 124
vlr-insert-reactor 422
vlr-linker-reactor 414
vlr-Hsp-reactor 423
vlr-miscellaneous-reactor 424
vlr-mouse-reactor 425
vlr-notification 439
vlr-object-reactor 414
vlr-owner-add 438
vlr-owner-remove 438
vlr-owners 438
vlr-pers 440
vlr-pers-Iist 440
vlr-pers-p 440
vlr-pers-release 440
vlr-reaction-names 409
vlr-reaction-set 436
vlr-reactors 408
vlr-remove 437
vlr-remove-all 437
vlr-set-notification 439

0
0
0
0
0
0

vlr-sysvar-reactor 425
vlr-toolbar-reactor 426
vlr-trace - reaction 410
vlr-type 409
vlr-types 408
vlr-undo-reactor 427
vlr-wblock-reactov 428
vlr-window- reactor 430
vlr-xref-reactor 431
vl-some 125
vl-sort 125
vl-sort-i 126
vl-string->list 106
vl-string-elt 107
vl-string-left-trim 107
vl-string-mismatch 108
vl-string-position 108
vl-string-right-trim 107
vl-string-search 109
vl-string-subst 109
vl-string-translate 110
vl-string-trim 108
vl-symbol-name 110
vl-symbol-value 92
vl-unload-vlx210
vl-vbarun 211
vl-vlx-loaded-p 209

573
0
0
0
0
0
0
0
0

vports 90
wcmatch 105, 241
while 79, 515, 527
write-char 143 , 152
write-line 141, 151, 152, 527, 535
xdroom 179
xdsize 178
zerop 76

:
0 58
0 58
0 58

Visual LISP 257

43

:
0 DCL320
DIESEL 314

__ d i r e c t

gm

SoftLine

-

-
,
117036 .
. , . 4
(095) 232-0023
www.softline.ru
E-mail: info@softline.ru


/70,

!
, ,
! ,

: , 199397, -, / 194; Web-: www.bhv.ru

!
"-"
.
, ,
, ,
,


"-"
,
,
.



.: (812) 251 4244, 251 6501
e-mail: kat@bhv.ru
: (812) 2511295

1000
,

!
" - "
:
==> : (812) 541-85-51 ( " ")
= : (812) 541-84-61 ( " - ")
=> : 199397, -, / 194
= Internet: http://www.bhv.ru
=> E-mail: trade@bhv.spb.su
Internet , ,
-
( ),

, , .

, "-"

Вам также может понравиться