|
ACAD Newsletter Vol 05 No 08
|
jos vandoorn
|
Apr 18, 2005 18:30 PDT
|
-------------------ACAD newsletter---------------------
Newsletter about AutoCAD and AutoLISP
-------------------------------------------------------
Vol 05, No 08 April 2005
-------------------------------------------------------
-------------------------------------------------------
For best viewing maximize the window to full size
-------------------------------------------------------
In this issue I have prepared for you....
1. Top Sponsor Section
2. Notes from the Publisher
3. Simple AutoLISP 1
4. Privacy Policy, Legal Stuff and Advertising Info.
5. Contact Information
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
1. Top Sponsor Section
-------------------------------------------------------
They were laughing!
Hi,
A cpouple of weeks ago my friends were rolling on the
floor. I told them that I was going to change working
on AutoCAD.
"Sure", they said, "it takes hours before your AutoCAD
drawing is created. And you need AutoCAD specialists
for doing your AutoCAD work".
Their laughter quickly turned to amazement after I came
with a solution. An AutoCAD drawing was created within
one minute.
And that was the best part. Anybody could create an
AutoCAD drawing. An AutoCAD specialist for working on
AutoCAD was no longer needed.
Let me know if you want to know how I did it. Send an
e-mail to:
mailto:acadprog-@hotmail.com
Write "Laughing" in the subject line. Or give me a
call. In Malaysia. This is my number:
012-9312742.
You'll be glad you did!
All the best,
Jos van Doorn. AutoCAD specialist and AutoLISP
programmer. Also publisher ACAD Newsletter. About
AutoCAD and AutoLISP. FREE. To subscribe send a blank
e-mail to:
mailto:acadnewslett-@hotmail.com
P.S. I found your e-mail address in the paper. You
were looking for an AutoCAD man. With my solution
you don't need that AutoCAD man.
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
2. Notes from the Publisher
-------------------------------------------------------
Ploon
Ploon was 32 as she married. She married Jaap. He was
36. They both hadn't been married before. Marriage was
new for them.
Ploon was a big size lady. No. I'm not talking about
lower big size. I'm talking about upper big size. She
sure had a lot of wood.
Most guys got a dirty mind. As they saw Ploon. But
Ploon never gave in. She was always playing the
innocent virgin.
Jaap had the time of his life. In bed. The two of them
had six children. But there were two more children. One
adopted and one out of wedlock child.
There was Mr. Boon. Married with three children. But he
knew a lot of ladies. Mr. Boon was a ladies man.
Something was going to happen.
Mr. Boon paid a visit to Ploon's house once a week. He
came there for Jaap. Business. But as he was there. Of
course he met Ploon.
One day I came home. Early. It was the day Boon would
come to the house. I was surprised. I didn't see Ploon.
She was taking a shower.
She came out of the shower. She told me to go away. She
didn't tell me why. But I found out. I went out of the
house. And stayed around the house.
Boon came. Jaap wasn't at home. So he had nothing to do
in the house. But that's what I saw. He stayed one
hour. And then went away.
Nine month later a child was born. Kees. He looked very
different from the other children of Ploon. He looked
very much like Boon.
Jaap never found out. He was thinking that Kees was his
child. He was thinking that Ploon was the love of his
life. Later things were clear.
Years later Jaap died. He had cancer. At his funeral
Ploon was there. A lot of family was there. Ploon had a
lot of fun.
Of course she had a lot of fun. Jaap was dead. He was
no longer around. He was no longer a disturbacne to
her. Now she was free.
Driver’s License
Yesterday I had the bus. I had bought a ticket in the
bus. And then a man stepped into the bus. He was
checking all tickets. I showed him mine.
The man was done. But he hadn’t asked the driver for a
ticket. So I asked him. "The driver doesn’t need a
ticket", he told me.
Very good. I thought. "Tomorrow I’m the driver", said
to the man. You know. Traveling free. I like that. If
only you’re the driver.
Do you have a driver’s license for a bus?", the man
asked. My God. That’s how it always is. I’ve got a good
idea. And then there are people spoiling it.
"Look", I said to the man, "I don’t need a driver’s
license. You only need a driver’s license if you are an
accident driver. I’m no accident driver".
The man didn’t agree with me. But I’m used to such an
attitude. No problem. I can handle it. We only need to
talk a little bit more.
More IntelliCAD
I was talking about IntelliCAD. The cheaper alternative
for AutoCAD. Not for you. You have a lot of money. You
can afford AutoCAD.
No. It's for the poeple that cannot afford AutoCAD.
Some of my customers cannot afford AutoCAD. They
switched to IntelliCAD.
They came to me for programming. An that's so nice
about IntelliCAD. Liek AutoCAD. You can do progreamming
for IntelliCAD.
I had some old AutoLISP programs. I used them. I had
them running in IntelliCAD. Everyhting went fine. OK.
Maybe one or two problems.
But that is clear now. AutoCAD supports AutoLISP. So is
IntelliCAD. You can also run your AutoLISP programs in
IntelliCAD.
Still with AutoCAD? Have a good read. Anyhow.
Jos
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
3. Simple AutoLISP 1
-------------------------------------------------------
You know about it. Or maybe you heard about it. You can
invoke AutroCAD commands over AutoLISP. It's easy to do
so. That's what's demonstrated here.
Here you'll find an AutoLISP routine that invokes the
LINE command, the CIRCLE command, and the ARC command.
You'll see how that is done.
Over the AutoLISP routine an AutoCAD drawing is
created. In the drawing you'll find lines, a circle,
and four arcs.
Let's make the AutoLISP routine fancy. We will have a
function for drawing the lines. We also have functions
for the other parts.
In the AutoCAD drawing are four horizontal lines with
a length of 60. The lines are exactly above each other.
Now that's easy.
We start with the lines. Here's how the main function
looks. In the main function four calls are made to the
function for drawing a line.
1. (defun c:simple ()
2. (setvar "cmdecho" 0)
3. (setq om (getvar "osmode"))
4. (setvar "osmode" 0)
5. (command "erase" "all" "")
6. (drlin (list 0 0))
7. (drlin (list 0 10))
8. (drlin (list 0 90))
9. (drlin (list 0 100))
10. (command "zoom" "extents")
11. (command "zoom" "0.9x")
12. (setvar "osmode" om)
13. (setvar "cmdecho" 1)
14. (princ)
15. )
In line 2 the CMDECHO system variable is set to zero.
We don't want command echoes. In line 13 the CMDECHO
system variable gets back its original value.
In line 14 is the PRINC function. We need that function
there. By the SETVAR function of line 13 a one is
given back.
If the PRINC function is not used then the number one
is written to the screen or the command area. That's
not nice.
We also do something with the OSMODE system variable.
We can't have a running object snap. So the OSMODE
system variable is set to zero.
We want to give the OSMODE system variable its original
value. So first its value is stored in the OM variable.
See line 3.
In line 12 the OSMODE system variable gets back its
original value. So after running the AutoLISP routine
things are as they were.
One more thing. In line 5 the ERASE command is invoked.
We want to start with an empty screen. So everything is
deleted first.
And here's the function for drawing the line. In the
main program four calls are made to this function. Each
time a line is drawn.
1. (defun drlin (pt)
2. (command "line" pt (polar pt 0 60) "")
3. )
In the main function the ERASE command is invoked. In
the DRLIN function the LINE command is invoked.
Arguments are used. How is that done?
All AutoCAD commands work with arguments. If you want
to find the arguments, then go to AutoCAD. And start
the command.
The command is started and prompts show up. Each time
something is entered at the prompt, then an argument
is entered.
See what arguments are entered. Those arguments must
be used in the AutoLISP routine. That's how you can
find all the arguments.
Let's be more precise now. Let's go to the ERASE
command. We go to AutoCAD and we invoke that command,
This prompt shows up:
Select objects:
Now objects can be selected. You can pick on objects.
Or you can use a window or a crossing. But that's not
important.
Important is that objects are selected. Each time an
object is selected the Select objects prompt is
displayed again.
You are in fact in the select objects mode. To get out
of the select object mode no object is selected. And
the right mouse button is clicked.
So for the EWRASE command we can have as an argument
objects that are to be erased. And we have an empty
input for terminating the command.
When we give an empty input or when we click the right
m mouse button, the elected objects are erased from the
AutoCAD drawing.
That's what we already can conclude. The ERASE command
is always terminated with an empty input. So there
must always be an empty input.
For the ERASE command you can select objects. But you
can also select all the objects in the AutoCAD
drawing. Just type "ALL" at the prompt.
In the main function we didn't want to select objects.
We wanted to select all the object s in the AutoCAD
drawing. This is how it is done:
(command "erase" "all" "")
The ERASE command is invoked. To select all the
objects in the AutoCAD drawing "ALL" is entered as an
argument.
The last argument of the ERASE command is "". This
stands for the input of an empty string. This is how
the WERASE command is terminated.
In the DRLIN function the line command is invoked. The
LINE command has got three arguments; a point. a
point, and an empty input.
You know how the LINE command works. These prompts show
up:
Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]:
Specify next point or [Close/Undo]:
The first prompt shows up as the LINE command is
started. Then we have the second prompt, the second
prompt, and the fourth prompt.
The fourth prompt is repeated all the time. It is
repeated all the time until "C" is entered or an empty
input is given.
We want to draw a horizontal line. So we give the
starting point of the line. That's first point. And
we give the ending point.
The ending point is the second point. It's the second
argument of the LINE command. The third argument is the
empty input. To terminate the command.
This was a little bit a long story. We still have the
function for drawing the cross, the circle, and the
arcs. That comes next.
*******************************************************
Writer of this article is Jos van Doorn.
Once you start with AutoLISP, you will be saving lots
of time and money with AutoCAD. Don't know AutoLISP?
Here are the books for learning.
http://autocadbooks.topcities.com
*******************************************************
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
4. Privacy policy, Advertising Info, and Legal Stuff
-------------------------------------------------------
This newsletter is only sent on request. Our list of
subscribers is strictly confidential. That means that
your details have never been and never will be passed
on to any third party.
Your privacy is greatly respected. Should you ever wish
to unsubscribe, full instructions are always provided.
To subscribe:
mailto:acadnewslett-@topica.com
To unsubscribe:
mailto:acadnewslette-@topica.com
Previous issues of the newsletter can be seen at:
http://www.topica.com/lists/acadnewsletter/read
Advertising info:
If you wish to advertise in this newsletter, you
shouldn't wait a second longer. Ad rates now are the
lowest for the season.
The ad rates are:
Top sponsor message: $5 per issue
Ad in the sponsors section: $2 per issue
The ad guidelines are:
Ads have to be up to 5 lines including a URL and a
mail to tag. Each line can have up to 55 chars max.
Legal stuff:
ACAD newsletter publishes original content and tips
that are distributed by readers. ALL of our articles
are original and copyrighted by Jos van Doorn.
If you wish to publish any of the content here in your
newsletter please contact Jos van Doorn at
mailto:acad-@hotmail.com
He's the publisher of this newsletter. Write PUBLISH in
the subject line.
Reprinting or reproducing this newsletter can be done
only if you keep it all together. You may NOT reproduce
any part of this newsletter in a way without a written
permission from Jos van Doorn. The signatures are to
be kept intact.
More stuff:
In the archive you can find ll back issues of the ACAD
Newsletter. This is the web site address where you can
find the archive:
http://www.topica.com/lists/acadnewsletter/read
At the web site of the ACAD Newsletter a lot of
applications can be found. There you can also find back
issues bundled in PDF files. Here's the web site:
http://groups.yahoo.com/group/acadnewsletter/files
-------------------------------------------------------
Disclaimer:
ACAD newsletter accepts no responsibility whatsoever
for the content or legality of any customer's
advertisement shown in any e-mailing.
It is the advertisers' responsibility to check and
abide by the Local, State, Federal and International
laws pertaining to the products, services or business
opportunities they advertise, as well as all laws
pertaining to the products, services and/or business
opportunities promotions.
All offers in this publication, are void where
prohibited by law!
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
5. Contact Information
-------------------------------------------------------
Jos van Doorn - publisher ACAD newsletter
Jalan Watan 12
CA-4-24
68000 Bandar Baru Ampang
Malaysia
(03) 42706214
mailto:acad-@hotmail.com
*******************************************************
*******************************************************
*******************************************************
_________________________________________________________________
Get your mobile ringtones, operator logos and picture messages from MSN
Mobile http://msn.smsfactory.no/
|
|
 |
|