• No se han encontrado resultados

PARADIGMÁTICO”

B. EL POSITIVISMO A PARTIR DEL CÍRCULO DE VIENA

Here are two more functions for getting information from the user of your AutoLISP program. I never use the first func-tion. But the second one ...

The GETORIENT function is used when the user has changed the direction of the zero angle. By default that angle points to the east.

This function is very much the same as the GETANGLE function.

Except GETANGLE measures starting from the zero angle.

GETANGLE measures relative angles. GETORIENT measures abso-lute angles. For GETORIENT the zero angle always points to the east.

Why did I never use the GETORIENT function? I don't really mind how the angle is measured. And I can always use an angle given back by the GETANGLE function.

Let's go to the GETKWORD function. That's a very nice func-tion. Look at the name. That's short for GET KEY WORD. Isn't that beautiful?

The GETKWORD function always works together with the INITGET function. In the INITGET function the keywords are specified.

You can specify what input is valid for the GETKWORD func-tion. If the input is not valid then the GETKWORD repeats 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 together with the INIGET function can be used:

"Continue? (Yes/No) " is displayed at the prompt. The user 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 the ENTER key. That's not allowed. In the INITGET function is specified

AutoLISP Course

Isn't that a nice feature? Yes. It is. That's why I use this function all the time. I very often use the INITGET function 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 you can understand it.

This is the syntax of the INITGET function:

You can add bits to the INITGET function. You can also omit adding bits to the INITGET function. But the integers are added together.

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

Bit Meaning

1 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 ENTER key.

Zero can not be entered. And a negative input is not allowed either.

Instead of (initget (+ 1 2 4)) we also could have written (initget 7). The three bits are added together. And the sum of the bits is used.

The TEXT specifies the valid entries of the GETKWORD func-tion. We already have seen that one. "Yes No' has been used.

The use of capitals is important. The capitals are the let-ters that can be entered instead of the complete words.

One more thing. Suppose we can make a choice between LEFT and LTYPE. If we type L then is not clear what choice we want to make.

In the text for the INIGET function you write "LEft LType".

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

The INITGET function is used for the GETKWORD function. You have to use the INITGET function there. You cannot leave that function out.

But the INITGET function can also be used for other functions to get information from the user. Here's an overview:

AutoLISP Course

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 you can only use the 1, 2, and 4 bits. The other bits have no mean-ing.

Now you've got all the functions for getting user input. 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 I possibly add to the lesson? We only talked about two functions. If we were talking about more functions ...

AutoLISP Course

Answers

Lesson 1

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

That will give you the correct answer. The correct answer is 12.

5. <Selection set: 5> Selection Set 6. <File #A315> 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 is a float. And a float is given back after the calculation.

To find the values of the calculation and the product type

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

Variable Value

!CC 11.7607

!PR 819

Lesson 4

Nr. Function Value

1. (+ 12 345 24.4) 381.4

Nr. Function Value 1. (rem 45 8 3) 2

AutoLISP Course

Lesson 6

Here's the AutoLISP routine. First the point values are as-signed to the variables P1, P2, P3, and P4. And then there is a calculation.

What has been calculated is written to the text screen of AutoCAD. To see it completely press the F2 key on the 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

AutoLISP Course

Lesson 7

This AutoLISP routine will draw the rectangle with a width of 2. It will also draw a circle in it and text in the circle.

At the start everything in the screen is deleted. That's done by the ERASE command. At the end there is zoomed in and out of the drawing.

AutoLISP Course

Lesson 9

Here's the AutoLISP routine with all the magic. First there is asked for a word. And then there is asked for an 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 works with angles in degrees.

So in the text command we must make a calculation. We must find out what is the angle in degrees. We must transform the AN variable.

At the end we zoom in and put of the word that has been writ-ten to the screen.

AutoLISP Course

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: 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 you’ve 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]

AutoLISP Course

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]

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 drawings you 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 of the 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]

This document was created with Win2PDF available at http://www.daneprairie.com.

The unregistered version of Win2PDF is for evaluation or non-commercial use only.