Free AutoLISP Course

download Free AutoLISP Course

of 42

Transcript of Free AutoLISP Course

  • 8/6/2019 Free AutoLISP Course

    1/42

    AutoLISP Course

    Jos van Doorn 2003 1

    By Jos van Doorn. AutoCAD specialist and AutoLISP programmer.

    Also publisher ACAD Newsletter. About AutoCAD and AutoLISP.

    FREE. To subscribe send an e-mail to:

    mailto:[email protected]

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    2/42

    AutoLISP Course

    Jos van Doorn 2003 2

    Overview

    Overview....................................................2Introduction................................................3Lesson 01: About AutoLISP...................................5Lesson 02: Entities.........................................7Lesson 03: Setting Values...................................9Lesson 04: Arithmetic Functions 1..........................12Lesson 05: Arithmetic Functions 2..........................16Lesson 06: Arithmetic Functions 3..........................18Lesson 07: Creating Drawings 1.............................22Lesson 08: Creating Drawing 2..............................26Lesson 09: Getting Information 1...........................30Lesson 10: Getting Information 2...........................33Answers....................................................36What next?.................................................40ACAD Newsletter............................................42

  • 8/6/2019 Free AutoLISP Course

    3/42

    AutoLISP Course

    Jos van Doorn 2003 3

    Introduction

    Thanks for requesting the AutoLISP course. After reading and

    studying this course you will be able to write your own Auto-

    LISP routine.

    AutoLISP is a very powerful feature of AutoCAD. In AutoLISP

    you can write your own routines that can be used for creating

    AutoCAD drawings.

    That's what you will see. AutoLISP is very fast. Using an

    AutoLISP routine an AutoCAD drawing is created in less than

    one second.

    You want to learn programming in AutoLISP. That's why you are

    doing this course. I think that's a very wise decision. That

    will help you a lot.

    You know how it is. You're working with AutoCAD. All the timeyou've got these repetitive tasks. Don't do them by hand. Use

    an AutoLISP routine.

    I mentioned it before. AutoLISP is very powerful. Anything

    you can do in AutoCAD can be done using an AutoLISP routine.

    Anything!

    You can use AutoLISP routines to create parts of an AutoCAD

    drawing. But you can also use it to create a complete AutoCAD

    drawing.

    To create an AutoCAD drawing by hand takes hours. Sometimes

    it takes days. An AutoLISP routine can do the job within onesecond. That's a time saver.

    This course will help you to get started with programming in

    AutoLISP. In every lesson is an exercise. The exercise is

    about what has been explained in the lesson.

    Maybe you've got a problem. If so come to me. Ask me what's

    bordering you. Or what you cannot solve. And I'll give you an

    answer.

    You can send me an e-mail. Write "Problem" in the subject

    line. Then I can see where your e-mail is about. This is my

    e-mail address:

    mailto:[email protected]

    Steal this e-book

    Easy. Give this e-book away to other people that areinter-

    ested in AutoLISP programming. Or send it to them by e-mail.

    Or put it on your web site.

    One thing. This e-book is a no cost e-book. It cannot be

    sold. It can only be given away. Because Im giving it away.

    At no cost.

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    4/42

    AutoLISP Course

    Jos van Doorn 2003 4

    Have a good course.

    Jos van Doorn. AutoCAD specialist and AutoLISP programmer.

    Also publisher ACAD Newsletter. About AutoCAD and AutoLISP.

    FREE. To subscribe send an e-mail to:

    mailto:[email protected]

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    5/42

    AutoLISP Course

    Jos van Doorn 2003 5

    Lesson 01: About AutoLISP

    AutoLISP is one of the dialects of the programminglanguage

    LISP. LISP has been developed by John McCarthyin the fif-

    ties.

    LISP was the second higher programming language afterFOR-

    TRAN. I was never really popular. That changed inthe eight-

    ies.

    LISP is short for LIst PRogramming or LIst PRocessing.But

    they say it is also short for "Lots of StupidParentheses".

    AutoLISP is a programming language that is interpreted.Auto-

    LISP is not compiled. The advantage is thatmistakes can eas-

    ily be detected.

    Why wait for hours or even days? Get your AutoCADdrawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    A further explanation of AutoLISP will be given later.But

    let's start with an example of how AutoLISP can beused when

    drawing in AutoCAD.

    Suppose we want to insert a block. And the block musthave a

    scale of three divided by seven. You cancalculate that num-

    ber or use AutoLISP.

    This is how you can do it:

    For the x-scale (/ 3.0 7) is entered at the prompt.That

    means three divided by seven. AutoLISP makes thecalculation

    and comes with 0.428571.

    This is a feature of AutoLISP you can use right away.But

    there is more to do than division. Here's anoverview of

    other arithmetic functions:

    Action Function

    Addition (+

  • 8/6/2019 Free AutoLISP Course

    6/42

    AutoLISP Course

    Jos van Doorn 2003 6

    Exercise

    I want you to make a calculation in AutoCAD. You're afarmer

    and you've got 96 cows. You are giving them awayto eight

    people.

  • 8/6/2019 Free AutoLISP Course

    7/42

    AutoLISP Course

    Jos van Doorn 2003 7

    Lesson 02: Entities

    In AutoLISP we work with entities. The names of theseenti-

    ties are:

    Atom Description

    Atoms Elements consisting of one or morenumbers and

    characters. Examples are:ABC, 123, A1, P6, etc.

    In the examplesthe atoms have a value. If the

    atom hasno value then the value is nil

    Lists A number of elements placed betweenbrackets. The

    elements can be atoms orother lists. Examples:

    (A B C), (1 2 (34) 5).

    A list can also contain noelements. Then it is

    represented as ()or nil

    Functions Functions are the bread and butter ofAutoLISP.

    We'll use functions all thetime. We already have

    used a function. Remember the use of (/ 3.0 7) in

    theprevious lesson?

    This is an explanation:

    Atom Type

    (/ 3.0 7) List

    / Function

    3.0 Real Number

    7 Integer

    /, 3.0, and 7 Atoms

    The function always comes directlybehind the opening

    bracket.

    Later all AutoLISP functions will beexplained

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    An atom can be:

    Atom DescriptionSymbol A symbol is used to store values in

    it. The name of the symbol can be

    made up. But the longer the name the

    more memory is used

    String A string is a text placed between

    quotation marks. Examples of texts

    are:

    "This is a text" "Anyone in for

    AutoLISP"

    Real or float Reals or floats have a decimal part.

    Examples are:

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    8/42

    AutoLISP Course

    Jos van Doorn 2003 8

    3.4256

    1.5

    Atom DescriptionInteger Integers are numbers without a deci-

    mal part. Examples are:

    3

    56

    Subrs These are built-in function. Auto-

    LISP has a number of built-in func-

    tions. You don't really want to know

    these functions. You don't need to

    know these functions

    File descriptor A file descriptor is given to every

    external file AutoLISP works with.

    This is an example of a file de-scriptor:

    AutoCAD entity name Every element that is placed in an

    AutoCAD drawing gets an entity name.

    That's done automatically. This is

    an example of such a name:

    AutoCAD selection set A selection set is created by Auto-

    CAD when the Select objects prompt

    appears. This is how it may look:

    Exercise

    What's the type?

    1. 32. 1.233. (1 2 3)4. /5. 6.

  • 8/6/2019 Free AutoLISP Course

    9/42

    AutoLISP Course

    Jos van Doorn 2003 9

    Lesson 03: Setting Values

    We're now going to talk about one function we'll use alot in

    AutoLISP and two more functions. The functionsare:

    SETQ

    EVAL

    QUOTE

    Let's start with the SETQ function. We have a symboland now

    we want to store a value in that symbol. Let'ssay we have

    the symbol NR.

    The symbol is a number. And we want to store the number56 in

    that symbol. This is how we do it:

    Type this at the command line of AutoCAD. Press the Enter key

    when done. What do we see? The number 56 isdisplayed at the

    command prompt.

    What is displayed at the command prompt is what's givenback

    by the function. In this case 56 is given back bythe func-

    tion.

    The number 56 is stored in the symbol NR. We can seethat

    that number is stored in the symbol. Type !nr atthe command

    prompt.

    When that's done the value of the symbol is displayed.The

    number 56 is displayed at the prompt. That's thenumber we

    stored in the symbol.

    There is something special we can do with the SETQfunction.

    We can shorten the use of the SETQ functionsignificantly.

    Suppose we want to assign values to three differentvari-

    ables. One way of doing that is if you do it likethis:

    Here's the shorter way:

    Now the name of the SETQ function is used only once.And

    there is only one opening bracket and one closingbracket.

    But there is more.

    A lot have spaces have been added to the second listing. And

    also carriage returns have been added. Those spaces and car-

    riage returns make no difference for AutoLISP.

  • 8/6/2019 Free AutoLISP Course

    10/42

    AutoLISP Course

    Jos van Doorn 2003 10

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    This is a nice option. Suppose you want to draw acircle with

    a radius of 56. You stored 56 in the symbolNR. This is how

    you do it:

    At the second prompt you enter !nr. The value that hasbeen

    stored in the NR symbol will be used. A circlewith a radius

    of 56 is drawn.

    Watch out with naming symbols. Don't use names offunctionsfor a symbol name. So you cannot say:

    With the EVAL function the value of a symbol can bechecked.

    It works the same as placing an exclamationmark before the

    symbol name.

    We have stored 56 in the symbol NR. Now type (eval nr)at the

    command prompt. What do we get? We'll get 56.That the value

    stored in the symbol.

    The QUOTE function doesn't evaluate a symbol. You canuse itwith a symbol name. The symbol name is thenwritten out in

    capitals.

    See for yourself. Type (quote nr) at the commandprompt.

    Press the Enter button. And NR is displayed atthe prompt.

    Not the value.

    We've talked about three functions. And what have weseen?

    This is very important. Each function givessomething back. A

    function always gives something back.

    The SETQ function gives a value back. It gives back thevalue

    that is stored. The EVAL function gives back avalue. And theQuote function a name.

    Let's use this feature now in a proper and a more orless so-

    phisticated AutoLISP way. We have used functionsin a list.

    We're going to do it more.

    We've used (/ 3.0 7). But also (/ 3.0 (setq nr 7))can be

    used. If we do a couple of things happen. I'lltell. Try to

    find out why.

    Go ahead. Type (/ 3.0 (setq nr 7)) at the commandprompt and

    press the Enter key. On the next line thenumber 0.428571 is

    written.

    mailto:acadconsult@send
  • 8/6/2019 Free AutoLISP Course

    11/42

    AutoLISP Course

    Jos van Doorn 2003 11

    That number is given back by the division function. Butmore

    has happened. The number 7 is stored in the symbolNR. See

    for yourself.

    Type !nr at the command prompt. Andthe number 7 is dis-played. That's the value that has been stored in the variable

    NR.

    The SETQ function has given back the number 7. Thatnumber is

    now used to divide the number 3.0. That's why0.428571 is

    displayed.

    What we've seen here is an example of nestingfunctions.

    We'll do that a lot later as we work withAutoLISP.

    But easy, my dear subscribers. We don't want to go toofast.

    Let's first take a rest. Next time I'll tellabout arithmetic

    functions.

    Exercise

    In lesson 1 we did a calculation. Now let's do anothercalcu-

    lation. I want to divide the number 9632 by theproduct of 63

    times 13.

    But let's do it in a proper way. I want to make thecalcula-

    tion in one line. And I want to store values inthe CC and

    the PR variable.

  • 8/6/2019 Free AutoLISP Course

    12/42

    AutoLISP Course

    Jos van Doorn 2003 12

    Lesson 04: Arithmetic Functions 1

    Now it's time to go to AutoLISP functions. Here' we'lltalk

    about arithmetic functions first. AutoLISP hasgot a lot of

    them.

    Here's a list of ten of these functions:

    Let me first make some remarks about the notification.Each

    function starts with an opening bracket. Thencomes the func-

    tion.

    Next to the function you find written . Thatmeans a

    number is expected. You cannot enter a text ora string

    there.

    The three dots indicate that more numbers can beentered be-

    tween the brackets of the function. For thefirst function

    you could write:

    (+ 1 2 3 4 5)

    At the end is always a closing bracket. In AutoLISP thenum-

    ber of opening and closing brackets is always equal.Also

    here.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    And now what the functions do. That's not toocomplicated.

    The first four functions add, subtract,multiply, or divide

    numbers.

    Just to make it a little bit clearer. Suppose you have(* 2 3

    4). What does this function give back? It givesback 24.

    That's 2 times 3 times 4.

    Or suppose we have (/ 30 5 2). What does the functiongive

    back? The function gives back 3. Because that's 30divided by

    5 divided by 2.

    The function 1+ and 1- add or subtract one from thenumber.

    So (1+ 5) would give back 6. And (1- 10) wouldgive back 9.

    We don't have (2+ ).

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    13/42

    AutoLISP Course

    Jos van Doorn 2003 13

    The ABS function gives the absolute value of a number.So

    (abs -100) gives back 100. Do you see? You can onlyplace one

    number between the brackets.

    What the MAX and the MIN function does is clear. Theygive

    the maximum number or the minimal number of a listof num-bers.

    The GCD is a very nice function. It gives the biggestcommon

    divider of two numbers. The numbers must beintegers and

    positive.

    Here are some examples:

    Function Given back

    (gcd 81 57) 3

    (gcd 12 20) 4

    We've got nine more arithmetic functions. In the next lessonwe'll talk about them. But let's first do someAutoLISP pro-

    gramming.

    You can do it directly at the prompt. Enter (gcd 12 20)at

    the prompt. And see what happens. The number 4 isdisplayed.

    That's given back by the function.

    But you can also put the function in an ASCII file.Load the

    file in AutoCAD and run it. Let's go a littlebit further

    than what has been explained.

    Type the following in an ASCII file. Open Notepad andtype it

    in it. Than save the file under the nameARITH.LSP. Use thatname with the extension.

    Next load the file in AutoCAD. You know how to do it.Click

    on Tools on the menu bar and on Load Applicationon the pull-

    down menu.

    The Load AutoLISP, ADS, and ARX file dialog box opens.Click

    on the File button and locate the AutoLISP filein theSelect

    AutoLISP, ADS, or ARX file dialog box.

    When that's done click on the Open button. The dialogbox

    closes. Next click on the Load button of the firstdialog

    box. And the AutoLISP file is loaded.

    Type ARITH at the command prompt. And the AutoLISP fileruns.

    A lot of text is displayed at the command prompt.See for

    yourself.

    But first let's type our AutoLISP file. This is how itlooks:

  • 8/6/2019 Free AutoLISP Course

    14/42

    AutoLISP Course

    Jos van Doorn 2003 14

  • 8/6/2019 Free AutoLISP Course

    15/42

    AutoLISP Course

    Jos van Doorn 2003 15

    When finished typing the AutoLISP program you must saveit onyour hard disk. Save the AutoLISP program underthe name

    ARITH.LSP.

    Forget about the PRINC function, about "\n", and about "\t".

    We'll talks about them later. Just concentrate onthe numbers

    N1, N2, and N3.

    The number N1 is 12.0. That number is a real number. Ithas a

    decimal part. The other numbers are bothintegers. It have no

    decimal part.

    Look at what type of number is given back by thefunctions.

    If one number of the function is a realnumber than a realnumber is given back.

    The MAX function even converts the number 20 into areal num-

    ber. It gives back 20.0 as the maximum numberof the two.

    One more thing we've done now. And that's good. Thatsaves me

    a lot of work. I've shown how to write anAutoLISP program in

    an ASCII file.

    And did you write the program in a Notepad file? Verygood.

    Congratulations. You can now call yourself anAutoLISP pro-

    grammer.

    Nice to have you around, fellow AutoLISP programmers.OK. I

    need to tell a few things more. But you're onyour way to be-

    come a number one AutoLISP programmer.

    Exercise

    Do the following calculations:

    1. 12 + 345 + 24.42. 96 - 23.7 - 34.43. Absolute value of - 1234. Maximum value of the numbers 12 45 23 78 345. Biggest common divider of 2345 and 555

  • 8/6/2019 Free AutoLISP Course

    16/42

    AutoLISP Course

    Jos van Doorn 2003 16

    Lesson 05: Arithmetic Functions 2

    We've got nine more arithmetic functions in AutoLISP. Itold

    you, remember? Well. Here they are. Here's a listof the re-

    maining functions:

    The REM function gives the remainder of a division. So(rem

    42 16) would give back 10. Because that's leftafter dividing

    42 by 16.

    The EXP function is created for the people with anacademic

    background around us. It gives back the numbere to the power

    of the number.

    So (exp 1.0) gives back 2.71828. What's given back isalways

    a real number. And do we want to know how thenumber e is

    calculated?

    The EXPT function gives back the base number to thepower of

    the exponent number. So (expt 2 4) would giveback 16.

    The SQRT function gives back the root of the number.Couldn't

    we have guessed it? So (sqrt 4) gives back thenumber 2.

    The LOG function gives back the natural logarithm of anum-

    ber. Here's an example. The function (log 4.5) givesback

    1.50408.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    PI is not really a function. It's a number we use forcalcu-

    lating angles and so. PI stands for 3.1415926. Youknow what

    it means.

    The meaning of the COS and the SIN function is clear.And now

    we want the tangent of an angle. That's thesinus dived by

    the cosines. Right?

    For using the COS and the SIN functions the angle mustbe ex-

    pressed in radians. And let's forget about theATAN function.

    I never use it.

    I told you. The angle must be given in radians. Howmany ra-

    dians does a circle have? Wait. You know. Youwent to univer-

    sity.

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    17/42

    AutoLISP Course

    Jos van Doorn 2003 17

    I also went to university. I met the man at the door.He was

    very nice. And a full circle ahs got 2 piradians.

    I must make one more remark about the notification. Ialready

    explained for what the dots stand. But we alsohave square

    brackets.

    What's placed between square brackets is optional. Youcan

    place it in the function or leave it out. But whenleft out

    the function works differently.

    OK. Time for a little exercise. Remember the last time Icre-

    ated a little program to demonstrate the working ofthe func-

    tions.

    Go ahead. You now know how to write a program. So write a

    program yourself. Write a program to demonstrate themen-

    tioned functions.

    One more tip. In the last lesson I was talking aboutusing

    Notepad of Windows. Forget about Notepad. I'vegot a better

    idea.

    Go to HTTP://WWW.TEXTPAD.COM. There you can download a text

    editor that's much better than Notepad. One thing.They want

    you to buy it.

    Still download the program. The download is a fullyfunc-

    tional evaluation version. It only has onedisadvantage.

    Every now and then when you save a file a dialog boxshows

    up. The dialog box asks you whether you want tobuy the pro-gram.

    When the dialog box shows up you have two choices:Purchse

    Now and Continue Evaluation. Up to you. But Ialways click on

    Continue Evaluation.

    Exercise

    1. What's the remainder of 45 divide by 8 and dividedby 3?2. What's the square root of 1526?3. How many radians is an angle of 45 degrees?4. What's the cosines of an angle of 135 degrees?

    http://http//WWW.TEXTPAD.COM
  • 8/6/2019 Free AutoLISP Course

    18/42

    AutoLISP Course

    Jos van Doorn 2003 18

    Lesson 06: Arithmetic Functions 3

    Here are five more functions. At least four of them arevery

    important. We'll use them all of the time whileprogramming

    in AutoLISP.

    Here are the functions:

    The first four functions are very important. Those arethe

    functions we use all the time. Those functions helpus to

    write some good AutoLISP programs.

    The first function calculates the angle between the twopoints. It's the angle between the two points and theactive

    UCS.

    If the points are 3D points then the angle is projectedin

    the XY-plane. So no 3D angle will be given. Only aprojected

    angle will be given.

    The function gives back the angle in radians. So itdoesn't

    give back the angle in degrees. AutoLISP alwaysworks with

    radians.

    The second function can be used for measuring adistance be-

    tween two points. What's given back dependson the value ofthe FLATLAND system variable.

    If the FLATLAND system variable is unequal to zero than2D

    points are expected. And a 2D distance is givenback. Other-

    wise a 3D distance is given back.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    The INTERS function calculates at what point the lines be-

    tween four points cross. The ON argument isoptional. You can

    use it or not.

    If the FLATLAND system variable is unequal to zerothan 2D

    points are expected. A 2D point is thencalculated. Otherwise

    a 3D point.

    If the ON argument is present and equal to nil then thelines

    going through the points are considered to bewithout an end.

    So there is always a crossing then.

    If the argument is not present or the argument isunequal to

    nil then the crossing must be on the linesbetween the

    points.

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    19/42

    AutoLISP Course

    Jos van Doorn 2003 19

    The POLAR function gives back a point under thespecified an-

    gle from the given point and on thespecified distance. The

    angle is given in radians.

    What has been said about theFLATLAND system variable is alsovalid for thisfunction. So a 2D point or a 3D point is given

    back.

    The OSNAP function calculates a point on a line inaccordance

    with the MODE argument. The original pointis lying on a

    line.

    For the mode the following can be used:

    Let's write an AutoLISP program. This programdemonstrates

    the functions that are mentioned here. Theprogram has some

    new things.

    Don't worry too much about the new things. Later I'llexplain

    how these new tings work. For now let's justmake a good useof them.

    Here's the program:

  • 8/6/2019 Free AutoLISP Course

    20/42

    AutoLISP Course

    Jos van Doorn 2003 20

    Type the program in TextPad or Notepad. And then saveit un-

    der the name GEOMT.LSP. It's important to add theLSP exten-

    sion to the name.

    Load the program in AutoCAD and run it. You run theprogram

    by typing GEOMT at the command prompt. Then isasked for

    points.

    What does the program do? First it asks for two points.A

    line is drawn between the two points. And the angleand the

    distance is displayed.

    Next two more points are entered. You're free to enterthe

    points where you want. The additional points canhave a

    crossing with the first line or not.

    If they have a crossing with the first line then adonut is

    drawn on that line. Otherwise a donut is drawnoutside the

    lines.

    As you can see I've used the PRINC function again.That's

    what I also did in the first program. Don'tworry. Next we

    talk about that function.

    In the next lesson we're going to be more serious. Thenwe're

    going to draw something with the help ofAutoLISP. Where are

    my seatbelts?

    Exercise

    I've got the following four points:

    Point Value

    P1 100,100

    P2 200,200

    P3 150,10

    P4 150,20

    I want to know:

    1. What's the angle between P1 and P2?2. What's the angle between P1 and P3?

  • 8/6/2019 Free AutoLISP Course

    21/42

    AutoLISP Course

    Jos van Doorn 2003 21

    3. What the intersection between the four points?if the lines are extended

    if the lines are not extended

    Let me give you a tip. We can find the answers by doingsome-

    thing at the command prompt of AutoCAD. But let'swrite anAutoLISP program.

    In teh AutoLISP program are four variables for thepoints.

    The variables are P1, P2, P3, and P4. You canassign points

    to the variables.

    This is how the point 100,100 is assigned to the pointP1. In

    the AutoLISP routine you use the following linefor doing

    that.

    The LIST function is used. Two numbers are placedbetween thebrackets of the LIST function. The numbersare not connected.

    No comma.

  • 8/6/2019 Free AutoLISP Course

    22/42

    AutoLISP Course

    Jos van Doorn 2003 22

    Lesson 07: Creating Drawings 1

    We've done a lot of functions up till now. One aspectof

    AutoLISP is making drawings. So it's time to getstarted with

    making drawings.

    Wait, wait, my fellow AutoLISPprogrammers. There are a few

    things I must explainfirst. Otherwise you're completely

    lost. And I don't want that.

    I knew what you're going to say. Otherwise you'regoing to

    complain. You're going to say that I'm tryingto confuse you.

    Not true.

    I must first tell you something about:

    Loading an AutoLISP program in AutoCAD

    Defining a function in AutoLISP

    Defining a new command in AutoLISP

    Using standard AutoCAD commands in AutoLISP

    I'll give an explanation about the above. When that'sdone

    I'll come with an AutoLISP program. I'll do thatin the next

    lesson.

    We can load an AutoLISP program over AutoCAD. We clickon

    Tool on the Menu Br and on Load Application on thepull-down

    menu.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    But there's another way. That's a more direct way. Weuse an

    AutoLISP function for doing that. That functionis more com-

    fortable.

    This is the syntax of the function:

    A file name is entered. That can be the sole file nameif the

    file is in the search path of AutoCAD. Otherwisea path mustbe specified.

    But watch out. Use sledges for specifying a path andnot back

    sledges. This is how a path could be specifiedin the LOAD

    function:

    We don't have to mention the extension LSP. The file issup-

    posed to be a valid AutoLISP file. But when the fileis saved

    the LSP extension must be given.

    mailto:acadconsult@send
  • 8/6/2019 Free AutoLISP Course

    23/42

    AutoLISP Course

    Jos van Doorn 2003 23

    The LOAD function has the optional NOT PRESENTargument.

    That's a text. The text is displayed when thefile is not

    present.

    You don't have this optional argument when loading anAuto-

    LISP file from within AutoCAD over Tools etc. Youmust selecta file.

    A function in AutoLISP is defined using the DEFUNfunction.

    We already have seen how that function isused.This is the

    syntax of that function:

    SYMBOL is the name of the function. That name is usedto make

    a call to the function. The name can never bethe name as an

    AutoCAD command.

    There are two types of arguments. The first type ofargumentsare arguments that are used by the function.The second type

    are used in the function.

    Those two arguments are divided by a sledge. In frontof the

    sledge and after the sledge is a space. Thesecond type of

    arguments are special.

    The second type of arguments only have a value in thefunc-

    tion. Outside the function they have no value.These argu-

    ments are called local arguments.

    Here's an overview:

    Function Description

    (defun test (a b) ...) the function works with

    two arguments

    (defun test (/ a b ...) the function has two

    local arguments

    (defun test (a / b) ...) the function works with

    one argument and has one

    local argument

    (defun test () ...) the function works

    without arguments and has

    no local arguments

    We must always try to specify arguments in a functionas lo-cal. That way they have no value outside thefunction. That

    saves memory.

    The DEFUN function always works with an argument list.But

    the function can work without arguments and have nolocal ar-

    guments.

    In that case the argument list is empty. For theargument

    list two brackets are placed in the DEFUNfunction.

    This is how a function is defined using the DEFUNfunction.

    But the DEFUN function can also be used todefine a new com-

    mand.

  • 8/6/2019 Free AutoLISP Course

    24/42

    AutoLISP Course

    Jos van Doorn 2003 24

    That works the same as defining a function. Thedifference is

    that the symbol name is preceded by C:like in (defun c:nwcmd

    () ...)

    Normally a new command doesn't work with arguments. Buta newcommand can have local arguments. They arespecified as be-

    fore.

    Here is a simple function. See whether you canrecognize what

    have been said.

    The function works with the argument NR. That argumentis a

    number. And the function gives back the numberplus 10.

    This is the function used to use AutoCAD commands in an Auto-

    LISP program. The function has an argument. Whatcomes next

    depends on the command.

    Here's how the command function could be used:

    ET is an entity. The entity is placed in the commandfunction

    as an argument. The ERASE command isterminated by using "".

    In this way we can use all the AutoCAD commands. What?You

    don't know the names of all commands. But you knowhow to

    start all the AutoCAD commands.

    If you don't know all the AutoCAD commands then juststart

    them. After starting them look at the commandprompt. There

    the name of the command is displayed.

    Each command works with arguments. How can you findall the

    arguments. Again start the command and look atthe command

    prompt.

    Here's how the TEXT command is used in AutoLISP:

    Do you recognize all these arguments? If not start theTEXT

    command in AutoCAD. See what arguments are neededfor the

    TEXT command.

    Some commands start with a dialog box. But that's notwhat we

    want. We want to see all the prompts of thecommands.

  • 8/6/2019 Free AutoLISP Course

    25/42

    AutoLISP Course

    Jos van Doorn 2003 25

    An example is the BHATCH command. Type that command atthe

    command prompt. And see that the Boundary Hatchdialog box is

    displayed.

    Instead of BHATCH type -BHATCH at the command prompt.Now nodialog box is. Prompts are displayed. You canfind all the

    arguments.

    There are also a lot functions for requestinginformation. We

    need these functions very often in anAutoLISP program.

    Later we'll talk about these functions. But first Iwant to

    do something with a simple program. I want togive an expla-

    nation about this program.

    With the simple program we'll be drawing something with Auto-

    LISP. And isn't that what we want to do withAutoLISP? We

    want to use it for making drawings.

    Exercise

    Create an AutoLISP routine that draws a rectangle. Thewidth

    of the rectangle is 2. In the middle of therectangle is a

    circle.

    In the center of the circle a text is written. The textis

    "TEST". The height of the text is half the radius ofthe cir-

    cle.

    The corner points of the rectangle are 100,100 and400,400.

    The radius of the circle is 100. For the textany text stylecan be used.

  • 8/6/2019 Free AutoLISP Course

    26/42

    AutoLISP Course

    Jos van Doorn 2003 26

    Lesson 08: Creating Drawing 2

    One aspect of AutoLISP is making drawings in AutoCADwith it.

    You know why we want to do that. AutoLISP isreal fast. We

    will be saving a lot of time.

    That's what I'm doing. And you can do it too when youknow

    AutoLISP. My AutoLISP programs make AutoCADdrawings within

    one minute.

    The drawings my programs make can also be made by handin

    AutoCAD. If that's done then hours or days areused. So an

    AutoLISP routine is a big time saver.

    So when a drawing is made by AutoLISP we save a lot oftime.

    And we save a lot of money. How much is one hourworking with

    AutoCAD?

    That's what I promised. I promised to come with anAutoLISPprogram that makes a drawing. And that's whatI always say:

    keep your promises.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    No more talking. Let's go to the business for which weare

    here. Let's get on with the AutoLISP program. Well.Here it

    is:

    mailto:acadconsult@send
  • 8/6/2019 Free AutoLISP Course

    27/42

    AutoLISP Course

    Jos van Doorn 2003 27

    Type this program in Notepad or TextPad. And save itunder

    the name SDOOR.LSP. Next load it in AutoCAD andtype SDOOR at

    the prompt.

    The program starts. It asks for the position of thedoor.Pick a point in the screen. And then three sizesare asked

    for.

    You can enter the sizes in two ways. You can pickpoints or

    you can enter a number. Up to you. Butentering numbers is

    the easiest way.

    After picking a point and entering three numbers thedoor is

    drawn. Also the posts are drawn. And an arc isdrawn.

    In the program are a couple of new things. Yes. I know.You

    were thinking things are easy. Good. But I'll keepyou busy.

    First we see the SETVAR function and the GETVARfunction. And

    then there are functions which namesstart with GET. And we

    see the PRINC function.

    The functions which names starting with GET arefunctions to

    get information from the user. I don'twant to talk about

    them now. That's later.

    Let's go to the SETVAR function and the GETVARfunction. You

    know about system variables. AutoCAD hasgot a lot of them.

    The SETVAR function is used to set a system variable.And the

    GETVAR function is used to get the value of asystem vari-able.

    I start the program with:

    Do you know the CMDECHO system variable? When thatsystem

    variable is set to zero then no prompts ofcommands are dis-

    played.

    To see the effect of that setting place a semi colonin front

    of that line. Load the program again inAutoCAD and run it.

  • 8/6/2019 Free AutoLISP Course

    28/42

    AutoLISP Course

    Jos van Doorn 2003 28

    If a semi colon is placed in front of a line in anAutoLISP

    program then that line is ignored byAutoLISP.

    Now you see a lot of lines displayed. The lines comefrom the

    LINE command and the CIRCLE command. We don'twant those

    prompts.

    What the heck is the functions of these prompts? Andthen

    these prompts will slow down your AutoLISPprogram very much.

    I wanted to switch on ORTHO. Because if users want to end

    distances by picking points the points must beunder fixed

    angles.

    First I see what the value of the system variableconcerned

    is. I store that value in the OM variable.And then I set OR-

    THOMODE.

    At the end of the program I set ORTHOMODE back to itsorigi-nal value. I use the SETVAR function for doingthat. OM is in

    that function.

    Why did I look up the value of the ORTHOMODE systemvariable?

    Well. Maybe ORTHO was switched on. If so Iwant to switch it

    back at the end.

    I didn't look up the value of the CMDECHO systemvariable. No

    point. That variable always has got avalue of 1.

    If the system variable would have a value of zero thenyou

    cannot work with AutoCAD. You don't know what to dowhen a

    command is invoked.

    I already explained how the COMMAND function works. Sothe

    use of the COMMAND function is very clear for you.But

    there's something to say.

    This is about programming in AutoLISP. You must alwaysdo it

    in a smart way. Don't use too many variables.Keep it simple.

    That's what I did as I used the line command. Iintroduced

    the PT variable and I used the variable allthe time.

    I also could have calculated nine points and draw linesand a

    circle between these points. But that would be awaste. No

    smart programming.

    For setting the value of the PT variable I used theSETQ

    function. That function gives a value back. Thatvalue is

    used by the LINE command all the time.

    One more thing I did. You don't have to do that. But Iplaced

    all variables that are used by the commands on adifferent

    line.

    You can place the variables on a single line. You canplace

    them on the same line as the command. But thenyou'll get a

    mesh.

  • 8/6/2019 Free AutoLISP Course

    29/42

    AutoLISP Course

    Jos van Doorn 2003 29

    I like to place the variables on separate lines. That'salso

    useful if you want to print the program out. Nowrapped

    lines.

    A few more words about PI. We know where PI stands for.I ex-

    plained that one in one of the previous lessons.Here it'sused for angles.

    AutoLISP only works with angles in radians. Maybe youcannot

    imagine yet. But we can make a good use of PIfor specifying

    angles.

    A circle consists of 2PI radians. We all know that. So2PI

    radians stands for 360 degrees. Right? Can youfollow me? Do

    you agree?

    And now we want to have an angle of 90 degrees. How dowe do

    that? Let's do some calculations. We must do some arithmetic.

    So get ready.

    2PI stands for 360 degrees. So PI stands for 180 degrees.

    Wait a minute now. If PI stands for 180degrees then PI times

    0.5 stands for 90 degrees.

    I don't have to tell you. But it must be clear by nowhow to

    calculate an angle of 30 degrees or an angle of45 degrees.

    Just calculate some more.

    I showed you an AutoLISP program to make a drawing inAuto-

    CAD. Use that program. Have a good look at it. Andmake your

    own program.

    I don't think it's too difficult to make your ownprogram

    now. Just follow my program. Use parts of it if you want. It

    can be done.

    Next time I'll talk about the functions for gettinginforma-

    tion. I'll do it in two lessons. We have toomany for doing

    it in one lesson.

    Exercise

    No exercise in this lesson. You've had enoughinformation.

    You are exhausted now. So an exercise isnot such a good

    idea.

    But this is what you do. Copy the AutoLISP routine fromthis

    lesson in a file. Save the file and start workingwith the

    AutoLISP routine.

  • 8/6/2019 Free AutoLISP Course

    30/42

    AutoLISP Course

    Jos van Doorn 2003 30

    Lesson 09: Getting Information 1

    Now let's talk about functions for getting informationfrom

    the user. AutoLISP has got a lot of them. We'lltalk about

    them in two lessons.

    First let's talk about six of them. These six arepretty

    straight forward. There are two more functions. They are a

    little bit complicated.

    Here are the six straightforward functions:

    This is what we can see right away. The names of allthese

    functions start with GET. Of course. Thefunctions are for

    getting information.

    And then you can add a prompt to each function. You canalso

    leave the prompt out. Adding a prompt is optional.You're

    free to add a prompt.

    I think it's always a good idea to add a prompt.Otherwise

    users don't know what information is expectedto be given.

    They are left guessing.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    The GETPOINT function is used for entering a point.We've

    seen that function in the GEOMT.LSP routine andthe SDOOR.LSP

    routine.

    If a prompt is added to the function the prompt isdisplayed

    at the command prompt of AutoCAD. You couldprogram like

    (getpoint "\nEnter point: ").

    If a point is added to the function then a rubber bandis

    drawn from that point. We already have seen howthat's done.

    The GETCORNER function is very much the same as theGETPOINT

    function. The difference is that the functionneeds a base

    point.

    The function can be used for entering points of arectangle.

    The base point is one corner of therectangle. And then there

    is the point for the opposite corner.

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    31/42

    AutoLISP Course

    Jos van Doorn 2003 31

    A rubber band is drawn between the two points. Therubber

    band has the forma of a rectangle. But therectangle is not

    drawn as a point is entered.

    We have seen the GETDIST function. A point can be addedto

    the function. Then the distance is calculated fromthe pointif a point is picked.

    Otherwise you must pick two points to give a distance.But

    there is another way. You can also enter a numberfor the

    distance at the prompt.

    The GETINT and GETREAL functions are used for enteringan in-

    teger or a real number. The integer can have avalue between

    -32768 and 32767.

    With the GETANGLE function an angle can be entered. Two

    points can be picked or a number can be entered atthe

    prompt.

    The function gives back the angle in radians. So if youenter

    30 at the prompt the function gives back the realnumber

    0.523599.

    You can also add a point to the function. If that'sdone you

    don't have to point a second point. The pointis to be con-

    sidered as the first point.

    The GETSTRING function is used for entering a string.Who

    could have thought about that one? But there'ssomething spe-

    cial about the function.

    That's AutoCAD. A space is the same as a carriagereturn. The

    same for AutoLISP function. A space wouldterminate the GET-

    STRING function.

    But there is the CR argument. If that argument ispresent and

    unequal to nil then a space doesn'tterminate the function.

    So. Suppose you use the GETSTRING function as:

    Then you couldn't enter "Jos van Doorn". How did I comeup

    with that name?

    If I would like to enter that name I had to use theGETSTRING

    function as:

    Now I can enter a full name with spaces. I must pressthe EN-

    TER key to terminate the function.

    Let me tell you something about T. T is short for TRUE.And

    TRUE is the opposite of nil. A variable can be niland it can

    be T.

  • 8/6/2019 Free AutoLISP Course

    32/42

    AutoLISP Course

    Jos van Doorn 2003 32

    If the variable is nil then it has no value at all. Ifit's T

    then it has a value. You can use T if the valuedoesn't mat-

    ter.

    We wanted to give the CR argument a value in theGETSTRING

    function. So we use T. We could also write"value". That'sthe same.

    We have two more functions for getting information. Oneof

    them I've never used. But the other one I use allthe time.

    That's an important one.

    See you next time.

    Exercise

    The user is asked for a text. He can only enter a word.After

    entering the word he is asked for an insertionpoint and an

    angle.

    The text is written to the screen. The size of the textdoes-

    n't matter. Because there is zoomed in and out of thetext.

    That's why the size doesn't matter.

  • 8/6/2019 Free AutoLISP Course

    33/42

    AutoLISP Course

    Jos van Doorn 2003 33

    Lesson 10: Getting Information 2

    Here are two more functions for getting informationfrom the

    user of your AutoLISP program. I never use thefirst func-

    tion. But the second one ...

    The GETORIENT function is used when the user haschanged the

    direction of the zero angle. By defaultthat angle points to

    the east.

    This function is very much the same as the GETANGLEfunction.

    Except GETANGLE measures starting from thezero angle.

    GETANGLE measures relative angles. GETORIENT measuresabso-

    lute angles. For GETORIENT the zero angle alwayspoints to

    the east.

    Why did I never use the GETORIENT function? I don'treally

    mind how the angle is measured. And I can alwaysuse an angle

    given back by the GETANGLE function.

    Let's go to the GETKWORD function. That's a very nicefunc-

    tion. Look at the name. That's short for GET KEYWORD. Isn't

    that beautiful?

    The GETKWORD function always works together with theINITGET

    function. In the INITGET function thekeywords are specified.

    You can specify what input is valid for the GETKWORDfunc-tion. If the input is not valid then the GETKWORDrepeats it-

    self.

    Why wait for hours or even days? Get your AutoCAD

    drawings right away! Find out how. Send an e-mail

    to:mailto:[email protected]

    Here's an example of how the GETKWORD function togetherwith

    the INIGET function can be used:

    "Continue? (Yes/No) " is displayed at the prompt. Theuser

    can only give an input of "Yes", "Y", "y", "No',"N", or "n".

    He must give one of these answers.

    The user cannot give an empty input by pressing theENTER

    key. That's not allowed. In the INITGET functionis specified

    what input is valid.

    After giving a valid input the value of the AW variableis

    "Yes" or "No". Even if the user gave the input was "Y", "y",

    "N",or "n".

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    34/42

    AutoLISP Course

    Jos van Doorn 2003 34

    Isn't that a nice feature? Yes. It is. That's why I usethis

    function all the time. I very often use theINITGETfunction

    together with the GERTKWORD function.

    Let's go to the INITGET function. Let's explain how that

    function works. The explanation is a lot. But still youcanunderstand it.

    This is the syntax of the INITGET function:

    You can add bits to the INITGET function. You can alsoomit

    adding bits to the INITGET function. But theintegers are

    added together.

    Here's an overview of the bits that can be used:

    Bit Meaning1 Empty input not allowed

    2 Zero value not allowed

    4 Negative input not allowed

    8 No check of limits, even with LIMCHECK = 1

    16 3D points instead of 2D points

    32 Dashes are used to draw a "rubber band"

    Here's an example of how the bits can be used:

    The user must enter a value. He cannot press the ENTERkey.Zero can not be entered. And a negative input isnot allowed

    either.

    Instead of (initget (+ 1 2 4)) we also could havewritten

    (initget 7). The three bits are added together.And the sum

    of the bits is used.

    The TEXT specifies the valid entries of the GETKWORDfunc-

    tion. We already have seen that one. "Yes No' hasbeen used.

    The use of capitals is important. The capitals are thelet-

    ters that can be entered instead of the completewords.

    One more thing. Suppose we can make a choice betweenLEFT and

    LTYPE. If we type L then is not clear whatchoice we want to

    make.

    In the text for the INIGET function you write "LEftLType".

    Now LE and LT re valid entries. L is not avalid entry.

    The INITGET function is used for the GETKWORD function.You

    have to use the INITGET function there. You cannotleave that

    function out.

    But the INITGET function can also be used for otherfunctions

    to get information from the user. Here's anoverview:

  • 8/6/2019 Free AutoLISP Course

    35/42

    AutoLISP Course

    Jos van Doorn 2003 35

    Function no

    null

    no

    zero

    no

    nega-

    tive

    no

    limits

    3D

    points

    Use

    dashes

    GETINT X X X

    GETREAL X X X

    GETDIST X X X X X

    GETANGLE X X X

    GETORIENT X X X

    GETPOINT X X X X

    GETCORNER X X X X

    It's clear what this means. For the GETINT function youcan

    only use the 1, 2, and 4 bits. The other bits haveno mean-

    ing.

    Now you've got all the functions for getting userinput. Now

    you're ready for programming in AutoLISP.You know how to use

    the AutoCAD commands.

    Exercise

    No exercise this time. I mean. What exercise could Ipossibly

    add to the lesson? We only talked about twofunctions. If we

    were talking about more functions ...

  • 8/6/2019 Free AutoLISP Course

    36/42

    AutoLISP Course

    Jos van Doorn 2003 36

    Answers

    Lesson 1

    Type (/ 96 8) at the command prompt and press the Enterkey.

    That will give you the correct answer. The correctanswer is

    12.

    Lesson 2

    Nr. Entry Type

    1. 3 Integer

    2. 1.23 Real or Float

    3. (1 2 3) List

    4. / Function

    5. Selection Set

    6. File Descriptor

    Lesson 3

    This is to be typed at the command prompt:

    (setq cc (/ 9632.0 (setq pr (* 63 13))))

    I didn't write 9632. I wrote 9632.0. Now the number isa

    float. And a float is given back after thecalculation.

    To find the values of the calculation and the product type

    !CC and !PR at the command prompt. This is givenback:

    Variable Value

    !CC 11.7607

    !PR 819

    Lesson 4

    Nr. Function Value

    1. (+ 12 345 24.4) 381.4

    2. (- 96 23.7 34.4) 37.9

    3. (abs -123) 123

    4. (max 12 45 23 78 34) 78

    5. (gcd 2345 555) 5

    Lesson 5

    Nr. Function Value

    1. (rem 45 8 3) 2

    2. (sqrt 1526) 39.064

    3. 360 degrees is 2 pi radians. So 45 degrees is 2 pi divided

    by 8.The answer is 0.25 radians

    4. (cos (* 0.25

    3))

    0.731689

  • 8/6/2019 Free AutoLISP Course

    37/42

    AutoLISP Course

    Jos van Doorn 2003 37

    Lesson 6

    Here's the AutoLISP routine. First the point values are as-

    signed to the variables P1, P2, P3, and P4. And thenthere is

    a calculation.

    What has been calculated is written to the text screenof

    AutoCAD. To see it completely press the F2 key onthe key-

    board.

    This is given back by the AutoLISP routine:

    Nr. To measure Value

    1. Angle P1 and P2 0.785398

    2. Angle P1 and P3 5.21949

    3. Intersection point:

    (extension) 150.0 150.0)

    (no extension) nil

  • 8/6/2019 Free AutoLISP Course

    38/42

    AutoLISP Course

    Jos van Doorn 2003 38

    Lesson 7

    This AutoLISP routine will draw the rectangle with awidth of

    2. It will also draw a circle in it and textin the circle.

    At the start everything in the screen is deleted.That's done

    by the ERASE command. At the end there iszoomed in and outof the drawing.

  • 8/6/2019 Free AutoLISP Course

    39/42

    AutoLISP Course

    Jos van Doorn 2003 39

    Lesson 9

    Here's the AutoLISP routine with all the magic. Firstthere

    is asked for a word. And then there is asked foran insertion

    point and an angle.

    For getting the angle the GETANGLE function is used.The user

    can pick a point or he can enter an angle in degrees.

    The GETANGLE function gives back the angle in radians.But

    that's a problem. Because the text command workswith angles

    in degrees.

    So in the text command we must make a calculation. Wemust

    find out what is the angle in degrees. We musttransform the

    AN variable.

    At the end we zoom in and put of the word that has beenwrit-

    ten to the screen.

  • 8/6/2019 Free AutoLISP Course

    40/42

    AutoLISP Course

    Jos van Doorn 2003 40

    What next?

    You can consider this course as an introduction to AutoLISP.

    After doing this course you will be able to write your own

    AutoLISP routine.

    But there is more to AutoLISP then what has been explained in

    the ten lesson of this course. Much more. This is what more

    there is in AutoLISP:

    Predicates

    Test Functions

    Repetition Functions

    System Variables

    Text Screen Functions

    Graphical Screen Functions

    Text Functions

    Conversion Functions 1

    List Functions 1

    External Files

    AutoCAD Database

    Entity Name Functions

    Selection Set Functions

    Entity Data Functions

    Tables In AutoCAD Database

    System Management

    This course only gives the first ten lessons of the AutoLISP

    course I wrote. The complete AutoLISP course consists of 30

    lessons.

    If you want it. You can get the complete course. The complete

    course is only $ 10. And it is very much the same as this

    course.

    In almost every lesson is an exercise that goes into what has

    been explained in the lesson. You will also get the answers

    to all exercises.

    And that is a bonus that comes with the complete AutoLISP

    course. You'll get full support. You can always come to me

    with your questions.

    I will help you to get started with programming in AutoLISP.

    No matter what. If youve got a question you can always come

    to me with your question

    If you want the complete AutoLISP course then let me know.

    Send me an e-mail with "Complete Course in the subject line.

    This is my e-mail address:

    mailto:[email protected]

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    41/42

    AutoLISP Course

    Jos van Doorn 2003 41

    Looking forward to hearing from you,

    Jos van Doorn. AutoCAD specialist and AutoLISP programmer.

    Also publisher ACAD Newsletter. About AutoCAD and AutoLISP.FREE. To subscribe send an e-mail to:

    mailto:[email protected]

    mailto:[email protected]
  • 8/6/2019 Free AutoLISP Course

    42/42

    AutoLISP Course

    ACAD Newsletter

    The ACAD Newsletter is about AutoCAD and AutoLISP. In the

    ACAD Newsletter you find AutoCAD articles. In the articles

    aspects of AutoCAD are explained.

    In the ACACAD Newsletter articles about paper space have been

    published. In it were also articles about creating linetypes

    and hatch patterns.

    For AutoLISP you'll find many AutoLISP routines. The listings

    of the AutoLISP routines are given. Complete with a thorough

    explanation.

    That was published in the earlier editions of the ACAD News-

    letter. In those editions was the BLANK AutoLISP routine. It

    was for drawing a blank.

    A blank is a rectangle containing a code. In piping drawingsyou always find a lot of blanks. The blanks routine was a

    very useful routine.

    The code was entered. Next the user could pick the position

    of the blank. The blank was hanging on the cursor. The user

    could move the blank and then pick a point.

    The ACAD Newsletter was also publishing a profile applica-

    tion. The application worked with dialog boxes. The user

    could do a lot with it.

    The user could select the type of profile to be drawn. And

    then he could enter the size of the profile and the view ofthe profile. Next the profile was drawn.

    There is a lot more that can be found in the ACAD Newsletter.

    In it you'll find AutoLISP tips, feedback, and other tips

    that make working with AutoCAD easier.

    The ACAD Newsletter is send out once a week. It has been up

    for more than two years. And you don't have to pay to get it.

    It's distributed at no cost.

    Don't wait any longer. Get all the good information about

    AutoCAD and AutoLISP. Take action right away. Send a blank e-

    mail to:

    mailto:[email protected]

    mailto:[email protected]