SlideShare une entreprise Scribd logo
1  sur  414
Télécharger pour lire hors ligne
®




    February 24, 1999
© 1999 Autodesk, Inc.

AUTODESK, INC.
!#$% '() *+,
 -

./0(123456*789:8;=? AUTODESK, INC. @AB-CDEFGHI
JK AUTODESK, INC. LM#$ABNO PQR
STU%-

Autodesk, Inc.,    VWXYZ[                -
$] ^Z[_`                         abcZ[defg-

                                                         Autodesk hi
Pjkl Autodesk, Inc. mno( p qorsthiu3D Plan83D Props83D Studio83D Studio MAX83D Studio VIZ8
3DSurfer8ADE8ADI8Advanced Modeling Extension8AEC Authorityvwix              8AEC-X8AME8Animator Pro8Animator Studio8
ATC8AUGI8AutoCAD8AutoCAD Data Extension8AutoCAD Development System8AutoCAD LT8AutoCAD Map8Autodesk8
Autodeskvwix Autodesk Animator8
                8                   Autodesk MapGuide8   Autodesk University8Autodesk View8 Autodesk WalkThrough8 Autodesk
World8AutoLISP8AutoShade8AutoSketch8AutoSolid8AutoSurf8AutoVision8Biped8bringing information down to earth8CAD
Overlay8 Character Studio8Design Companion8 Drafix8 Education by Design8Generic8 Generic 3D Drafting8Generic CADD8  Generic
Software8 Geodyssey8  Heidi8HOOPS8   Hyperwire8 Inside Track8 Kinetix8MaterialSpec8 Mechanical Desktop8Multimedia Explorer8
NAAUG8Office Series8Opus8PeopleTracker8Physique8Planix8Rastation8Softdesk8Softdeskvwix                8Solution 30008Tech
Talk8Texture Universe8The AEC Authority8The Auto Architect8TinkerTech8WHIP!8WHIP!vwix             8Woodbourne8WorkCenter
( World-Creating Toolkit-

Pjkl Autodesk, Inc. mno( p qorhiu3D on the PC8ACAD8ActiveShapes8Actrix8Advanced User Interface8
AEC Office8 AME Link8   Animation Partner8Animation Player8 Animation Pro Player8 Studio in Every Computer8
                                                                                 A                          ATLAST8   Auto-
Architect8AutoCAD Architectural Desktop8AutoCAD Architectural Desktop Learning Assistance8AutoCAD Learning Assistance8
AutoCAD LT Learning Assistance8AutoCAD Simulator8AutoCAD SQL Extension8AutoCAD SQL Interface8AutoCDM8Autodesk
Animator Clips8Autodesk Animator Theatre8Autodesk Device Interface8Autodesk PhotoEDIT8Autodesk Software Developer’s Kit8
Autodesk View DwgX8AutoEDM8AutoFlix8AutoLathe8AutoSnap8Built with ObjectARXvwix                8ClearScale8Concept Studio8
Content Explorer8cornerStone Toolkit8Dancing Babyvyzx Design Your World8
                                                         8                    Design Your Worldvwix    DXF8  DWG Linking8
DWG Unplugged8DXF8Exegis8FLI8FLIC8GDX Driver8Generic 3D8Home Series8Kinetixvwix                  8MAX DWG8ObjectARX8
ObjectDBX8  Ooga-Chaka8  Photo Landscape8 Photoscape8Plugs and Sockets8PolarSnap8 Powered with Autodesk Technology8 Powered
with Autodesk Technology wix ProConnect8 Landscape8
                        v      8            Pro            QuickCAD8   RadioRay8 SchoolBox8 SketchTools8 Suddenly Everything
Clicks8Supportdesk8The Dancing Baby8Transforms Ideas Into Reality8Visual LISP ( VOLO!-

                                                        {|}Z[hi
Microsoft8Visual Basic ( Windows ~Microsoft Corporation sthi€ ActiveX8Windows NT8Windows 95 ( Windows 98
~Microsoft Corporation hi-Delphi ~ Borland International hi-    qhi‚8Z[‚hi@ƒ „…†
 ‡-
                                                      GOVERNMENT USE
Use, duplication, or disclosure by the U. S. Government is subject to restrictions as set forth in FAR 12.212 (Commercial Computer
Software-Restricted Rights) and DFAR 267.7202 (Rights in Technical Data and Computer Software), as applicable.
AutoLISP          . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
           + ................................................................................. 17
           – ................................................................................. 17
           * ................................................................................. 18
           / .................................................................................. 18
           = ................................................................................. 19
           /= ................................................................................ 19
            ................................................................................. 20
           = ................................................................................ 21
            ................................................................................. 21
           = ............................................................................... 22
           ~ ................................................................................. 22
           1+ ................................................................................ 23
           1– ................................................................................ 23
           abs ............................................................................... 23
           acad_colordlg.............................................................. 24
           acad_helpdlg ............................................................... 24
           acad_strlsort ................................................................ 25
           action_tile.................................................................... 25
           add_list........................................................................ 26
           alert ............................................................................. 27
           alloc............................................................................. 28
           and............................................................................... 28
           angle............................................................................ 29
           angtof .......................................................................... 29
           angtos .......................................................................... 30


                                                                                                     |   iii
append ......................................................................... 32
         apply............................................................................ 32
         arx ............................................................................... 33
         arxload ........................................................................ 33
         arxunload .................................................................... 34
         ascii ............................................................................. 34
         assoc............................................................................ 35
         atan.............................................................................. 35
         atof .............................................................................. 36
         atoi .............................................................................. 37
         atom ............................................................................ 37
         atoms-family ............................................................... 38
         autoarxload.................................................................. 39
         autoload....................................................................... 40
         Boole ........................................................................... 40
         boundp ........................................................................ 42
         caddr............................................................................ 43
         cadr.............................................................................. 43
         car................................................................................ 44
         cdr ............................................................................... 44
         chr ............................................................................... 45
         client_data_tile............................................................ 46
         close ............................................................................ 46
         command..................................................................... 47
         cond............................................................................. 48
         cons ............................................................................. 49
         cos ............................................................................... 50
         cvunit .......................................................................... 50
         defun ........................................................................... 51
         defun-q ........................................................................ 52
         defun-q-list-ref ............................................................ 53
         defun-q-list-set ............................................................ 54
         dictadd ........................................................................ 55
         dictnext ....................................................................... 56
         dictremove ................................................................. 58
         dictrename .................................................................. 58
         dictsearch ................................................................... 59

iv   |
dimx_tile ..................................................................... 60
dimy_tile ..................................................................... 61
distance ....................................................................... 61
distof ........................................................................... 62
done_dialog................................................................. 63
end_image ................................................................... 63
end_list........................................................................ 64
entdel........................................................................... 64
entget........................................................................... 65
entlast .......................................................................... 66
entmake ....................................................................... 67
entmakex .................................................................... 68
entmod ........................................................................ 68
entnext......................................................................... 71
entsel ........................................................................... 71
entupd.......................................................................... 72
eq................................................................................. 73
equal............................................................................ 74
*error*......................................................................... 76
eval.............................................................................. 76
exit .............................................................................. 77
exp............................................................................... 77
expand ......................................................................... 78
expt.............................................................................. 79
fill_image .................................................................... 79
findfile......................................................................... 80
fix ................................................................................ 81
float ............................................................................. 82
foreach ........................................................................ 82
function ....................................................................... 83
gc................................................................................. 84
gcd............................................................................... 84
get_attr ........................................................................ 85
get_tile ........................................................................ 85
getangle ....................................................................... 85
getcfg .......................................................................... 86
getcname .................................................................... 87

                                                                                  |   v
getcorner ..................................................................... 88
         getdist.......................................................................... 88
         getenv.......................................................................... 89
         getfiled ........................................................................ 90
         getint ........................................................................... 92
         getkword ..................................................................... 93
         getorient ...................................................................... 94
         getpoint ....................................................................... 95
         getreal.......................................................................... 96
         getstring ...................................................................... 97
         getvar .......................................................................... 98
         graphscr....................................................................... 98
         grclear ......................................................................... 98
         grdraw ......................................................................... 99
         grread .......................................................................... 99
         grtext ......................................................................... 102
         grvecs ........................................................................ 103
         handent...................................................................... 105
         help ........................................................................... 105
         if ................................................................................ 107
         initdia ........................................................................ 107
         initget ........................................................................ 108
         inters.......................................................................... 111
         itoa ............................................................................ 113
         lambda....................................................................... 113
         last ............................................................................. 114
         layoutlist.................................................................... 114
         length ........................................................................ 115
         list.............................................................................. 115
         listp............................................................................ 116
         load............................................................................ 117
         load_dialog................................................................ 118
         log ............................................................................. 119
         logand........................................................................ 119
         logior ......................................................................... 120
         lsh.............................................................................. 120
         mapcar....................................................................... 121

vi   |
max............................................................................ 122
mem .......................................................................... 122
member ..................................................................... 124
menucmd................................................................... 124
menugroup ................................................................ 126
min ............................................................................ 126
minusp....................................................................... 127
mode_tile .................................................................. 127
namedobjdict............................................................. 128
nentsel ....................................................................... 128
nentselp ..................................................................... 130
new_dialog................................................................ 132
not ............................................................................. 132
nth ............................................................................. 133
null ............................................................................ 134
numberp .................................................................... 134
open........................................................................... 135
or ............................................................................... 136
osnap ......................................................................... 137
polar .......................................................................... 138
prin1 .......................................................................... 138
princ .......................................................................... 140
print ........................................................................... 140
progn ......................................................................... 141
prompt ....................................................................... 141
quit ............................................................................ 142
quote.......................................................................... 142
read............................................................................ 143
read-char ................................................................... 144
read-line .................................................................... 145
redraw ....................................................................... 145
regapp........................................................................ 146
rem ............................................................................ 147
repeat......................................................................... 148
reverse ....................................................................... 149
rtos ............................................................................ 149
set .............................................................................. 151

                                                                               |   vii
set_tile ....................................................................... 152
           setcfg ......................................................................... 152
           setenv ........................................................................ 153
           setfunhelp.................................................................. 153
           setq ............................................................................ 155
           setvar ......................................................................... 156
           setview ..................................................................... 157
           sin.............................................................................. 157
           slide_image ............................................................... 158
           snvalid ....................................................................... 159
           sqrt ............................................................................ 161
           ssadd.......................................................................... 161
           ssdel .......................................................................... 163
           ssget .......................................................................... 163
           ssgetfirst ................................................................... 167
           sslength ..................................................................... 167
           ssmemb ..................................................................... 168
           ssname....................................................................... 168
           ssnamex .................................................................... 169
           sssetfirst ................................................................... 172
           startapp...................................................................... 174
           start_dialog................................................................ 175
           start_image................................................................ 175
           start_list..................................................................... 176
           strcase........................................................................ 176
           strcat.......................................................................... 177
           strlen.......................................................................... 178
           subst .......................................................................... 178
           substr ......................................................................... 179
           tablet.......................................................................... 180
           tblnext ....................................................................... 181
           tblobjname ................................................................ 183
           tblsearch .................................................................... 184
           term_dialog ............................................................... 184
           terpri.......................................................................... 185
           textbox ...................................................................... 185
           textpage ..................................................................... 186

viii   |
textscr........................................................................ 186
trace........................................................................... 186
trans........................................................................... 188
type............................................................................ 190
unload_dialog............................................................ 192
untrace....................................................................... 192
vector_image............................................................. 193
ver ............................................................................. 194
vl-acad-defun ............................................................ 195
vl-acad-undefun ........................................................ 195
vl-arx-import ............................................................. 195
vl-bb-ref .................................................................... 197
vl-bb-set .................................................................... 197
vl-catch-all-apply ...................................................... 198
vl-catch-all-error-message ........................................ 199
vl-catch-all-error-p.................................................... 200
vl-cmdf...................................................................... 200
vl-consp..................................................................... 202
vl-directory-files ....................................................... 203
vl-doc-export............................................................. 203
vl-doc-import ............................................................ 204
vl-doc-ref .................................................................. 205
vl-doc-set .................................................................. 205
vl-every .................................................................... 206
vl-exit-with-error ...................................................... 207
vl-exit-with-value...................................................... 208
vl-file-copy ............................................................... 209
vl-file-delete.............................................................. 210
vl-file-directory-p...................................................... 210
vl-file-rename ........................................................... 211
vl-file-size ................................................................. 212
vl-file-systime ........................................................... 212
vl-filename-base ....................................................... 213
vl-filename-directory ............................................... 214
vl-filename-extension ............................................... 214
vl-filename-mktemp.................................................. 215
vl-get-resource .......................................................... 216

                                                                               |   ix
vl-list* ....................................................................... 217
        vl-list-string ........................................................... 217
        vl-list-exported-functions.......................................... 218
        vl-list-length.............................................................. 219
        vl-list-loaded-vlx....................................................... 219
        vl-load-all.................................................................. 220
        vl-load-com ............................................................... 221
        vl-load-reactors ......................................................... 221
        vl-member-if ............................................................. 222
        vl-member-if-not....................................................... 223
        vl-position ................................................................. 223
        vl-prin1-to-string ...................................................... 224
        vl-princ-to-string ...................................................... 225
        vl-propagate .............................................................. 225
        vl-registry-delete ....................................................... 226
        vl-registry-descendents ............................................. 226
        vl-registry-read.......................................................... 227
        vl-registry-write ........................................................ 228
        vl-remove ................................................................. 228
        vl-remove-if ............................................................. 229
        vl-remove-if-not........................................................ 230
        vl-some ..................................................................... 230
        vl-sort ........................................................................ 231
        vl-sort-i...................................................................... 232
        vl-string-list ........................................................... 233
        vl-string-elt................................................................ 234
        vl-string-left-trim ...................................................... 234
        vl-string-mismatch .................................................... 235
        vl-string-position....................................................... 236
        vl-string-right-trim .................................................... 237
        vl-string-search ......................................................... 237
        vl-string-subst ........................................................... 238
        vl-string-translate ...................................................... 239
        vl-string-trim ............................................................. 239
        vl-symbol-name ....................................................... 240
        vl-symbol-value ....................................................... 241
        vl-symbolp ................................................................ 241

x   |
vl-unload-vlx............................................................. 242
vl-vbaload ................................................................. 243
vl-vbarun ................................................................... 243
vl-vlx-loaded-p.......................................................... 244
vlax-3D-point............................................................ 244
vlax-add-cmd ............................................................ 245
vlax-create-object...................................................... 247
vlax-curve-getArea ................................................... 247
vlax-curve-getDistAtParam ...................................... 248
vlax-curve-getDistAtPoint ........................................ 249
vlax-curve-getEndParam .......................................... 250
vlax-curve-getEndPoint ............................................ 251
vlax-curve-getParamAtDist ...................................... 251
vlax-curve-getParamAtPoint .................................... 252
vlax-curve-getPointAtDist ........................................ 252
vlax-curve-getPointAtParam .................................... 253
vlax-curve-getStartParam ......................................... 254
vlax-curve-getStartPoint ........................................... 254
vlax-curve-isClosed .................................................. 255
vlax-curve-isPeriodic ............................................... 255
vlax-curve-isPlanar ................................................... 256
vlax-curve-getClosestPointTo .................................. 257
vlax-curve-getClosestPointToProjection .................. 258
vlax-curve-getFirstDeriv........................................... 258
vlax-curve-getSecondDeriv ...................................... 259
vlax-dump-object ...................................................... 260
vlax-ename-vla-object ........................................... 261
vlax-erased-p............................................................. 261
vlax-for...................................................................... 262
vlax-get-acad-object.................................................. 262
vlax-get-object .......................................................... 263
vlax-get-or-create-object........................................... 263
vlax-get-property ...................................................... 264
vlax-import-type-library ........................................... 265
vlax-invoke-method .................................................. 267
vlax-ldata-delete........................................................ 268
vlax-ldata-get ............................................................ 268

                                                                             |   xi
vlax-ldata-list ............................................................ 271
          vlax-ldata-put ............................................................ 271
          vlax-ldata-test............................................................ 272
          vlax-make-safearray.................................................. 273
          vlax-make-variant ..................................................... 275
          vlax-map-collection .................................................. 277
          vlax-method-applicable-p ......................................... 278
          vlax-object-released-p............................................... 279
          vlax-product-key ....................................................... 280
          vlax-property-available-p.......................................... 280
          vlax-put-property ...................................................... 281
          vlax-read-enabled-p .................................................. 282
          vlax-release-object .................................................... 282
          vlax-remove-cmd ..................................................... 282
          vlax-safearray-fill...................................................... 283
          vlax-safearray-get-dim.............................................. 285
          vlax-safearray-get-element ....................................... 285
          vlax-safearray-get-l-bound........................................ 286
          vlax-safearray-get-u-bound....................................... 287
          vlax-safearray-put-element ....................................... 288
          vlax-safearray-type ................................................... 289
          vlax-safearray-list ................................................... 290
          vlax-tmatrix............................................................... 291
          vlax-typeinfo-available-p.......................................... 292
          vlax-variant-change-type .......................................... 293
          vlax-variant-type ....................................................... 294
          vlax-variant-value ..................................................... 296
          vlax-vla-object-ename ............................................ 297
          vlax-write-enabled-p ................................................. 297
          vlisp-compile ............................................................ 297
          vlr-acdb-reactor......................................................... 299
          vlr-add ...................................................................... 300
          vlr-added-p................................................................ 300
          vlr-beep-reaction ....................................................... 301
          vlr-command-reactor ............................................... 301
          vlr-current-reaction-name ......................................... 302
          vlr-data ...................................................................... 302

xii   |
vlr-data-set ................................................................ 303
vlr-deepclone-reactor ............................................... 304
vlr-docmanager-reactor ............................................ 305
vlr-dwg-reactor ........................................................ 307
vlr-dxf-reactor .......................................................... 309
vlr-editor-reactor ...................................................... 310
vlr-insert-reactor ...................................................... 313
vlr-linker-reactor ....................................................... 315
vlr-lisp-reactor ......................................................... 316
vlr-miscellaneous-reactor ......................................... 317
vlr-mouse-reactor ..................................................... 319
vlr-notification ......................................................... 320
vlr-object-reactor ..................................................... 320
vlr-owner-add............................................................ 323
vlr-owner-remove .................................................... 323
vlr-owners ................................................................. 324
vlr-pers ..................................................................... 324
vlr-pers-list ............................................................... 325
vlr-pers-p .................................................................. 325
vlr-pers-release ......................................................... 326
vlr-reaction-names ................................................... 326
vlr-reaction-set ......................................................... 327
vlr-reactions ............................................................. 328
vlr-reactors ................................................................ 328
vlr-remove ................................................................ 329
vlr-remove-all .......................................................... 330
vlr-set-notification ................................................... 331
vlr-sysvar-reactor ..................................................... 332
vlr-toolbar-reactor .................................................... 333
vlr-trace-reaction....................................................... 334
vlr-type ..................................................................... 335
vlr-types ................................................................... 336
vlr-undo-reactor ....................................................... 337
vlr-wblock-reactor ................................................... 339
vlr-window-reactor .................................................. 341
vlr-xref-reactor ......................................................... 343
vports ........................................................................ 349

                                                                            |   xiii
wcmatch .................................................................... 350
          while.......................................................................... 353
          write-char .................................................................. 353
          write-line ................................................................... 354
          xdroom ...................................................................... 355
          xdsize ........................................................................ 355
          zerop.......................................................................... 356

      A        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
          3dsin.......................................................................... 360
          3dsout........................................................................ 361
          align .......................................................................... 362
          cal.............................................................................. 362
          fog ............................................................................. 363
          light ........................................................................... 363
          lsedit.......................................................................... 372
          lslib............................................................................ 373
          lsnew ......................................................................... 377
          matlib ........................................................................ 377
          mirror3d .................................................................... 378
          psdrag........................................................................ 379
          psfill .......................................................................... 379
          psin............................................................................ 380
          render ....................................................................... 381
          renderupdate.............................................................. 386
          replay ....................................................................... 386
          rmat ........................................................................... 387
          rotate3d ..................................................................... 402
          rpref .......................................................................... 403
          saveimg ..................................................................... 406
          scene ......................................................................... 407
          setuv .......................................................................... 410
          showmat ................................................................... 412
          solprof ....................................................................... 413
          stats .......................................................................... 413



xiv   |
AutoLISP
AutoCAD  AutoLISP   !T
                                         '()*+ ,-.
/012

        !#$%'()*+

,-.
/012


+345#65789:;=?@A

BCD!EFGH2IJ#K9LMN            OP

QGRS




                                                   15
=
                                       /
?
@AB$


               (foo string [number ...])
                                                     DB$

                         CB$                       EF
GHI$ (...) J
number
!
#$%'()
*
+ ,'-
%
./)
               01
,'-
%
               23
45678                    9 Visual LISP      
:AutoLISP
;/%




16   |   AutoLISP
+
34
(+ [number number] ...)


      number
number          
           0
! number  #     0

      $%
      (+ 1 2)               3
      (+ 1 2 3 4.5)         10.5
      (+ 1 2 3 4.0)         10.0


–
345,   -67
8              2


      (– [number number] ...)


      number



      
 '
number  ()*#        +,         
      -,. /01
2  number                  0
      -
2   -number   #  0




                                                 +   |   17
(- 50 40)                 10
               (- 50 40.0)               10.0
               (- 50 40.0 2.5)           7.5
               (- 8)                     -8


*
45
1


               (* [number number] ...)


               number
number        

               1 
 
! number  # 
 0



               (* 2 3)                    6
               (* 2 3.0)                  6.0
               (* 2 3 4.0)               24.0
               (* 3 -4.5)                -13.5
               (* 3)                     3


/
4$56(             $,78 19 
3


               (/ [number number] ...)


               number

                    

               
$  number %' ( )*+$ 
               $,(- ./0 1 
/02.3  number
                   
$, 1    
! number  # 
 0




18   |   AutoLISP
(/ 100 2)                   50
         (/ 100 2.0)                 50.0
         (/ 100 20.0 2)              2.5
         (/ 100 20 2)                2
         (/ 4)                       4


=
!#$%       


         (= numstr [numstr] ...)


         numstr
T
nil
T



         (= 4 4.0)                   T
         (= 20 388)                  nil
         (= 2.4 2.4 2.4)             T
         (= 499 499 500)             nil
         (= me me)               T
         (= me you)              nil

               eq        equal    


/=
!'#$%                 '


         (/= numstr [numstr] ...)


         numstr                             
   




                                                              =   |   19
T      nil         
                        T

               /=  !# LISP $%'()*+ , -./
               012
  3
45         T6- AutoLISP 0,
/= 7     T 89:;=

               =
               (/= 10 20)                T
               (/= you you)          nil
               (/= 5.43 5.44)            T
               (/= 10 20 10 20 20)       nil
               (/= 10 20 10 20)          T
               -?@A=0BC./0
DEFGHI
J
               K /= L M N T



XUGY          T         3UGHVW                   T        nil



               ( numstr [numstr] ...)

                    
               numstr                   OPQRSO



                 T  3UGHVW                             T           nil   
                 T

               =
               ( 10 20)                 T
               ( b c)               T
               ( 357 33.2)              nil
               ( 2 3 88)                T
               ( 2 3 4 4)               nil




20   |   AutoLISP
=
#   $
T
 nil


        (= numstr [numstr] ...)


        numstr
T
 nil
=  
 T

           !
        (= 10 20)                T
        (= b b)              T
        (= 357 33.2)             nil
        (= 2 9 9)                T
        (= 2 9 4 5)              nil



#$
T
 nil


        ( numstr [numstr] ...)


        numstr
T
 nil
T

           !
        ( 120 17)                T
        ( c b)               T
        ( 3.5 1792)              nil
        ( 77 4 2)                T
        ( 77 4 4)                nil




                                                                  =   |   21
=
'       +
T
nil


               (= numstr [numstr] ...)


               numstr
T
nil


                  =
T


               !
               (= 120 17)            T
               (= c c)           T
               (= 3.5 1792)          nil
               (= 77 4 4)            T
               (= 77 4 9)            nil


~
'$%+
$%'( 1 )*+


               (~ int)


               int                #
$%'( 1 )*+


               !
               (~ 3)                  -4
               (~ 100)                -101
               (~ -4)                  3




22   |   AutoLISP
1+
 1   
1


         (1+ number)


         number



         
 1
(1+ 5)          6
         (1+ -17.5)     -16.5


1–
 1   1


         (1– number)


         number



          1
(1- 5)          4
         (1- -17.5)     -18.5


abs
(abs number)




                                1+   |   23
number
(abs 100)              100
               (abs -100)             100
               (abs -99.25)           99.25


acad_colordlg
NHOP AutoCAD !+A
#$


               (acad_colordlg colornum [flag])


               colornum             
 0–256  0  256   !
                                   
#$%!'(
               flag                )*+         flag ,- nil./012/032456
                                   7 flag      89,-: nil 
;*/012/032
                                   45
               colornum - 0 =' BYBLOCK- 256 =' BYLAYER

                      

               ?@+A!'()B?CD
#$;                      nil

               
               EF'(GH?+AIJ!)BK+;                     L-%!M
               (acad_colordlg 3)


acad_helpdlg
QRSTUVWX


               (acad_helpdlg helpfile topic)




24   |   AutoLISP
help
AutoCAD 

                     !
#$%                 help      


acad_strlsort
n ASCII H*ST)[*+,-BC()


          (acad _strlsort list)

          
          list                  '()
*+,-

          ./0
          ()1
23*+,-45 list                        6789-:;=?
@ABC
          ()acad_strlsort ./ nil

          DE
          FGHI6JKLM7N
NO
PQ*+,-R*ST)BC()U
          VWU(setq mos ’(Jan Feb Mar Apr May Jun Jul Aug
               Sep Oct Nov Dec))
          (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
          VWU(acad_strlsort mos)
          (Apr Aug Dec Feb Jan Jul Jun Mar May Nov Oct Sep)


action_tile
‰6[]`aX              67YZ-kltŠe[]K‹Kf7`aŒŽC                                       YZ-
kl


          (action_tile key action-expression)
                      X
YZI[]
^_YZ^_YZ new_dialog
                 action_tile
            X : `a
action bcdeX fgbc
hiFj            YZ-klm
          nopqr $value st`a
uv0dwx
value bcj      opqr $key st`
          a
!y*opqr $data st`a
z {t |d}4~'fD
|m
          n   client_data_tile jopqr $reason st`a
/€‚45 `
          aƒ„R…
†mnopqr $x  $y st`a
ƒ„‡ˆ




                                                                               acad_strlsort   |   25
key
key 
                                        
               action-                  !
#               $%       '(      
               expression


               )* + action_tile ,           -./01 AutoLISP           Command ,


               23%
               T

               45
               67 edit1 89:;=1?@A:;BCDE action_tile ,                              01-
                    '(FG$%H
               (action_tile edit1 (setq ns $value))

               I     J Visual LISP                        -   KLM%N DCL          O


add_list
+Rno Cp                ]-qb89erst-                            89


               (add_list string)
               +P1 add_list , QRSTU01 start_list , VWXYZ[] ^_
               start_list , - operation .`       string abcdR]-e
               fg] Rh



               string                   i

               23%
               67jk=23bcd]- lm=23 nil




26   |   AutoLISP
DCL
longlist 
                     !# llist $%'
(
        (setq llist ’(first line second line third line))
        (start_list longlist)
        (mapcar ’add_list llist)
        (end_list)
        )*'+,'-./                                         01234 2nd line(
        (start_list longlist 1 0)
        (add_list 2nd line)
        (end_list)

        567 start_list 8 end_list 9:(


alert
;?
;C_?DE


        (alert string)

        6:
        string                        ;=?
012(

        @AB
        nil



        =?
;CDEF
        (alert That function is not available.)
        GH= string 6:
IJ4/1KL=?
;M/01F
        (alert That functionnis not available.)


        NO ?
PQ;                         DE        /:LRS/           TUVWXPIJ        YZ[
        8]^(




                                                                                       alert   |   27
alloc
#$GHI!J expand )                KB


               (alloc n-alloc)


               n-alloc
usubr     Cons
! n-alloc
#$

               %
               _$ (alloc 100)
               1000

               '      ( expand )     


and
,-
LMN (AND) OP4/


               (and [expr ...])


               expr                  *+,-

               
               ./*012,-
3 4/5 nil 6) 789:1;
3  nil =
                T./?@ AB and C T

               %
               DEF(setq a 103 b nil c string)
               string
               DEF(and 1.4 a c)
               T
               DEF(and 1.4 a b c)
               nil




28   |   AutoLISP
angle
q rst34 UCS u X rsv


         (angle pt1 pt2)


         pt1
         pt2
X
! #$
         %'( )*+,-./012./34 X 

         56
         789(angle ’(1.0 1.0) ’(1.0 4.0))
         1.5708
         789(angle ’(5.0 1.33) ’(2.4 1.33))
         3.14159

         :       ; Visual LISP                =?@


angtof
+wxEFG?
y z{                       |}B



         (angtof string [units])


         string                    unit     %ABCDEFG string HIJKL
                                 M angtof N OP% unit    QRSTUVWXEF
                                 G        string ABYZ 4 angtos N [$AB
                                 ]^Z J AutoCAD _`abcdAB
         units                   ef%EFGAB
           g  h i4
                                 AutoCAD jklm AUNITS _`h ni#$opg




                                                                angle   |   29
AUNITS
units     
                                   

                                   0 
                                   1 //
                                   2 
                                   3 
                                   4     !#

               $%
                      '    ()     *    $%+,-      ./

     01$% nil
               angtof 2 angtos    3+456             angtos 78
+,9:;
                 =        angtof ?@ angtof         ABC$%+,DE
 FGHIJ
               K unit     LMN    

               OP
               QR(angtof 45.0000)
               0.785398
               QR(angtof 45.0000 3)
               1.0177

               S    T angtos       


angtos
     +,U#
X
YZ(9:;


               (angtos angle [unit [precision]])


               angle               U#VWX
-            




30   |   AutoLISP
unit
unit
                                                       
                    AUNITS        
units      
                   0      !#$

                   1        /%/

                   2 '%
                   3 (
                   4 )*
precision          +  ,-. /0 1
2               
                     AUPREC            

angtos  34 mode5precision 6 AutoCAD  UNITMODE 789:
; DIMZIN = angle ?@ABCDEF,-

angtos     GHI angle        JKLMNOP         ?@QRSTA 0 U 2π
(      QV   W
XY)*      unit   4$ UNITMODE Z[ ,-
]
BCD
UNITMODE  0]
BCD^Z_`ab c N 45d E$
def
UNITMODE  1]
BCD^ghZ_`ab c N45dE$  


,-
iAjK,-klBCDmn,- nil


oc
pq(angtos 0.785398 0 4)
45.0000
pq(angtos -0.785398 0 4)
315.0000
pq(angtos -0.785398 4)
S 45d E


r  angtos  stuvr  w ANGBASE hex                         $ yz
{y2|}6~ ANGBASE 



€ angtof        Visual LISP            ^   ‚BCD?@ƒ





                                                            angtos   |   31
append
01234
4


               (append [list ...])


               list
nil

               
               (append ’(a b) ’(c d))
               (A B C D)
               (append ’((a)(b)) ’((c)(d)))
               ((A) (B) (C) (D))


apply
0          5678


               (apply ’function list)


               ’function                   !  defun # lambda   $%'
               list                             ()     *+     , nil



                       -./

               
               (apply ’+ ’(1 2 3))
               6
               (apply ’strcat ’(a b c))
               abc




32   |   AutoLISP
arx
      hdCD% ObjectARX                       



            (arx)


            ObjectARX
(arx)
            (acadapp.arx acmted.arx oleaprot.arx)

             arxload  arxunload 


arxload
CD ObjectARX


            (arxload application [onfailure])

            
            application              !!#$%'()*+,-
%./+
                                   012
%34 .arx
                                   5678 ObjectARX +,-
%9            :;
=
                                    AutoCAD ?@
AB
            onfailure              CDEFGH,-%
IJ



            KLMNO                      KLMNP78Q onfailure                   
            % RO                 S %TUVW
            KLXYCDZ[]CD% ObjectARX    arxload ^_`ZaTUV
            Wb arxload CDZ[   cd +0e arx fgCD% ARX
                




                                                                          arx   |   33
AutoCAD
geomcal.arx
               (arxload c:/program files/ACAD2000/geomcal.arx)
               c:/program files/acad2000/geomcal.arx

                    arxunload 


arxunload
1        ObjectARX ABC


               (arxunload application [onfailure])

                    
               application
!# arxload
$%
                                  
'
()$*+,
'-
.arx ./0             

               onfailure          1    2345%
678

               9:;
               =?@9:ABC'=D?EFGHI onfailure                      E9:J
;EK@9:LA
MNOP
               QRDS1           TU
ObjectARX ABCVW+XYEObjectARX AB
               CZTU
arxload 


ascii
-
]^_`ab ASCII c.9:


               (ascii string)

                    
               string             [




34   |   AutoLISP
(ascii A)
        65
             
(ascii a)
        97
             
(ascii BIG)
        66


assoc
#
$%!                        



        (assoc element alist)
element                


        alist                  




                        
 !                            nil



          
(setq al ’((name box) (width 3) (size 4.7263) (depth 5)))
        ((NAME BOX) (WIDTH 3) (SIZE 4.7263) (DEPTH 5))
          
(assoc ’size al)
        (SIZE 4.7263)
           
(assoc ’weight al)
        nil


atan
   $% '() *+,-./01


        (atan num1 [num2])




                                                                              assoc   |   35
num1
               num2
num1       num1
num1  num2     num1/num2 
                  
 num2  0         ! 1.570796 #+90 ! -90 $%
               '( num1             )*+, −π/2 - +π/2 #$

               ./
               012(atan 1)
               0.785398
               012(atan 1.0)
               0.785398
               012(atan 0.5)
               0.463648
               012(atan 1.0)
               0.785398
               012(atan -1.0)
               -0.785398
               012(atan 2.0 3.0)
               0.588003
               012(atan 2.0 -3.0)
               2.55359
               012(atan 1.0 0.0)
               1.5708


atof
:7894;6


               (atof string)


               string               3456   789



               6




36   |   AutoLISP
(atof 97.1)
         97.1
                  (atof 3)
         3.0
                  (atof 3.9)
         3.9


atoi
789       
:
(atoi string)


         string
(atoi 97)
         97
                  (atoi 3)
         3
                  (atoi 3.9)
         3

                itoa          


atom
;89==!


         (atom item)


         item                         AutoLISP 
         
 LISP  atom                !#
$%'()*+,-./0
1234
         5+6




                                                             atoi   |   37
item
nil
T
(setq a ’(x y z))
               (X Y Z)
               (setq b ’a)
               A
               (atom ’a)
               T
               (atom a)
               nil
               (atom ’b)
               T
               (atom b)
               T
               (atom ’(a b c))
               nil


atoms-family
         ?78@'9)*ABCD


               (atoms-family format [symlist])


               format
0 ! 1    
#$%' atoms-family (   )*+
                                      ,-
                                      0 . /-       )*+
                                      1 .0)1     /-      )*+
               symlist                $%'$2345)*+0)1             



               )*           '6 symlist
atoms-family    78'9')*
:;=
               '9)*          nil




38   |   AutoLISP
(atoms-family 0)
         (BNS_PRE_SEL FITSTR2LEN C:AI_SPHERE ALERT DEFUN C:BEXTEND REM_GROUP
         B_RESTORE_SYSVARS BNS_CMD_EXIT LISPED FNSPLITL...
CARCDR  XYZ
(atoms-family 1 ’(CAR CDR XYZ))
         (CAR CDR nil)
         !        #
$
XYZ %'


autoarxload
fg45670FG ObjectARX 9:;#                      


         (autoarxload filename cmdlist)
         ()*+,- cmdlist ./#0*   1234567 filename ./8
         # ObjectARX 9:;=?,-   '
         @A*%(8BCD#   E filename FGH3AutoCAD (IJ
         K  LMN*OPQRST:U'

         ./
         filename            8(      VN IJ cmdlist ./D#0 LW6
                             7# .arx BC#
'@AXYZ[3AutoCAD (]
                             ^BC_`Z[DabKBC'
         cmdlist
'

              c
         nil



                    d C:APP1C:APP2  C:APP3 e/67 bonusapp.arx BC
         (autoarxload BONUSAPP ’(APP1 APP2 APP3))




                                                              autoarxload   |   39
autoload
c
[
DE AutoLISP
5


               (autoload filename cmdlist)
                           cmdlist
filename
AutoLISP        !



               filename             
 #$% cmdlist '
()
.lsp *+
,-.!/012345AutoCAD  6
                                    7*+8934':;*+!
               cmdlist              ,-.=!

               ?@
               nil
               /0 AB 
*+'
C filename DEFAutoCAD                   %
               (G# HIJKLMNO!

               PQ
                    #$% APP1RAPP2 S APP3 (T AutoLISP 
                bounsapp.lspU
               (autoload BONUSAPP ’(APP1 APP2 APP3))


Boole
d e
fghijkb


               (Boole operator int1 [int2 ...])


               operator             0 V 15 W
X        Y= 16 Z[
]^_`ab   !




40   |   AutoLISP
int1, int2...
                             Boole
!#$%'()*+
,-


UV         !

Int1       Int2       EF#

0          0         8

0          1         4

1          0         2

1          1         1



 int1 .
#/
 int2 01#23456 !78
9 :;
# = 0 ? 1@ABC !7@
9D01EF#GHIJ
 21EF# !
KL#M 1 NOL#M 0 operator 
                        
8PA QRCSTUV:; AND$/( OR$?( XOR$X?( NOT
                    W     W
$Y(


Boole          #

:;         :;              #M 1 ]^

1           AND             _`ab#cM 1

6           XOR             _`ab#de
`M 1

7           OR              e
`?_`ab#M 1

8           NOR             _`ab#cM 0$1fg(



Z[




                                                       Boole   |   41
12
5 
 (AND) 
               (Boole 1 12 5)
               4
                          
 6
5 
 (XOR) 
               (Boole 6 6 5)
               3
                operator 
 !
#$%
'() *+*,
               operator - 4+./0#1 int2 
23 1+4 int1 
5623 0 7+8,293
               1+:;
               (Boole 4 3 14)
               12


boundp
]^=-WABC3_J


               (boundp sym)

                    
               sym                   =)

               ?
               *,  sym @ABC3D nil +EF? T)*,#BC sym GABC
               3 nil+HF? nil)*, sym -IJKLM
=+NOPQRG+STB
               3 nil)



               (setq a 2 b nil)
               nil
               (boundp ’a)
               T
               (boundp ’b)
               nil
               U atoms-family F VLIJ=
-WX1+YGZOPQRE=)

               [      atoms-family F)




42   |   AutoLISP
caddr
 !



        (caddr list)
         AutoLISP caddr
Z 
      
        
  

        
        list                 

               !
        list   
#$%'            ()
*   ! nil

        +,
        -./(setq pt3 ’(5.25 1.0 3.0))
        (5.25 1.0 3.0)
        -./(caddr pt3)
        3.0
        -./(caddr ’(5.25 1.0))
        nil

        01 Visual LISP                 23


cadr
 !4


        (cadr list)
         AutoLISP cadr
4'
 Y 5'
         4 

        
        list                 

               !
        list   4#$%'            678*   ! nil




                                                            caddr   |   43
(setq pt2 ’(5.25 1.0))
               (5.25 1.0)
                         (cadr pt2)
               1.0
                         (cadr ’(4.0))
               nil
                         (cadr ’(5.25 1.0 3.0))
               1.0

                            Visual LISP
car



               (car list)

                     
               list                         

               
               list 
 nil



                         (car ’(a b c))
               A
                         (car ’((a b) c))
               (A B)
                         (car ’())
               nil

                            Visual LISP
cdr
 !


               (cdr list)




44   |   AutoLISP
list



        list
! #      $%
        '          nil


         ( list           )*+ ,cdr     *+   
-
./)0     12
          3


        4
        567(cdr ’(a b c))
        (B C)
        567(cdr ’((a b) c))
        (C)
        567(cdr ’())
        nil
        567(cdr ’(a . b))
        B
        567(cdr ’(1 . Text))
        Text

               Visual LISP            8*   


chr
IJ ? ASCII =9          KLM;NOP??@


        (chr integer)


        list                   9   :



        ; ASCII =$ integer ??@ #9            /A 1-255 BCD        
        E#/FGH

        4
        567(chr 65)
        A




                                                              chr   |   45
(chr 66)
               B
                     (chr 97)
               a


client_data_tile
dh                iBCjkl 
mHn


               (client_data_tile key clientdata)


               key
clientdata            key 
     !
#$%'(
                                    )*+, $data -./

               01
               nil


close
HIBCP345



               (close file-desc)


               file-desc            2 open (   345
6785
9:

               01
               ; file-desc        =close ( 0 nil ?@A0BCDEFG
                close ( HI5
JK5
9:LM=N-OPQR=2SHI
               5
TUVWXP345
       LM=YZ[5


               ]^
               _`ab)785
 somefile.tx c            Lde1fg-. ct




46   |   AutoLISP
(setq fil SOMEFILE.TXT)
          (setq x (open fil r) ct 0)
          (while (read-line x)
            (setq ct (1+ ct))
          )
          (close x)


command
† AutoCAD


          (command [arguments] ...)


          arguments                  AutoCAD
command 
            
                                           !  #
$ () %'
                                     (') ENTER '
*+  ,- command ./0') ESC
                                     '123456 AutoCAD
command 
                789   :;= AutoCAD ?@%
AB@
          C  DE  FG9 HI B@CJKFL9 HI
          B@CLK
MNO   @%P AutoCAD QRST  D
UVWX Visual LISP YZ- command 
 []*^_`a
          AutoCAD Y
WX      b-cd)eO[fghYiajklX
          (nil) AutoCAD 7mnd)opqr AutoCAD ]?@%
O12s
          tuvwx          y^z{
jk|
          nil

          2}
          P}~7€ pt1 E pt2 T‚ƒ (1,1) E (1,5)„w,- command 
            
          LINE ]71G9|= AutoCAD
…(setq pt1 ’(1 1) pt2 ’(1 5))
          (1 5)




                                                                command   |   47
(command line pt1 pt2 )
                          

                   

                   

                        nil
AutoCAD  SKETCH  !# AutoLISP 
               command $%'()*    +,-#$%' SCRIPT ./0123
               #4 AutoLISP 5678+
               9:,-# acad.lsp ; MNL =%' command $?# defun @AB
               %C'+D' S::STARTUP $ E#FGHIJKLMNOPQRSK
                 +
               TUQRVNW *TX AutoCAD    Y, BREAK  TRIM Z
                                                        []
               ^ *' entsel $_`@abcdefLgW *TXhVN
(
               ijkl[ m Visual LISP     %nop
qr AutoCAD
                s+
               ,-tuvw CMDECHO Y[xy setvar  getvar $zZ{|g 0xy
               command $OP  o!}#      P%~+

               €    m           % vl-cmdf $ Visual LISP   %n   ]cs+


cond
—˜=™—’“‘-$


               (cond [(test result ...) ...])
               cond $ [gH‚@+.ƒ„6T… *@   †‡ˆ
               ‰%Š ‹Œ‡!1 nil g+4$ŽT48‰@AB†‡+

               ‹Œ‡
                {OP‘-’“@AB%78 *@AB‡+,-l@%?” *@AB
               Y• result !z#Z‹Œ test ‡+,-– cond ‹Œ nil+




48   |   AutoLISP
cond
(cond
            ((minusp a) (- a))
            (t a)
          )
           –10 10
          cond   case !     #$%        T '(#)*+,-
          test ./01      2#)34   5 s 567 8 9:; =
          ?      @AB?= s 8 Y C y DE 1 s 8 N C n DE 0F
          DE nil
          (cond
            ((= s Y) 1)
            ((= s y) 1)
            ((= s N) 0)
            ((= s n) 0)
            (t nil)
          )


cons
_.     `aIJ#)NOCbc#)


          (cons new-first-element list-or-atom)

          G
          new-first-                HIJK.LM       NO?NOPQC.
          element
          list-or-atom              .CPQ

          DE
          DER list-or-atom      S!TU list-or-atom . cons DE.V
          @ new-first-element DE.5 W#X list-or-atom PQ cons D
          EYZ new-first-element [ list-or-atom 



          ]^(cons ’a ’(b c d))
          (A B C D)
          ]^(cons ’(a) ’(b c d))
          ((A) B C D)




                                                               cons   |   49
(cons ’a 2)
               (A . 2)

                            Visual LISP
cos
              


               (cos ang)

                     
               ang                            

               
               ang       

               
                         (cos 0.0)
               1.0
                         (cos pi)
               -1.0


cvunit
89:;+,=?@ !


               (cvunit value from-unit to-unit)

                     
               value                         ! #$%%#
                                                            
               from-unit                  value '()*   +,
               to-unit                    value -)*   +,
               from-unit . to-unit /01 acad.unt 23       45+,67




50   |   AutoLISP
acad.unt 
         !                 
#$
   nil

        %!
        '((cvunit 1 minute second)
        60.0
        '((cvunit 1 gallon furlong)
        nil
        '((cvunit 1.0 inch cm)
        2.54
        '((cvunit 1.0 acre sq yard)
        4840.0
        '((cvunit ’(1.0 2.5) ft in)
        (12.0 30.0)
        '((cvunit ’(1 2 3) ft in)
        (12.0 24.0 36.0)


        )*   +,-%
./  01 
2,3  4 1.0
5
67 89
        :4;
=?!@A
BCDEFGHI.JKLMNO
PQRS
        TUQF
@9MN
  +VW0XYZ


        [] Visual LISP                    
^             _


defun
ST:4


        (defun sym ([arguments] [/ variables...]) expr...)

        4
        sym                  :4`
        arguments            :4a+
b/4`
        / variables          :4cd
0efghZ`
                             fghZ`ij
kl#m0fg`ino
,Wpkl
                             #q
04  
rno
Ustuvwx0
                             yz
{|




                                                                  defun   |   51
expr
AutoLISP 

               
                                  !#$%'(
               )*+,-                          !AutoLISP %./012        !3456
               7  !

               89:
               ;=        
      :

               ?@ A BCD      EF sym :GHIJKL *MNOC
               D      PQ% RSCD     TU*M  V
W% atoms-
               family   


               HX
               (defun myfunc (x y) ...)
               (defun myfunc (/ a b) ...)
(defun myfunc (x / temp) ...)
(defun myfunc () ...)
W      Y Visual LISP Z             [T          ]^


defun-q
B         *MF


               (defun-q sym ([arguments] [/ variables...]) expr...)
                    _``1abcdef AutoLISP ghi j3kD AlE
               defun-q
               67mn op*MF
qr             st% defun-qGu%v
               bcdwxy AutoLISP efZ defun z2v/O



               sym                 a{               
               arguments                Zn         |        




52   |   AutoLISP
/ variables
!#                   $%'()*+,
                                   -. /0
          expr                    12          3412        56    7 AutoLISP 89:
            !;=5?                    
@AB#                '(      -CA
            !DEFGH                     @AAutoLISP                 IJ    KLMN
          O  

          PQR
          ST          89:        R

          UV
          _$ (defun-q my-startup (x) (print (list x)))
          MY-STARTUP
          _$ (my-startup 5)
          (5) (5)
                 defun-q-list-ref WX my-startup          8YZ[
          _$ (defun-q-list-ref ’my-startup)
          ((X) (PRINT (LIST X)))

          ] defun-q-list-ref  defun-q-list-set           


defun-q-list-ref
PQ   defun-q E`               8YZ


          (defun-q-list-ref ’function )

          
          function                   ^_             @A

          PQR
                  8E`a:             !        bcE`d8BPQ nil

          UV
                 defun-q E`         [




                                                                        defun-q-list-ref   |   53
_$ (defun-q my-startup (x) (print (list x)))
               MY-STARTUP
                      defun-q-list-ref        my-startup
_$ (defun-q-list-ref ’my-startup)
               ((X) (PRINT (LIST X)))

               
       defun-q  defun-q-list-set 


defun-q-list-set
@CD3E F$%                      


               (defun-q-list-set ’sym list)

                    
               sym                               
               list                                       

                    !
               #$%         sym

               '
               _$ (defun-q-list-set ’foo ’((x) x))
               FOO
               _$ (foo 3)
               3
               () '*+,-         defun-q-list-set ./012340567
8
               Visual LISP 9:;= defun-q $%/0
_$ (defun-q s::startup (x) (print x))
               S::STARTUP
               $ (defun-q my-startup (x) (print (list x)))
               MY-STARTUP
               ?          defun-q-list-set @AB12340
_$ (defun-q-list-set ’s::startup (append
                    (defun-q-list-ref ’s::startup)
                   (cdr (defun-q-list-ref ’my-startup))))
               S::STARTUP




54   |   AutoLISP
defun-q-list-set    
          _$ (defun-q foo (x) (print (list ’foo x)))
          FOO
          _$ (foo 1)
          (FOO 1) (FOO 1)
          _$ (defun-q bar (x) (print (list ’bar x)))
          BAR
          _$ (bar 2)
          (BAR 2) (BAR 2)
          _$ (defun-q-list-set
           ’foo
           (append (defun-q-list-ref ’foo)
                   (cdr (defun-q-list-ref ’bar))
           ))
          FOO
          _$ (foo 3)
          (FOO 3)
          (BAR 3) (BAR 3)

           defun-q  defun-q-list-ref               


dictadd
D[%]!;=#$


          (dictadd ename symbol newobj)

          
          ename                       !#$%'(
          symbol                   !)%*#$+,-symbol ./012'(3
                                   456%*78+,%9:
          newobj                      !)%*;=#$
          2?@AB!)%*#$C./ 12DEF%!F#$
          GHIJ KL BMN4O+,-P!O2F#$QRSF'
          (9: dictnext TUV

          WXY
          !)%*#$Z'




                                                                     dictadd   |   55
(setq dictionary
                (list ’(0 . DICTIONARY) ’(100 . AcDbDictionary)))
               ((0 . DICTIONARY) (100 . AcDbDictionary))
                    ! entmakex #         

               (setq xname (entmakex dictionary))
                $%1d98950
               


               (setq newdict
                 (dictadd (namedobjdict) MY_WAY_COOL_DICTIONARY xname))
                $%1d98950
                      Xrecord 
               (setq datalist (append (list ’(0 . XRECORD)
               ’(100 . AcDbXrecord))
               ’((1 . This is my data) (10 1. 2. 3.) (70 . 33))))
               ((0 . XRECORD) (100 . AcDbXrecord) (1 . This is my data) (10 1.0 2.0 3.0) (70 . 33))
               '( Xrecord 

               (setq xname (entmakex datalist))
                $%1d98958
                Xrecord 

               (dictadd newdict DATA_RECORD_1 xname)
                $%1d98958

               )     * dictnext+dictremove+dictrename+dictsearch , namedobjdict #


dictnext
./0               12


               (dictnext ename [rewind])

                    #
               ename                  -




56   |   AutoLISP
rewind                                nil
!
#$%
'(
 nil) DXF
*+,-./012 #34
dictsearch      !56
78 namedobjdict 9:;=
?@A


BC DE6F
GH
 IJKL dictnext MNOP
@
QRSTU6
VWXYZ[
 ]^_`abcd


ef
ghi dictadd efjklm
.
nolmp Xrecord 0qr
str(setq xname (entmakex datalist))
 ?@r1b62d60
I Xrecord 0qu
vwxyz%
r
str(dictadd newdict DATA_RECORD_2 xname)
 ?@r1b62d60
?@r
str(cdr (car (dictnext newdict)))
 ?@r1bac958
dictnext yz%
?@A
?@r
str(cdr (car (dictnext newdict)))
 ?@r1bac960
dictnext yz%
v?@A
?@r
str(cdr (car (dictnext newdict)))
nil
{|}~
j) dictnext  nil




                                                   dictnext   |   57
(cdr (car (dictnext newdict T)))
                1bac958
                T           rewind     dictnext
!

                   # dictadd$dictremove$dictrename$dictsearch % namedobjdict !


dictremove
,            -.
(dictremove ename symbol)
               '()*+,        -./
012,34 -.!2,34
               -.567 entdel !89:; =?@A%BCDE!FGHIJK
                LMNO34%       PQRS HDTKFGUV7 dictremove W,
                  -./
XYZ,34 -.
!

                    
               ename               []               ^!
               symbol              N, ename          -.
!
               9 
BCDE_[34                          
BC`7Xdictremove 0K2,B
               CDE   -.!

                     
               a-
!bc ename defghij symboldictremove                 nil!

               D=
               +k       D=-.U dictadd D=         lm         
               (dictremove (namedobjdict) my_way_cool_dictionary)
                1d98950

                   # dictadd$dictnext$dictrename$dictsearch % namedobjdict !


dictrename
n
(dictrename ename oldsym newsym)




58   |   AutoLISP
ename                                 

         oldsym
newsym
newsym  oldname        !#ename $%
          newname $% '( newnamedictrename ) * nil

         +,
         -. +,           dictadd +,    /0         1
         21(dictrename (namedobjdict) my_way_cool_dictionary
         An even cooler dictionary)
         An even cooler dictionary

         3   4 dictadd#dictnext#dictremove#dictsearch 5 namedobjdict )   


dictsearch
     67=


         (dictsearch ename symbol [setnext])


         ename                67               

         symbol             89:;                 67
dictsearch   |   59
setnext                             nil
dictnext 
 
                                       dictnext  dictsearch 



               !
                     #      
$%
                   '()*+
            
 nil

               +,
               -+,./               0 dictsearch 12     dictadd +,345678

               9:8(setq newdictlist
                 (dictsearch (namedobjdict) my_way_cool_dictionary))
               ((-1 .  ;=81d98950) (0 . DICTIONARY) (5 . 52) (102 . {ACAD_REACTORS) (330
               .  ;=81d98860) (102 . }) (330 .  ;=81d98860) (100 . AcDbDictionary) (280 .
               0) (281 . 1) (3 . DATA_RECORD_1) (350 .  ;=81d98958))

                    ? dictadd@dictnext@dictremove A namedobjdict 


dimx_tile
HIQR


               (dimx_tile key)

                    
               key                     BCD $%EFGHIJK= key                       LMNOP

               !
               HIQR
               ST!U$%HIVWXYN! Z[HIST!U 0 ]^_
                V `a X UbQR 
ST!cdN[ X-1 dimx_tile A
               dimy_tile ef vector_image@fill_image A slide_image gh iE$
               %HINOjkST

               +,
               (setq tile_width (dimx_tile my_tile))




60   |   AutoLISP
dimy_tile
(dimy_tile key)


            key
key
!
#$%
0 '()*
+ ,- Y . /0
12% Y-1dimx_tile 3
            dimy_tile 0 456 vector_image7fill_image 3 slide_image 0 89:; =
            ?@A0 BC D
EF

            GH
            (setq tile_height (dimy_tile my_tile))


distance
VUMij
OP


            (distance pt1 pt2)


            pt1                     IJKLJMN
            pt1                     IJKLJMN

            
            OP
            QRBC
ST4UKVUIJM distance 0 2WX BC
YZLJM
Z  [@AM]^_`abcdefg h
Mij
IJOP




                                                                       dimy_tile   |   61
(distance ’(1.0 2.5 3.0) ’(7.7 2.5 3.0))
               6.7
                      (distance ’(1.0 2.0 0.5) ’(3.0 4.0 0.5))
               2.82843

                            Visual LISP
distof
'de.‚ƒ378956q'


               (distof string [mode])
               distof  rtos  rtos  ! #$
               distof%distof '() %*+,-./0 mode  123 

                     
               string                     456789: ;= mode 0?@A distof
                                          BCDEFGHIJKLMNO rtos 789P(
                                          12QR%SMN AutoCAD TUVWXYZR
               mode                       789[ZR?@%K O AutoCAD ]^_`
                                          LUNITS TUa
                                                  1%ba cd[e
                                          1 fg
                                          2 h
                                          3 ij.klhkm3
                                          4 no.klIkm3
                                          5 I

               
               p!qr%s%ts nil


               uv distof wRxy 3 wRxy 4 2z{|% mode  3 .i
               j3} 4 .no3?@%~ string €ZR+%s distof BC
                




62   |   AutoLISP
done_dialog
#p9:;


         (done_dialog [status])


         status                       start_dialog
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference
AutoLisp Reference

Contenu connexe

Tendances

Tendances (19)

Plant Simulation Passo a Passo
Plant Simulation Passo a PassoPlant Simulation Passo a Passo
Plant Simulation Passo a Passo
 
Acad aug
Acad augAcad aug
Acad aug
 
Dvba pg
Dvba pgDvba pg
Dvba pg
 
Acad acg
Acad acgAcad acg
Acad acg
 
Corel vs pro_x4_ug modul corel draw
Corel vs pro_x4_ug modul corel draw Corel vs pro_x4_ug modul corel draw
Corel vs pro_x4_ug modul corel draw
 
Vrs User Guide
Vrs User GuideVrs User Guide
Vrs User Guide
 
Man 00851 rev 001 understanding image checker 9.0
Man 00851 rev 001 understanding image checker 9.0Man 00851 rev 001 understanding image checker 9.0
Man 00851 rev 001 understanding image checker 9.0
 
Autocad Mep Gettingstarted
Autocad Mep GettingstartedAutocad Mep Gettingstarted
Autocad Mep Gettingstarted
 
Car.8000.ingm
Car.8000.ingmCar.8000.ingm
Car.8000.ingm
 
Ug893 vivado-ide
Ug893 vivado-ideUg893 vivado-ide
Ug893 vivado-ide
 
Java Complete Reference Fifth Edition
Java Complete Reference Fifth EditionJava Complete Reference Fifth Edition
Java Complete Reference Fifth Edition
 
Cloud Infrastructure Architecture Case Study
Cloud Infrastructure Architecture Case StudyCloud Infrastructure Architecture Case Study
Cloud Infrastructure Architecture Case Study
 
Acro js guide
Acro js guideAcro js guide
Acro js guide
 
In designcs5 scripting tutorial
In designcs5 scripting tutorialIn designcs5 scripting tutorial
In designcs5 scripting tutorial
 
Qtp user-guide
Qtp user-guideQtp user-guide
Qtp user-guide
 
Tutorial
TutorialTutorial
Tutorial
 
Modelsim Tuttranslate
Modelsim TuttranslateModelsim Tuttranslate
Modelsim Tuttranslate
 
report
reportreport
report
 
Crystal ball installation guide
Crystal ball installation guideCrystal ball installation guide
Crystal ball installation guide
 

En vedette (9)

Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
Basic Tricks Learning Visual Basic .Net 2010
Basic Tricks Learning Visual Basic .Net 2010Basic Tricks Learning Visual Basic .Net 2010
Basic Tricks Learning Visual Basic .Net 2010
 
Visual basic .NET
Visual basic .NETVisual basic .NET
Visual basic .NET
 
Auto lisp programming
Auto lisp programmingAuto lisp programming
Auto lisp programming
 
AUTOCAD 3D COURSE
AUTOCAD 3D COURSEAUTOCAD 3D COURSE
AUTOCAD 3D COURSE
 
Auto cad 3d tutorial
Auto cad 3d tutorialAuto cad 3d tutorial
Auto cad 3d tutorial
 
The Best Source Code VB
The Best Source Code VBThe Best Source Code VB
The Best Source Code VB
 
TUTORIAL AUTO CAD 3D
TUTORIAL AUTO CAD 3DTUTORIAL AUTO CAD 3D
TUTORIAL AUTO CAD 3D
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 

Similaire à AutoLisp Reference

REPORT IBM (1)
REPORT IBM (1)REPORT IBM (1)
REPORT IBM (1)Hamza Khan
 
Tutorials mep metenu
Tutorials mep metenuTutorials mep metenu
Tutorials mep metenuEldos Rajan
 
Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Leng Kim Leng
 
acdmac_2013_autolisp_reference_guide.pdf
acdmac_2013_autolisp_reference_guide.pdfacdmac_2013_autolisp_reference_guide.pdf
acdmac_2013_autolisp_reference_guide.pdfCESARSILVIOPILACAIZA
 
Concorde_TechBooklet_6.1.16
Concorde_TechBooklet_6.1.16Concorde_TechBooklet_6.1.16
Concorde_TechBooklet_6.1.16Kelly Knight
 
An Introduction to Creo 3.0
An Introduction to Creo 3.0An Introduction to Creo 3.0
An Introduction to Creo 3.0Kshitiz24
 
Mx Odbc
Mx OdbcMx Odbc
Mx Odbcfire9
 
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao UebayashiPorting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashieurobsdcon
 
ESTACION DE TRABAJO ALLEN-BRADLEY
ESTACION DE TRABAJO ALLEN-BRADLEYESTACION DE TRABAJO ALLEN-BRADLEY
ESTACION DE TRABAJO ALLEN-BRADLEYHard Rock Cafe
 
Rational Suite Tutorial
Rational Suite TutorialRational Suite Tutorial
Rational Suite TutorialLuciano Saia
 
380 Vdc Architectures for the Modern Data Center
380 Vdc Architectures for the Modern Data Center380 Vdc Architectures for the Modern Data Center
380 Vdc Architectures for the Modern Data CenterEltek
 
Asd steel manual_eng_2011 (1)
Asd steel manual_eng_2011 (1)Asd steel manual_eng_2011 (1)
Asd steel manual_eng_2011 (1)Robert Aguado
 

Similaire à AutoLisp Reference (20)

Rst4userguide
Rst4userguideRst4userguide
Rst4userguide
 
REPORT IBM (1)
REPORT IBM (1)REPORT IBM (1)
REPORT IBM (1)
 
Tutorials mep metenu
Tutorials mep metenuTutorials mep metenu
Tutorials mep metenu
 
orcad-tutorial.pdf
orcad-tutorial.pdforcad-tutorial.pdf
orcad-tutorial.pdf
 
V6 tutorial en
V6 tutorial enV6 tutorial en
V6 tutorial en
 
Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1Best practices for_managing_geospatial_data1
Best practices for_managing_geospatial_data1
 
Icalogon
IcalogonIcalogon
Icalogon
 
Robot khmer engineer
Robot khmer engineerRobot khmer engineer
Robot khmer engineer
 
acdmac_2013_autolisp_reference_guide.pdf
acdmac_2013_autolisp_reference_guide.pdfacdmac_2013_autolisp_reference_guide.pdf
acdmac_2013_autolisp_reference_guide.pdf
 
Concorde_TechBooklet_6.1.16
Concorde_TechBooklet_6.1.16Concorde_TechBooklet_6.1.16
Concorde_TechBooklet_6.1.16
 
An Introduction to Creo 3.0
An Introduction to Creo 3.0An Introduction to Creo 3.0
An Introduction to Creo 3.0
 
Mx Odbc
Mx OdbcMx Odbc
Mx Odbc
 
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao UebayashiPorting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
 
ESTACION DE TRABAJO ALLEN-BRADLEY
ESTACION DE TRABAJO ALLEN-BRADLEYESTACION DE TRABAJO ALLEN-BRADLEY
ESTACION DE TRABAJO ALLEN-BRADLEY
 
Sim
SimSim
Sim
 
Rational Suite Tutorial
Rational Suite TutorialRational Suite Tutorial
Rational Suite Tutorial
 
2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER2D ROBOTIC PLOTTER
2D ROBOTIC PLOTTER
 
380 Vdc Architectures for the Modern Data Center
380 Vdc Architectures for the Modern Data Center380 Vdc Architectures for the Modern Data Center
380 Vdc Architectures for the Modern Data Center
 
8504006
85040068504006
8504006
 
Asd steel manual_eng_2011 (1)
Asd steel manual_eng_2011 (1)Asd steel manual_eng_2011 (1)
Asd steel manual_eng_2011 (1)
 

AutoLisp Reference

  • 1. ® February 24, 1999
  • 2. © 1999 Autodesk, Inc. AUTODESK, INC.
  • 3. !#$% '() *+, - ./0(123456*789:8;=? AUTODESK, INC. @AB-CDEFGHI JK AUTODESK, INC. LM#$ABNO PQR
  • 5. $] ^Z[_` abcZ[defg- Autodesk hi Pjkl Autodesk, Inc. mno( p qorsthiu3D Plan83D Props83D Studio83D Studio MAX83D Studio VIZ8 3DSurfer8ADE8ADI8Advanced Modeling Extension8AEC Authorityvwix 8AEC-X8AME8Animator Pro8Animator Studio8 ATC8AUGI8AutoCAD8AutoCAD Data Extension8AutoCAD Development System8AutoCAD LT8AutoCAD Map8Autodesk8 Autodeskvwix Autodesk Animator8 8 Autodesk MapGuide8 Autodesk University8Autodesk View8 Autodesk WalkThrough8 Autodesk World8AutoLISP8AutoShade8AutoSketch8AutoSolid8AutoSurf8AutoVision8Biped8bringing information down to earth8CAD Overlay8 Character Studio8Design Companion8 Drafix8 Education by Design8Generic8 Generic 3D Drafting8Generic CADD8 Generic Software8 Geodyssey8 Heidi8HOOPS8 Hyperwire8 Inside Track8 Kinetix8MaterialSpec8 Mechanical Desktop8Multimedia Explorer8 NAAUG8Office Series8Opus8PeopleTracker8Physique8Planix8Rastation8Softdesk8Softdeskvwix 8Solution 30008Tech Talk8Texture Universe8The AEC Authority8The Auto Architect8TinkerTech8WHIP!8WHIP!vwix 8Woodbourne8WorkCenter ( World-Creating Toolkit- Pjkl Autodesk, Inc. mno( p qorhiu3D on the PC8ACAD8ActiveShapes8Actrix8Advanced User Interface8 AEC Office8 AME Link8 Animation Partner8Animation Player8 Animation Pro Player8 Studio in Every Computer8 A ATLAST8 Auto- Architect8AutoCAD Architectural Desktop8AutoCAD Architectural Desktop Learning Assistance8AutoCAD Learning Assistance8 AutoCAD LT Learning Assistance8AutoCAD Simulator8AutoCAD SQL Extension8AutoCAD SQL Interface8AutoCDM8Autodesk Animator Clips8Autodesk Animator Theatre8Autodesk Device Interface8Autodesk PhotoEDIT8Autodesk Software Developer’s Kit8 Autodesk View DwgX8AutoEDM8AutoFlix8AutoLathe8AutoSnap8Built with ObjectARXvwix 8ClearScale8Concept Studio8 Content Explorer8cornerStone Toolkit8Dancing Babyvyzx Design Your World8 8 Design Your Worldvwix DXF8 DWG Linking8 DWG Unplugged8DXF8Exegis8FLI8FLIC8GDX Driver8Generic 3D8Home Series8Kinetixvwix 8MAX DWG8ObjectARX8 ObjectDBX8 Ooga-Chaka8 Photo Landscape8 Photoscape8Plugs and Sockets8PolarSnap8 Powered with Autodesk Technology8 Powered with Autodesk Technology wix ProConnect8 Landscape8 v 8 Pro QuickCAD8 RadioRay8 SchoolBox8 SketchTools8 Suddenly Everything Clicks8Supportdesk8The Dancing Baby8Transforms Ideas Into Reality8Visual LISP ( VOLO!- {|}Z[hi Microsoft8Visual Basic ( Windows ~Microsoft Corporation sthi€ ActiveX8Windows NT8Windows 95 ( Windows 98 ~Microsoft Corporation hi-Delphi ~ Borland International hi- qhi‚8Z[‚hi@ƒ „…† ‡- GOVERNMENT USE Use, duplication, or disclosure by the U. S. Government is subject to restrictions as set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and DFAR 267.7202 (Rights in Technical Data and Computer Software), as applicable.
  • 6. AutoLISP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 + ................................................................................. 17 – ................................................................................. 17 * ................................................................................. 18 / .................................................................................. 18 = ................................................................................. 19 /= ................................................................................ 19 ................................................................................. 20 = ................................................................................ 21 ................................................................................. 21 = ............................................................................... 22 ~ ................................................................................. 22 1+ ................................................................................ 23 1– ................................................................................ 23 abs ............................................................................... 23 acad_colordlg.............................................................. 24 acad_helpdlg ............................................................... 24 acad_strlsort ................................................................ 25 action_tile.................................................................... 25 add_list........................................................................ 26 alert ............................................................................. 27 alloc............................................................................. 28 and............................................................................... 28 angle............................................................................ 29 angtof .......................................................................... 29 angtos .......................................................................... 30 | iii
  • 7. append ......................................................................... 32 apply............................................................................ 32 arx ............................................................................... 33 arxload ........................................................................ 33 arxunload .................................................................... 34 ascii ............................................................................. 34 assoc............................................................................ 35 atan.............................................................................. 35 atof .............................................................................. 36 atoi .............................................................................. 37 atom ............................................................................ 37 atoms-family ............................................................... 38 autoarxload.................................................................. 39 autoload....................................................................... 40 Boole ........................................................................... 40 boundp ........................................................................ 42 caddr............................................................................ 43 cadr.............................................................................. 43 car................................................................................ 44 cdr ............................................................................... 44 chr ............................................................................... 45 client_data_tile............................................................ 46 close ............................................................................ 46 command..................................................................... 47 cond............................................................................. 48 cons ............................................................................. 49 cos ............................................................................... 50 cvunit .......................................................................... 50 defun ........................................................................... 51 defun-q ........................................................................ 52 defun-q-list-ref ............................................................ 53 defun-q-list-set ............................................................ 54 dictadd ........................................................................ 55 dictnext ....................................................................... 56 dictremove ................................................................. 58 dictrename .................................................................. 58 dictsearch ................................................................... 59 iv |
  • 8. dimx_tile ..................................................................... 60 dimy_tile ..................................................................... 61 distance ....................................................................... 61 distof ........................................................................... 62 done_dialog................................................................. 63 end_image ................................................................... 63 end_list........................................................................ 64 entdel........................................................................... 64 entget........................................................................... 65 entlast .......................................................................... 66 entmake ....................................................................... 67 entmakex .................................................................... 68 entmod ........................................................................ 68 entnext......................................................................... 71 entsel ........................................................................... 71 entupd.......................................................................... 72 eq................................................................................. 73 equal............................................................................ 74 *error*......................................................................... 76 eval.............................................................................. 76 exit .............................................................................. 77 exp............................................................................... 77 expand ......................................................................... 78 expt.............................................................................. 79 fill_image .................................................................... 79 findfile......................................................................... 80 fix ................................................................................ 81 float ............................................................................. 82 foreach ........................................................................ 82 function ....................................................................... 83 gc................................................................................. 84 gcd............................................................................... 84 get_attr ........................................................................ 85 get_tile ........................................................................ 85 getangle ....................................................................... 85 getcfg .......................................................................... 86 getcname .................................................................... 87 | v
  • 9. getcorner ..................................................................... 88 getdist.......................................................................... 88 getenv.......................................................................... 89 getfiled ........................................................................ 90 getint ........................................................................... 92 getkword ..................................................................... 93 getorient ...................................................................... 94 getpoint ....................................................................... 95 getreal.......................................................................... 96 getstring ...................................................................... 97 getvar .......................................................................... 98 graphscr....................................................................... 98 grclear ......................................................................... 98 grdraw ......................................................................... 99 grread .......................................................................... 99 grtext ......................................................................... 102 grvecs ........................................................................ 103 handent...................................................................... 105 help ........................................................................... 105 if ................................................................................ 107 initdia ........................................................................ 107 initget ........................................................................ 108 inters.......................................................................... 111 itoa ............................................................................ 113 lambda....................................................................... 113 last ............................................................................. 114 layoutlist.................................................................... 114 length ........................................................................ 115 list.............................................................................. 115 listp............................................................................ 116 load............................................................................ 117 load_dialog................................................................ 118 log ............................................................................. 119 logand........................................................................ 119 logior ......................................................................... 120 lsh.............................................................................. 120 mapcar....................................................................... 121 vi |
  • 10. max............................................................................ 122 mem .......................................................................... 122 member ..................................................................... 124 menucmd................................................................... 124 menugroup ................................................................ 126 min ............................................................................ 126 minusp....................................................................... 127 mode_tile .................................................................. 127 namedobjdict............................................................. 128 nentsel ....................................................................... 128 nentselp ..................................................................... 130 new_dialog................................................................ 132 not ............................................................................. 132 nth ............................................................................. 133 null ............................................................................ 134 numberp .................................................................... 134 open........................................................................... 135 or ............................................................................... 136 osnap ......................................................................... 137 polar .......................................................................... 138 prin1 .......................................................................... 138 princ .......................................................................... 140 print ........................................................................... 140 progn ......................................................................... 141 prompt ....................................................................... 141 quit ............................................................................ 142 quote.......................................................................... 142 read............................................................................ 143 read-char ................................................................... 144 read-line .................................................................... 145 redraw ....................................................................... 145 regapp........................................................................ 146 rem ............................................................................ 147 repeat......................................................................... 148 reverse ....................................................................... 149 rtos ............................................................................ 149 set .............................................................................. 151 | vii
  • 11. set_tile ....................................................................... 152 setcfg ......................................................................... 152 setenv ........................................................................ 153 setfunhelp.................................................................. 153 setq ............................................................................ 155 setvar ......................................................................... 156 setview ..................................................................... 157 sin.............................................................................. 157 slide_image ............................................................... 158 snvalid ....................................................................... 159 sqrt ............................................................................ 161 ssadd.......................................................................... 161 ssdel .......................................................................... 163 ssget .......................................................................... 163 ssgetfirst ................................................................... 167 sslength ..................................................................... 167 ssmemb ..................................................................... 168 ssname....................................................................... 168 ssnamex .................................................................... 169 sssetfirst ................................................................... 172 startapp...................................................................... 174 start_dialog................................................................ 175 start_image................................................................ 175 start_list..................................................................... 176 strcase........................................................................ 176 strcat.......................................................................... 177 strlen.......................................................................... 178 subst .......................................................................... 178 substr ......................................................................... 179 tablet.......................................................................... 180 tblnext ....................................................................... 181 tblobjname ................................................................ 183 tblsearch .................................................................... 184 term_dialog ............................................................... 184 terpri.......................................................................... 185 textbox ...................................................................... 185 textpage ..................................................................... 186 viii |
  • 12. textscr........................................................................ 186 trace........................................................................... 186 trans........................................................................... 188 type............................................................................ 190 unload_dialog............................................................ 192 untrace....................................................................... 192 vector_image............................................................. 193 ver ............................................................................. 194 vl-acad-defun ............................................................ 195 vl-acad-undefun ........................................................ 195 vl-arx-import ............................................................. 195 vl-bb-ref .................................................................... 197 vl-bb-set .................................................................... 197 vl-catch-all-apply ...................................................... 198 vl-catch-all-error-message ........................................ 199 vl-catch-all-error-p.................................................... 200 vl-cmdf...................................................................... 200 vl-consp..................................................................... 202 vl-directory-files ....................................................... 203 vl-doc-export............................................................. 203 vl-doc-import ............................................................ 204 vl-doc-ref .................................................................. 205 vl-doc-set .................................................................. 205 vl-every .................................................................... 206 vl-exit-with-error ...................................................... 207 vl-exit-with-value...................................................... 208 vl-file-copy ............................................................... 209 vl-file-delete.............................................................. 210 vl-file-directory-p...................................................... 210 vl-file-rename ........................................................... 211 vl-file-size ................................................................. 212 vl-file-systime ........................................................... 212 vl-filename-base ....................................................... 213 vl-filename-directory ............................................... 214 vl-filename-extension ............................................... 214 vl-filename-mktemp.................................................. 215 vl-get-resource .......................................................... 216 | ix
  • 13. vl-list* ....................................................................... 217 vl-list-string ........................................................... 217 vl-list-exported-functions.......................................... 218 vl-list-length.............................................................. 219 vl-list-loaded-vlx....................................................... 219 vl-load-all.................................................................. 220 vl-load-com ............................................................... 221 vl-load-reactors ......................................................... 221 vl-member-if ............................................................. 222 vl-member-if-not....................................................... 223 vl-position ................................................................. 223 vl-prin1-to-string ...................................................... 224 vl-princ-to-string ...................................................... 225 vl-propagate .............................................................. 225 vl-registry-delete ....................................................... 226 vl-registry-descendents ............................................. 226 vl-registry-read.......................................................... 227 vl-registry-write ........................................................ 228 vl-remove ................................................................. 228 vl-remove-if ............................................................. 229 vl-remove-if-not........................................................ 230 vl-some ..................................................................... 230 vl-sort ........................................................................ 231 vl-sort-i...................................................................... 232 vl-string-list ........................................................... 233 vl-string-elt................................................................ 234 vl-string-left-trim ...................................................... 234 vl-string-mismatch .................................................... 235 vl-string-position....................................................... 236 vl-string-right-trim .................................................... 237 vl-string-search ......................................................... 237 vl-string-subst ........................................................... 238 vl-string-translate ...................................................... 239 vl-string-trim ............................................................. 239 vl-symbol-name ....................................................... 240 vl-symbol-value ....................................................... 241 vl-symbolp ................................................................ 241 x |
  • 14. vl-unload-vlx............................................................. 242 vl-vbaload ................................................................. 243 vl-vbarun ................................................................... 243 vl-vlx-loaded-p.......................................................... 244 vlax-3D-point............................................................ 244 vlax-add-cmd ............................................................ 245 vlax-create-object...................................................... 247 vlax-curve-getArea ................................................... 247 vlax-curve-getDistAtParam ...................................... 248 vlax-curve-getDistAtPoint ........................................ 249 vlax-curve-getEndParam .......................................... 250 vlax-curve-getEndPoint ............................................ 251 vlax-curve-getParamAtDist ...................................... 251 vlax-curve-getParamAtPoint .................................... 252 vlax-curve-getPointAtDist ........................................ 252 vlax-curve-getPointAtParam .................................... 253 vlax-curve-getStartParam ......................................... 254 vlax-curve-getStartPoint ........................................... 254 vlax-curve-isClosed .................................................. 255 vlax-curve-isPeriodic ............................................... 255 vlax-curve-isPlanar ................................................... 256 vlax-curve-getClosestPointTo .................................. 257 vlax-curve-getClosestPointToProjection .................. 258 vlax-curve-getFirstDeriv........................................... 258 vlax-curve-getSecondDeriv ...................................... 259 vlax-dump-object ...................................................... 260 vlax-ename-vla-object ........................................... 261 vlax-erased-p............................................................. 261 vlax-for...................................................................... 262 vlax-get-acad-object.................................................. 262 vlax-get-object .......................................................... 263 vlax-get-or-create-object........................................... 263 vlax-get-property ...................................................... 264 vlax-import-type-library ........................................... 265 vlax-invoke-method .................................................. 267 vlax-ldata-delete........................................................ 268 vlax-ldata-get ............................................................ 268 | xi
  • 15. vlax-ldata-list ............................................................ 271 vlax-ldata-put ............................................................ 271 vlax-ldata-test............................................................ 272 vlax-make-safearray.................................................. 273 vlax-make-variant ..................................................... 275 vlax-map-collection .................................................. 277 vlax-method-applicable-p ......................................... 278 vlax-object-released-p............................................... 279 vlax-product-key ....................................................... 280 vlax-property-available-p.......................................... 280 vlax-put-property ...................................................... 281 vlax-read-enabled-p .................................................. 282 vlax-release-object .................................................... 282 vlax-remove-cmd ..................................................... 282 vlax-safearray-fill...................................................... 283 vlax-safearray-get-dim.............................................. 285 vlax-safearray-get-element ....................................... 285 vlax-safearray-get-l-bound........................................ 286 vlax-safearray-get-u-bound....................................... 287 vlax-safearray-put-element ....................................... 288 vlax-safearray-type ................................................... 289 vlax-safearray-list ................................................... 290 vlax-tmatrix............................................................... 291 vlax-typeinfo-available-p.......................................... 292 vlax-variant-change-type .......................................... 293 vlax-variant-type ....................................................... 294 vlax-variant-value ..................................................... 296 vlax-vla-object-ename ............................................ 297 vlax-write-enabled-p ................................................. 297 vlisp-compile ............................................................ 297 vlr-acdb-reactor......................................................... 299 vlr-add ...................................................................... 300 vlr-added-p................................................................ 300 vlr-beep-reaction ....................................................... 301 vlr-command-reactor ............................................... 301 vlr-current-reaction-name ......................................... 302 vlr-data ...................................................................... 302 xii |
  • 16. vlr-data-set ................................................................ 303 vlr-deepclone-reactor ............................................... 304 vlr-docmanager-reactor ............................................ 305 vlr-dwg-reactor ........................................................ 307 vlr-dxf-reactor .......................................................... 309 vlr-editor-reactor ...................................................... 310 vlr-insert-reactor ...................................................... 313 vlr-linker-reactor ....................................................... 315 vlr-lisp-reactor ......................................................... 316 vlr-miscellaneous-reactor ......................................... 317 vlr-mouse-reactor ..................................................... 319 vlr-notification ......................................................... 320 vlr-object-reactor ..................................................... 320 vlr-owner-add............................................................ 323 vlr-owner-remove .................................................... 323 vlr-owners ................................................................. 324 vlr-pers ..................................................................... 324 vlr-pers-list ............................................................... 325 vlr-pers-p .................................................................. 325 vlr-pers-release ......................................................... 326 vlr-reaction-names ................................................... 326 vlr-reaction-set ......................................................... 327 vlr-reactions ............................................................. 328 vlr-reactors ................................................................ 328 vlr-remove ................................................................ 329 vlr-remove-all .......................................................... 330 vlr-set-notification ................................................... 331 vlr-sysvar-reactor ..................................................... 332 vlr-toolbar-reactor .................................................... 333 vlr-trace-reaction....................................................... 334 vlr-type ..................................................................... 335 vlr-types ................................................................... 336 vlr-undo-reactor ....................................................... 337 vlr-wblock-reactor ................................................... 339 vlr-window-reactor .................................................. 341 vlr-xref-reactor ......................................................... 343 vports ........................................................................ 349 | xiii
  • 17. wcmatch .................................................................... 350 while.......................................................................... 353 write-char .................................................................. 353 write-line ................................................................... 354 xdroom ...................................................................... 355 xdsize ........................................................................ 355 zerop.......................................................................... 356 A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 3dsin.......................................................................... 360 3dsout........................................................................ 361 align .......................................................................... 362 cal.............................................................................. 362 fog ............................................................................. 363 light ........................................................................... 363 lsedit.......................................................................... 372 lslib............................................................................ 373 lsnew ......................................................................... 377 matlib ........................................................................ 377 mirror3d .................................................................... 378 psdrag........................................................................ 379 psfill .......................................................................... 379 psin............................................................................ 380 render ....................................................................... 381 renderupdate.............................................................. 386 replay ....................................................................... 386 rmat ........................................................................... 387 rotate3d ..................................................................... 402 rpref .......................................................................... 403 saveimg ..................................................................... 406 scene ......................................................................... 407 setuv .......................................................................... 410 showmat ................................................................... 412 solprof ....................................................................... 413 stats .......................................................................... 413 xiv |
  • 19. AutoCAD AutoLISP !T '()*+ ,-.
  • 20. /012 !#$%'()*+ ,-.
  • 22.
  • 23. = /
  • 24. ?
  • 25. @AB$ (foo string [number ...]) DB$ CB$ EF
  • 28. !
  • 30. *
  • 31. + ,'-
  • 32. %
  • 33. ./) 01
  • 34. ,'-
  • 35. % 23 45678 9 Visual LISP :AutoLISP
  • 36. ;/% 16 | AutoLISP
  • 37. + 34
  • 38. (+ [number number] ...) number
  • 39. number 0
  • 40. ! number # 0 $% (+ 1 2) 3 (+ 1 2 3 4.5) 10.5 (+ 1 2 3 4.0) 10.0 – 345, -67
  • 41. 8 2 (– [number number] ...) number '
  • 42. number ()*# +, -,. /01
  • 43. 2 number 0 -
  • 44. 2 -number # 0 + | 17
  • 45. (- 50 40) 10 (- 50 40.0) 10.0 (- 50 40.0 2.5) 7.5 (- 8) -8 * 45
  • 46. 1 (* [number number] ...) number
  • 47. number 1 ! number # 0 (* 2 3) 6 (* 2 3.0) 6.0 (* 2 3 4.0) 24.0 (* 3 -4.5) -13.5 (* 3) 3 / 4$56( $,78 19 3 (/ [number number] ...) number $ number %' ( )*+$ $,(- ./0 1 /02.3 number $, 1 ! number # 0 18 | AutoLISP
  • 48. (/ 100 2) 50 (/ 100 2.0) 50.0 (/ 100 20.0 2) 2.5 (/ 100 20 2) 2 (/ 4) 4 = !#$% (= numstr [numstr] ...) numstr
  • 49. T
  • 50. nil
  • 51. T (= 4 4.0) T (= 20 388) nil (= 2.4 2.4 2.4) T (= 499 499 500) nil (= me me) T (= me you) nil eq equal /= !'#$% ' (/= numstr [numstr] ...) numstr = | 19
  • 52.
  • 53. T nil T /= !# LISP $%'()*+ , -./ 012 3
  • 54. 45 T6- AutoLISP 0,
  • 55. /= 7 T 89:;= = (/= 10 20) T (/= you you) nil (/= 5.43 5.44) T (/= 10 20 10 20 20) nil (/= 10 20 10 20) T -?@A=0BC./0
  • 57. J K /= L M N T XUGY T 3UGHVW T nil ( numstr [numstr] ...) numstr OPQRSO T 3UGHVW T nil T = ( 10 20) T ( b c) T ( 357 33.2) nil ( 2 3 88) T ( 2 3 4 4) nil 20 | AutoLISP
  • 58. = # $
  • 59. T nil (= numstr [numstr] ...) numstr
  • 60. T nil
  • 61. = T ! (= 10 20) T (= b b) T (= 357 33.2) nil (= 2 9 9) T (= 2 9 4 5) nil #$
  • 62. T nil ( numstr [numstr] ...) numstr
  • 63. T nil
  • 64. T ! ( 120 17) T ( c b) T ( 3.5 1792) nil ( 77 4 2) T ( 77 4 4) nil = | 21
  • 65. = ' +
  • 66. T
  • 67. nil (= numstr [numstr] ...) numstr
  • 68. T
  • 69. nil =
  • 70. T ! (= 120 17) T (= c c) T (= 3.5 1792) nil (= 77 4 4) T (= 77 4 9) nil ~ '$%+
  • 71. $%'( 1 )*+ (~ int) int #
  • 72. $%'( 1 )*+ ! (~ 3) -4 (~ 100) -101 (~ -4) 3 22 | AutoLISP
  • 73. 1+ 1 1 (1+ number) number 1
  • 74. (1+ 5) 6 (1+ -17.5) -16.5 1– 1 1 (1– number) number 1
  • 75. (1- 5) 4 (1- -17.5) -18.5 abs
  • 76. (abs number) 1+ | 23
  • 78. (abs 100) 100 (abs -100) 100 (abs -99.25) 99.25 acad_colordlg NHOP AutoCAD !+A #$ (acad_colordlg colornum [flag]) colornum 0–256 0 256 ! #$%!'( flag )*+ flag ,- nil./012/032456 7 flag 89,-: nil ;*/012/032 45 colornum - 0 =' BYBLOCK- 256 =' BYLAYER ?@+A!'()B?CD #$; nil EF'(GH?+AIJ!)BK+; L-%!M (acad_colordlg 3) acad_helpdlg QRSTUVWX (acad_helpdlg helpfile topic) 24 | AutoLISP
  • 79.
  • 80. help
  • 81. AutoCAD !
  • 82. #$% help acad_strlsort n ASCII H*ST)[*+,-BC() (acad _strlsort list) list '()
  • 83. *+,- ./0 ()1
  • 84. 23*+,-45 list 6789-:;=?
  • 85. @ABC ()acad_strlsort ./ nil DE FGHI6JKLM7N
  • 86. NO
  • 87. PQ*+,-R*ST)BC()U VWU(setq mos ’(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) VWU(acad_strlsort mos) (Apr Aug Dec Feb Jan Jul Jun Mar May Nov Oct Sep) action_tile ‰6[]`aX 67YZ-kltŠe[]K‹Kf7`aŒŽC YZ- kl (action_tile key action-expression) X
  • 88. YZI[]
  • 89. ^_YZ^_YZ new_dialog action_tile X : `a
  • 91. hiFj YZ-klm nopqr $value st`a
  • 93. value bcj opqr $key st` a
  • 96. |m n client_data_tile jopqr $reason st`a
  • 97. /€‚45 ` aƒ„R…
  • 98. †mnopqr $x $y st`a
  • 99. ƒ„‡ˆ acad_strlsort | 25
  • 100. key
  • 101. key action- ! # $% '( expression )* + action_tile , -./01 AutoLISP Command , 23% T 45 67 edit1 89:;=1?@A:;BCDE action_tile , 01- '(FG$%H (action_tile edit1 (setq ns $value)) I J Visual LISP - KLM%N DCL O add_list +Rno Cp ]-qb89erst- 89 (add_list string) +P1 add_list , QRSTU01 start_list , VWXYZ[] ^_ start_list , - operation .` string abcdR]-e fg] Rh string i 23% 67jk=23bcd]- lm=23 nil 26 | AutoLISP
  • 102. DCL
  • 103. longlist !# llist $%'
  • 104. ( (setq llist ’(first line second line third line)) (start_list longlist) (mapcar ’add_list llist) (end_list) )*'+,'-./ 01234 2nd line( (start_list longlist 1 0) (add_list 2nd line) (end_list) 567 start_list 8 end_list 9:( alert ;?
  • 105. ;C_?DE (alert string) 6: string ;=?
  • 106. 012( @AB nil =?
  • 107. ;CDEF (alert That function is not available.) GH= string 6:
  • 109. ;M/01F (alert That functionnis not available.) NO ?
  • 110. PQ; DE /:LRS/ TUVWXPIJ YZ[ 8]^( alert | 27
  • 111. alloc #$GHI!J expand ) KB (alloc n-alloc) n-alloc
  • 112. usubr Cons
  • 114. #$ % _$ (alloc 100) 1000 ' ( expand ) and ,-
  • 115. LMN (AND) OP4/ (and [expr ...]) expr *+,- ./*012,-
  • 116. 3 4/5 nil 6) 789:1;
  • 117. 3 nil = T./?@ AB and C T % DEF(setq a 103 b nil c string) string DEF(and 1.4 a c) T DEF(and 1.4 a b c) nil 28 | AutoLISP
  • 118. angle
  • 119. q rst34 UCS u X rsv (angle pt1 pt2) pt1 pt2
  • 120. X
  • 121. ! #$ %'( )*+,-./012./34 X 56 789(angle ’(1.0 1.0) ’(1.0 4.0)) 1.5708 789(angle ’(5.0 1.33) ’(2.4 1.33)) 3.14159 : ; Visual LISP =?@ angtof +wxEFG?
  • 122. y z{ |}B (angtof string [units]) string unit %ABCDEFG string HIJKL M angtof N OP% unit QRSTUVWXEF G string ABYZ 4 angtos N [$AB ]^Z J AutoCAD _`abcdAB units ef%EFGAB g h i4 AutoCAD jklm AUNITS _`h ni#$opg angle | 29
  • 123. AUNITS
  • 124. units 0 1 // 2 3 4 !# $% ' () * $%+,- ./ 01$% nil angtof 2 angtos 3+456 angtos 78 +,9:; = angtof ?@ angtof ABC$%+,DE FGHIJ K unit LMN OP QR(angtof 45.0000) 0.785398 QR(angtof 45.0000 3) 1.0177 S T angtos angtos +,U# X YZ(9:; (angtos angle [unit [precision]]) angle U#VWX - 30 | AutoLISP
  • 125. unit
  • 126. unit AUNITS units 0 !#$ 1 /%/ 2 '% 3 ( 4 )* precision + ,-. /0 1
  • 127. 2 AUPREC angtos 34 mode5precision 6 AutoCAD UNITMODE 789: ; DIMZIN = angle ?@ABCDEF,- angtos GHI angle JKLMNOP ?@QRSTA 0 U 2π ( QV W
  • 128. XY)* unit 4$ UNITMODE Z[ ,- ]
  • 129. BCD
  • 131. BCD^Z_`ab c N 45d E$ def
  • 134. iAjK,-klBCDmn,- nil oc pq(angtos 0.785398 0 4) 45.0000 pq(angtos -0.785398 0 4) 315.0000 pq(angtos -0.785398 4) S 45d E r angtos stuvr w ANGBASE hex $ yz {y2|}6~ ANGBASE € angtof Visual LISP ^ ‚BCD?@ƒ angtos | 31
  • 136. 4 (append [list ...]) list
  • 137. nil (append ’(a b) ’(c d)) (A B C D) (append ’((a)(b)) ’((c)(d))) ((A) (B) (C) (D)) apply 0 5678 (apply ’function list) ’function ! defun # lambda $%' list () *+ , nil -./ (apply ’+ ’(1 2 3)) 6 (apply ’strcat ’(a b c)) abc 32 | AutoLISP
  • 138. arx hdCD% ObjectARX (arx) ObjectARX
  • 139. (arx) (acadapp.arx acmted.arx oleaprot.arx) arxload arxunload arxload CD ObjectARX (arxload application [onfailure]) application !!#$%'()*+,-
  • 140. %./+ 012
  • 141. %34 .arx 5678 ObjectARX +,-
  • 142. %9 :;
  • 143. = AutoCAD ?@
  • 144. AB onfailure CDEFGH,-% IJ KLMNO KLMNP78Q onfailure % RO S %TUVW KLXYCDZ[]CD% ObjectARX arxload ^_`ZaTUV Wb arxload CDZ[ cd +0e arx fgCD% ARX arx | 33
  • 146. geomcal.arx (arxload c:/program files/ACAD2000/geomcal.arx) c:/program files/acad2000/geomcal.arx arxunload arxunload 1 ObjectARX ABC (arxunload application [onfailure]) application
  • 148. $% '
  • 150. .arx ./0 onfailure 1 2345%
  • 151. 678 9:; =?@9:ABC'=D?EFGHI onfailure E9:J
  • 153. MNOP QRDS1 TU
  • 156. ]^_`ab ASCII c.9: (ascii string) string [ 34 | AutoLISP
  • 157. (ascii A) 65 (ascii a) 97 (ascii BIG) 66 assoc # $%! (assoc element alist)
  • 158. element alist ! nil (setq al ’((name box) (width 3) (size 4.7263) (depth 5))) ((NAME BOX) (WIDTH 3) (SIZE 4.7263) (DEPTH 5)) (assoc ’size al) (SIZE 4.7263) (assoc ’weight al) nil atan $% '() *+,-./01 (atan num1 [num2]) assoc | 35
  • 159. num1 num2
  • 160. num1 num1
  • 161. num1 num2 num1/num2 num2 0 ! 1.570796 #+90 ! -90 $% '( num1 )*+, −π/2 - +π/2 #$ ./ 012(atan 1) 0.785398 012(atan 1.0) 0.785398 012(atan 0.5) 0.463648 012(atan 1.0) 0.785398 012(atan -1.0) -0.785398 012(atan 2.0 3.0) 0.588003 012(atan 2.0 -3.0) 2.55359 012(atan 1.0 0.0) 1.5708 atof :7894;6 (atof string) string 3456 789 6 36 | AutoLISP
  • 162. (atof 97.1) 97.1 (atof 3) 3.0 (atof 3.9) 3.9 atoi 789 :
  • 163. (atoi string) string
  • 164. (atoi 97) 97 (atoi 3) 3 (atoi 3.9) 3 itoa atom ;89==! (atom item) item AutoLISP LISP atom !# $%'()*+,-./0 1234 5+6 atoi | 37
  • 165. item
  • 166. nil
  • 167. T
  • 168. (setq a ’(x y z)) (X Y Z) (setq b ’a) A (atom ’a) T (atom a) nil (atom ’b) T (atom b) T (atom ’(a b c)) nil atoms-family ?78@'9)*ABCD (atoms-family format [symlist]) format
  • 169. 0 ! 1 #$%' atoms-family ( )*+ ,- 0 . /- )*+ 1 .0)1 /- )*+ symlist $%'$2345)*+0)1 )* '6 symlist atoms-family 78'9')* :;= '9)* nil 38 | AutoLISP
  • 170. (atoms-family 0) (BNS_PRE_SEL FITSTR2LEN C:AI_SPHERE ALERT DEFUN C:BEXTEND REM_GROUP B_RESTORE_SYSVARS BNS_CMD_EXIT LISPED FNSPLITL...
  • 172. (atoms-family 1 ’(CAR CDR XYZ)) (CAR CDR nil) ! #
  • 173. $
  • 174. XYZ %' autoarxload fg45670FG ObjectARX 9:;# (autoarxload filename cmdlist) ()*+,- cmdlist ./#0* 1234567 filename ./8 # ObjectARX 9:;=?,- ' @A*%(8BCD# E filename FGH3AutoCAD (IJ K LMN*OPQRST:U' ./ filename 8( VN IJ cmdlist ./D#0 LW6 7# .arx BC#
  • 175. '@AXYZ[3AutoCAD (] ^BC_`Z[DabKBC' cmdlist
  • 176. ' c nil d C:APP1C:APP2 C:APP3 e/67 bonusapp.arx BC (autoarxload BONUSAPP ’(APP1 APP2 APP3)) autoarxload | 39
  • 178. 5 (autoload filename cmdlist) cmdlist
  • 180. AutoLISP ! filename #$% cmdlist '
  • 181. ()
  • 183. ,-.!/012345AutoCAD 6 7*+8934':;*+! cmdlist ,-.=! ?@ nil /0 AB *+'
  • 184. C filename DEFAutoCAD % (G# HIJKLMNO! PQ #$% APP1RAPP2 S APP3 (T AutoLISP bounsapp.lspU (autoload BONUSAPP ’(APP1 APP2 APP3)) Boole d e
  • 185. fghijkb (Boole operator int1 [int2 ...]) operator 0 V 15 W
  • 186. X Y= 16 Z[
  • 187. ]^_`ab ! 40 | AutoLISP
  • 188. int1, int2... Boole
  • 190. ,- UV ! Int1 Int2 EF# 0 0 8 0 1 4 1 0 2 1 1 1 int1 .
  • 192. 9 :; # = 0 ? 1@ABC !7@
  • 194. KL#M 1 NOL#M 0 operator 8PA QRCSTUV:; AND$/( OR$?( XOR$X?( NOT W W $Y( Boole # :; :; #M 1 ]^ 1 AND _`ab#cM 1 6 XOR _`ab#de
  • 195. `M 1 7 OR e
  • 196. `?_`ab#M 1 8 NOR _`ab#cM 0$1fg( Z[ Boole | 41
  • 197. 12
  • 198. 5 (AND) (Boole 1 12 5) 4 6
  • 199. 5 (XOR) (Boole 6 6 5) 3 operator ! #$% '() *+*, operator - 4+./0#1 int2 23 1+4 int1 5623 0 7+8,293 1+:; (Boole 4 3 14) 12 boundp ]^=-WABC3_J (boundp sym) sym =) ? *, sym @ABC3D nil +EF? T)*,#BC sym GABC 3 nil+HF? nil)*, sym -IJKLM =+NOPQRG+STB 3 nil) (setq a 2 b nil) nil (boundp ’a) T (boundp ’b) nil U atoms-family F VLIJ= -WX1+YGZOPQRE=) [ atoms-family F) 42 | AutoLISP
  • 200. caddr ! (caddr list) AutoLISP caddr
  • 201. Z list ! list #$%' () * ! nil +, -./(setq pt3 ’(5.25 1.0 3.0)) (5.25 1.0 3.0) -./(caddr pt3) 3.0 -./(caddr ’(5.25 1.0)) nil 01 Visual LISP 23 cadr !4 (cadr list) AutoLISP cadr
  • 202. 4' Y 5' 4 list ! list 4#$%' 678* ! nil caddr | 43
  • 203. (setq pt2 ’(5.25 1.0)) (5.25 1.0) (cadr pt2) 1.0 (cadr ’(4.0)) nil (cadr ’(5.25 1.0 3.0)) 1.0 Visual LISP
  • 204. car (car list) list list nil (car ’(a b c)) A (car ’((a b) c)) (A B) (car ’()) nil Visual LISP
  • 205. cdr ! (cdr list) 44 | AutoLISP
  • 206. list list
  • 207. ! # $% ' nil ( list )*+ ,cdr *+ -
  • 208. ./)0 12 3 4 567(cdr ’(a b c)) (B C) 567(cdr ’((a b) c)) (C) 567(cdr ’()) nil 567(cdr ’(a . b)) B 567(cdr ’(1 . Text)) Text Visual LISP 8* chr IJ ? ASCII =9 KLM;NOP??@ (chr integer) list 9 : ; ASCII =$ integer ??@ #9 /A 1-255 BCD E#/FGH 4 567(chr 65) A chr | 45
  • 209. (chr 66) B (chr 97) a client_data_tile dh iBCjkl mHn (client_data_tile key clientdata) key
  • 210. clientdata key !
  • 211. #$%'( )*+, $data -./ 01 nil close HIBCP345 (close file-desc) file-desc 2 open ( 345 6785 9: 01 ; file-desc =close ( 0 nil ?@A0BCDEFG close ( HI5 JK5 9:LM=N-OPQR=2SHI 5 TUVWXP345 LM=YZ[5 ]^ _`ab)785 somefile.tx c Lde1fg-. ct 46 | AutoLISP
  • 212. (setq fil SOMEFILE.TXT) (setq x (open fil r) ct 0) (while (read-line x) (setq ct (1+ ct)) ) (close x) command † AutoCAD (command [arguments] ...) arguments AutoCAD
  • 213. command ! #
  • 214. $ () %' (') ENTER '
  • 215. *+ ,- command ./0') ESC '123456 AutoCAD
  • 216. command 789 :;= AutoCAD ?@%
  • 217. AB@ C DE FG9 HI B@CJKFL9 HI B@CLK
  • 218. MNO @%P AutoCAD QRST D
  • 219. UVWX Visual LISP YZ- command []*^_`a AutoCAD Y
  • 220. WX b-cd)eO[fghYiajklX (nil) AutoCAD 7mnd)opqr AutoCAD ]?@%
  • 221. O12s tuvwx y^z{
  • 222. jk| nil 2} P}~7€ pt1 E pt2 T‚ƒ (1,1) E (1,5)„w,- command LINE ]71G9|= AutoCAD
  • 223. …(setq pt1 ’(1 1) pt2 ’(1 5)) (1 5) command | 47
  • 224. (command line pt1 pt2 ) nil
  • 225. AutoCAD SKETCH !# AutoLISP command $%'()* +,-#$%' SCRIPT ./0123 #4 AutoLISP 5678+ 9:,-# acad.lsp ; MNL =%' command $?# defun @AB %C'+D' S::STARTUP $ E#FGHIJKLMNOPQRSK + TUQRVNW *TX AutoCAD Y, BREAK TRIM Z [] ^ *' entsel $_`@abcdefLgW *TXhVN ( ijkl[ m Visual LISP %nop qr AutoCAD s+ ,-tuvw CMDECHO Y[xy setvar getvar $zZ{|g 0xy command $OP o!}# P%~+ € m  % vl-cmdf $ Visual LISP %n ]cs+ cond —˜=™—’“‘-$ (cond [(test result ...) ...]) cond $ [gH‚@+.ƒ„6T… *@ †‡ˆ ‰%Š ‹Œ‡!1 nil g+4$ŽT48‰@AB†‡+ ‹Œ‡ {OP‘-’“@AB%78 *@AB‡+,-l@%?” *@AB Y• result !z#Z‹Œ test ‡+,-– cond ‹Œ nil+ 48 | AutoLISP
  • 226. cond
  • 227. (cond ((minusp a) (- a)) (t a) ) –10 10 cond case ! #$% T '(#)*+,- test ./01 2#)34 5 s 567 8 9:; = ? @AB?= s 8 Y C y DE 1 s 8 N C n DE 0F DE nil (cond ((= s Y) 1) ((= s y) 1) ((= s N) 0) ((= s n) 0) (t nil) ) cons _. `aIJ#)NOCbc#) (cons new-first-element list-or-atom) G new-first- HIJK.LM NO?NOPQC. element list-or-atom .CPQ DE DER list-or-atom S!TU list-or-atom . cons DE.V @ new-first-element DE.5 W#X list-or-atom PQ cons D EYZ new-first-element [ list-or-atom ]^(cons ’a ’(b c d)) (A B C D) ]^(cons ’(a) ’(b c d)) ((A) B C D) cons | 49
  • 228. (cons ’a 2) (A . 2) Visual LISP
  • 229. cos (cos ang) ang ang (cos 0.0) 1.0 (cos pi) -1.0 cvunit 89:;+,=?@ ! (cvunit value from-unit to-unit) value ! #$%%# from-unit value '()* +, to-unit value -)* +, from-unit . to-unit /01 acad.unt 23 45+,67 50 | AutoLISP
  • 230.
  • 231. acad.unt ! #$ nil %! '((cvunit 1 minute second) 60.0 '((cvunit 1 gallon furlong) nil '((cvunit 1.0 inch cm) 2.54 '((cvunit 1.0 acre sq yard) 4840.0 '((cvunit ’(1.0 2.5) ft in) (12.0 30.0) '((cvunit ’(1 2 3) ft in) (12.0 24.0 36.0) )* +,-% ./ 01 2,3 4 1.0 5
  • 232. 67 89 :4; =?!@A BCDEFGHI.JKLMNO PQRS TUQF @9MN +VW0XYZ [] Visual LISP ^ _ defun ST:4 (defun sym ([arguments] [/ variables...]) expr...) 4 sym :4` arguments :4a+ b/4` / variables :4cd 0efghZ` fghZ`ij kl#m0fg`ino ,Wpkl #q
  • 233. 04 rno Ustuvwx0 yz {| defun | 51
  • 234. expr
  • 235. AutoLISP !#$%'( )*+,- !AutoLISP %./012 !3456 7 ! 89: ;= : ?@ A BCD EF sym :GHIJKL *MNOC D PQ% RSCD TU*M V W% atoms- family HX (defun myfunc (x y) ...) (defun myfunc (/ a b) ...)
  • 236. (defun myfunc (x / temp) ...)
  • 238. W Y Visual LISP Z [T ]^ defun-q B *MF (defun-q sym ([arguments] [/ variables...]) expr...) _``1abcdef AutoLISP ghi j3kD AlE defun-q 67mn op*MF qr st% defun-qGu%v bcdwxy AutoLISP efZ defun z2v/O sym a{ arguments Zn | 52 | AutoLISP
  • 240. !# $%'()*+, -. /0 expr 12 3412 56 7 AutoLISP 89: !;=5? @AB# '( -CA !DEFGH @AAutoLISP IJ KLMN O PQR ST 89: R UV _$ (defun-q my-startup (x) (print (list x))) MY-STARTUP _$ (my-startup 5) (5) (5) defun-q-list-ref WX my-startup 8YZ[ _$ (defun-q-list-ref ’my-startup) ((X) (PRINT (LIST X))) ] defun-q-list-ref defun-q-list-set defun-q-list-ref PQ defun-q E` 8YZ (defun-q-list-ref ’function ) function ^_ @A PQR 8E`a: ! bcE`d8BPQ nil UV defun-q E` [ defun-q-list-ref | 53
  • 241. _$ (defun-q my-startup (x) (print (list x))) MY-STARTUP defun-q-list-ref my-startup
  • 242. _$ (defun-q-list-ref ’my-startup) ((X) (PRINT (LIST X))) defun-q defun-q-list-set defun-q-list-set @CD3E F$% (defun-q-list-set ’sym list) sym list ! #$% sym ' _$ (defun-q-list-set ’foo ’((x) x)) FOO _$ (foo 3) 3 () '*+,- defun-q-list-set ./012340567 8 Visual LISP 9:;= defun-q $%/0
  • 243. _$ (defun-q s::startup (x) (print x)) S::STARTUP $ (defun-q my-startup (x) (print (list x))) MY-STARTUP ? defun-q-list-set @AB12340
  • 244. _$ (defun-q-list-set ’s::startup (append (defun-q-list-ref ’s::startup) (cdr (defun-q-list-ref ’my-startup)))) S::STARTUP 54 | AutoLISP
  • 245.
  • 246. defun-q-list-set _$ (defun-q foo (x) (print (list ’foo x))) FOO _$ (foo 1) (FOO 1) (FOO 1) _$ (defun-q bar (x) (print (list ’bar x))) BAR _$ (bar 2) (BAR 2) (BAR 2) _$ (defun-q-list-set ’foo (append (defun-q-list-ref ’foo) (cdr (defun-q-list-ref ’bar)) )) FOO _$ (foo 3) (FOO 3) (BAR 3) (BAR 3) defun-q defun-q-list-ref dictadd D[%]!;=#$ (dictadd ename symbol newobj) ename !#$%'( symbol !)%*#$+,-symbol ./012'(3 456%*78+,%9: newobj !)%*;=#$ 2?@AB!)%*#$C./ 12DEF%!F#$ GHIJ KL BMN4O+,-P!O2F#$QRSF' (9: dictnext TUV WXY !)%*#$Z' dictadd | 55
  • 247.
  • 248. (setq dictionary (list ’(0 . DICTIONARY) ’(100 . AcDbDictionary))) ((0 . DICTIONARY) (100 . AcDbDictionary)) ! entmakex # (setq xname (entmakex dictionary)) $%1d98950 (setq newdict (dictadd (namedobjdict) MY_WAY_COOL_DICTIONARY xname)) $%1d98950 Xrecord (setq datalist (append (list ’(0 . XRECORD) ’(100 . AcDbXrecord)) ’((1 . This is my data) (10 1. 2. 3.) (70 . 33)))) ((0 . XRECORD) (100 . AcDbXrecord) (1 . This is my data) (10 1.0 2.0 3.0) (70 . 33)) '( Xrecord (setq xname (entmakex datalist)) $%1d98958 Xrecord (dictadd newdict DATA_RECORD_1 xname) $%1d98958 ) * dictnext+dictremove+dictrename+dictsearch , namedobjdict # dictnext ./0 12 (dictnext ename [rewind]) # ename - 56 | AutoLISP
  • 249. rewind nil
  • 250. !
  • 251. #$%
  • 253. dictsearch !56 78 namedobjdict 9:;=
  • 258. . nolmp Xrecord 0qr str(setq xname (entmakex datalist)) ?@r1b62d60 I Xrecord 0qu
  • 259. vwxyz%
  • 261. ?@r str(cdr (car (dictnext newdict))) ?@r1bac958 dictnext yz%
  • 262. ?@A
  • 263. ?@r str(cdr (car (dictnext newdict))) ?@r1bac960 dictnext yz%
  • 264. v?@A
  • 265. ?@r str(cdr (car (dictnext newdict))) nil
  • 266. {|}~ j) dictnext nil dictnext | 57
  • 267.
  • 268. (cdr (car (dictnext newdict T))) 1bac958 T rewind dictnext
  • 269. ! # dictadd$dictremove$dictrename$dictsearch % namedobjdict ! dictremove , -.
  • 271. 012,34 -.!2,34 -.567 entdel !89:; =?@A%BCDE!FGHIJK LMNO34% PQRS HDTKFGUV7 dictremove W, -./
  • 273. ! ename [] ^! symbol N, ename -.
  • 274. ! 9 BCDE_[34 BC`7Xdictremove 0K2,B CDE -.! a-
  • 275. !bc ename defghij symboldictremove nil! D= +k D=-.U dictadd D= lm (dictremove (namedobjdict) my_way_cool_dictionary) 1d98950 # dictadd$dictnext$dictrename$dictsearch % namedobjdict ! dictrename n
  • 276. (dictrename ename oldsym newsym) 58 | AutoLISP
  • 277. ename oldsym
  • 278. newsym
  • 279. newsym oldname !#ename $% newname $% '( newnamedictrename ) * nil +, -. +, dictadd +, /0 1 21(dictrename (namedobjdict) my_way_cool_dictionary An even cooler dictionary) An even cooler dictionary 3 4 dictadd#dictnext#dictremove#dictsearch 5 namedobjdict ) dictsearch 67= (dictsearch ename symbol [setnext]) ename 67 symbol 89:; 67
  • 280. dictsearch | 59
  • 281. setnext nil
  • 282. dictnext dictnext dictsearch ! # $% '()*+ nil +, -+,./ 0 dictsearch 12 dictadd +,345678 9:8(setq newdictlist (dictsearch (namedobjdict) my_way_cool_dictionary)) ((-1 . ;=81d98950) (0 . DICTIONARY) (5 . 52) (102 . {ACAD_REACTORS) (330 . ;=81d98860) (102 . }) (330 . ;=81d98860) (100 . AcDbDictionary) (280 . 0) (281 . 1) (3 . DATA_RECORD_1) (350 . ;=81d98958)) ? dictadd@dictnext@dictremove A namedobjdict dimx_tile HIQR (dimx_tile key) key BCD $%EFGHIJK= key LMNOP ! HIQR ST!U$%HIVWXYN! Z[HIST!U 0 ]^_ V `a X UbQR ST!cdN[ X-1 dimx_tile A dimy_tile ef vector_image@fill_image A slide_image gh iE$ %HINOjkST +, (setq tile_width (dimx_tile my_tile)) 60 | AutoLISP
  • 285. key
  • 286. !
  • 287. #$%
  • 288. 0 '()*
  • 289. + ,- Y . /0
  • 290. 12% Y-1dimx_tile 3 dimy_tile 0 456 vector_image7fill_image 3 slide_image 0 89:; = ?@A0 BC D
  • 291. EF GH (setq tile_height (dimy_tile my_tile)) distance VUMij
  • 292. OP (distance pt1 pt2) pt1 IJKLJMN pt1 IJKLJMN OP QRBC
  • 294. YZLJM
  • 296. Mij
  • 297. IJOP dimy_tile | 61
  • 298. (distance ’(1.0 2.5 3.0) ’(7.7 2.5 3.0)) 6.7 (distance ’(1.0 2.0 0.5) ’(3.0 4.0 0.5)) 2.82843 Visual LISP
  • 299. distof 'de.‚ƒ378956q' (distof string [mode]) distof rtos rtos ! #$ distof%distof '() %*+,-./0 mode 123 string 456789: ;= mode 0?@A distof BCDEFGHIJKLMNO rtos 789P( 12QR%SMN AutoCAD TUVWXYZR mode 789[ZR?@%K O AutoCAD ]^_` LUNITS TUa 1%ba cd[e 1 fg 2 h 3 ij.klhkm3 4 no.klIkm3 5 I p!qr%s%ts nil uv distof wRxy 3 wRxy 4 2z{|% mode 3 .i j3} 4 .no3?@%~ string €ZR+%s distof BC 62 | AutoLISP
  • 300. done_dialog #p9:; (done_dialog [status]) status start_dialog