|
ACAD Newsletter Vol 05 No 07
|
jos vandoorn
|
Apr 01, 2005 22:16 PST
|
-------------------ACAD newsletter---------------------
Newsletter about AutoCAD and AutoLISP
-------------------------------------------------------
Vol 05, No 07 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. Hatch 2
4. Paper Space in AutoCAD 2005 4
4. Privacy Policy, Legal Stuff and Advertising Info.
5. Contact Information
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
1. Top Sponsor Section
-------------------------------------------------------
Announcing: Significant Performance Improvements
Dear AutoCAD user,
If you're ready to improve the performance of AutoCAD
significantly, then read this carefully. It may be the
most important message you read all year.
I'm writing to you with some urgency. Over the past
year I have quietly perfected a powerful new AutoCAD
strategy with a few of my clients.
It's a complete new system of working with AutoCAD.
What makes it unique is that you're no longer waiting
for hours before your AutoCAD drawing is created.
Result? You'll have your AutoCAD drawing right away,
within one minute. No more checking of AutoCAD
drawings. No AutoCAD people required.
Using my system my clients were able to create more
than 400 AutoCAD drawings in a day. More than 400!
Isn't that fast?
The drawings were created according standards. So there
was no need to check the drawings. The drawings could
be used without checking.
That was maybe the best part. At first my clients had a
lot of AutoCAD people. Very expensive. Now they could
do without them. Saving money.
If you want that to. If you want your AutoCAD drawings
right away, no more checking, and anybody can create
AutoCAD drawings.
Get in touch. Send an e-mail to:
mailto:acadprog-@hotmail.com
Write "Announcing" in the subject line. Or give me a
call. This is my telephone number:
012-9312742
I think that's fair. You'll be saving money. After
engaging me. I always ask an advance payment, if I
start a new project.
I always ask an advance payment of RM 1,500. But to
make things easier for you. This time I'll settle for
an advance payment of RM 1,000.
Just to make sure things don't go wrong. If you give a
reply to this e-mail, write "RM 1,000 advance" in the
subject line.
Or tell me that I promised you an advance payment of
only RM 1,000 when you give me a call. I don't want to
charge you more.
So, if this is going to be too much of a stretch for
you, better to pass for now. Then just keep on wasting
a lot of time and money.
However, if you are eager and itching to make
significant performance improvements to AutoCAD, then
we need to talk right away.
Sincerely,
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.
P.P.S. I work on a "no cure, no pay" base. If my
system doesn't save you time and money, then
you'll get it for free.
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
2. Notes from the Publisher
-------------------------------------------------------
Programming in AutoLISP
Is that difficult? Is it complicated? No. It's not
difficult. And it's not complicated. If you follow the
procedure.
Programming in AutoLISP is a three steps procedure.
Just follow the steps and the programming becomes very
easy. These are the three steps:
1. Thinking the program over.
2. Writing or drawing diagrams.
3. Typing AutoLISP code.
Let's have a closer look at these three steps. We start
with thinking the program over. That's the first step.
Very important.
You know. You want an AutoLISP program. Or somebody
comes to you for an AutoLISP program. That's a problem.
A big problem.
This is how you handle a big problem. This is what you
can do in your daily life. And when programming. Cut
the problem in pieces.
Keep on cutting the problem in pieces. Until you've got
pieces that you can handle. Once you've got pieces that
you can handle, then you've got a solution.
That is thinking the program over. Thinking the program
over is cutting the program in pieces. Not only the
program. Also the job.
Let me give you an example. That's a job I did. People
came to me. They wanted to have an AutoLISP program
that creates a complete AutoCAD drawing.
They showed me an example of a drawing that they wanted
to be created. This is what I saw in the drawing:
- Front view
- Side view
- Top view
- Details
- Bill of material
- Border with drawing head
That was a start. They came to me with a problem. They
wanted to have an AutoLISP program for creating a
complete AutoCAD drawing.
The complete AutoCAD drawing. I had cut the complete
AutoCAD drawing in six pieces. Now I could have a
closer look at the six pieces.
I'm not going to tell you what I did with each six
pieces of the complete AutoCAD drawing. But that's
clear. I was cutting it further.
We have two more steps. The steps are about writing or
drawing diagrams and typing AutoLISP code. I will tell
about it next time.
Wouldn’t That Be Nice?
I was reading about Napoleon Hill. He wrote "Think and
Grow Rich". That was maybe the first motivational book.
About making a lot of money.
There is a story behind Napoleon Hill. In his younger
years he did an interview with Andrew Carnegie. That
man was a steel magnate.
He started with nothing and he became very rich. You
could say he was the Bill Gates of the first pat of the
twentieth century.
He wanted Napoleon Hill to write about getting rich.
How he did it. He wanted Napoleon Hill to tell the
whole world. And that’s what he did.
This man. Andrew Carnegie. He was working with a lot of
people. Finding good people. He found a way of doing
that. This is how.
The people he was working with had to have the
following traits:
* Quality
* Quantity
* Harmony
This what he meant by these traits. He wanted them to
do their job in a good way. He didn’t ask them to work
hard. He just wanted them t work all the time.
So. Sitting around and doing nothing. Or walking around
al the time. That was not allowed. That was not what he
wanted from his people.
Harmony. Harmony is everybody working together in a
pleasant and harmanous atmosphere. That was very
important for him.
Andrew Carnegie became very rich. A lot of people were
working with him. They had the right attitude. They too
become rich. Very rich.
Quality, quantity, harmony. Wouldn’t that be nice?
Finding things like that in your working place. I don’t
have a working place. But I think it is.
Marie
Marie married Jose. He came from Spain. Working in
Holland. They met. And they married. What a marriage.
That was really a dream marriage.
Jose didn't meet Marie at first. He met her mother. She
was in her fourties. Jose was in his late twenties.
Well. You know how it goes.
Anyway. Marie's mother brought Jose to her home. And
that's where he saw Marie. All of a sudden he was no
longer interested in mother.
Jose sure did a good job. I didn't take long. And then
he was sleeping with Marie. I'm not sure why. Did Jose
wanted to show off as a he man?
One day Marie told her mother. "I'm going to marry. I'm
going to marry Jose". Marie's mother was upset. Jose?
Her lover? No way.
But there was a way. Because Marie was pregnant. Mother
knew she couldn't do nothing about it. She arranged the
wedding. Jose did nothing.
The wedding night. Very special. Marie and Jose went to
their new house. And in no time Jose kicked Marie out
of his house.
Marie went back to her mother. Crying. You know the
mother in law jokes? Well. Jose already had mother
against him. Now even more.
Later she went back to Jose. Jose allowed her to stay
in his house. Even more. They were not sitting still.
They had six more children.
The first child. A son. He had a terrible life. It was
as if Marie was putting all the blame on him. He
shouldn't have been born.
Even if you've got a working place. And there is no
harmony. Have a good read.
Jos
*******************************************************
*******************************************************
*******************************************************
-------------------------------------------------------
3. Hatch 2
-------------------------------------------------------
Now we're going to add a hatch pattern to the smaller
rectangles. We'll do that using a function. The
function works with arguments.
Do you still remember? The function for drawing the
rectangles gives back the name of the rectangle, a
distance, and an angle.
The name of the rectangle, the distance, and the angle
are given to the function for adding the hatch pattern
to the smaller rectangle.
First we must add two lines of code to the main
function. In the tow lines acall is made to the
function for adding the hatch pattern.
Here's how the main function now looks:
1. (defun c:ahtch ()
2. (setvar "cmdecho" 0)
3. (setq om (getvar "osmode"))
4. (setvar "osmode" 0)
5. (command "erase" "all" "")
6. (drrct (list 0 0)
7. (list 0 0)
8. (list 300 250)
9. )
10. (drrct (list 0 0)
11. (list 10 10)
12. (list 290 240)
13. )
14. (setq ls (drrct (list 0 0)
15. (list 50 50)
16. (list 150 100)
17. )
18. e1 (nth 0 ls)
19. d1 (nth 1 ls)
20. a1 (nth 2 ls)
21. )
22. (setq ls (drrct (list 0 0)
23. (list 150 150)
24. (list 250 200)
25. )
26. e2 (nth 0 ls)
27. d2 (nth 1 ls)
28. a2 (nth 2 ls)
29. )
30. (ahtch (list 0 0) e1 d1 a1)
31. (ahtch (list 0 0) e2 d2 a2)
32. (command "zoom" "extents")
33. (command "zoom" "0.9x")
34. (setvar "osmode" om)
35. (setvar "cmdecho" 1)
36. (princ)
37. )
The function for adding a hatch pattern to a rectangle
is called the AHTCH function. The function works with
four arguments.
The first argument is the origin of the UCS. WEe need
that argument for moving the origin of the hatch as the
hatch pattern is drawn.
The second, third, and the fourth arguments are the
arguments that were given back by the function for
drawing a rectangle.
Here's the function for drawing the hatch pattern. The
function is in fact a very simple function. It only
has three lines.
1. (defun ahtch (p0 et ds an)
2. (command "ucs" "or" (polar p0
3. an
4. ds
5. )
6. )
7. (command "hatch" "u" 45 10 "n" et "")
8. (command "ucs" "or" (polar (list 0 0)
9. (+ an pi)
10. ds
11. )
12. )
13. )
In the second until the sixth lines the origin of the
UCS is moved to a new position. Here's where the angle
and the distance is used.
Next the hatch pattern is added to the rectangle. Do
you see how the name of the rectangle is used in the
HATCH command.
In the lines from eight till twelve the origin of the
UCS is set back. Again the angle and the distance is
used for doing that.
For setting back the origin of the UCS we start in
point 0,0. That point is the new origin that was given
to the UCS.
Here's the complete listing of the AutoLISP routine for
drawing the rectangles and adding a hatch pattern to
the smaller rectangles.
(defun c:ahtch ()
(setvar "cmdecho" 0)
(setq om (getvar "osmode"))
(setvar "osmode" 0)
(command "erase" "all" "")
(drrct (list 0 0) (list 0 0) (list 300 250))
(drrct (list 0 0) (list 10 10) (list 290 240))
(setq ls (drrct (list 0 0) (list 50 50) (list 150
100))
e1 (nth 0 ls)
d1 (nth 1 ls)
a1 (nth 2 ls)
)
(setq ls (drrct (list 0 0) (list 150 150) (list 250
200))
e2 (nth 0 ls)
d2 (nth 1 ls)
a2 (nth 2 ls)
)
(ahtch (list 0 0) e1 d1 a1)
(ahtch (list 0 0) e2 d2 a2)
(command "zoom" "extents")
(command "zoom" "0.9x")
(setvar "osmode" om)
(setvar "cmdecho" 1)
(princ)
)
(defun drrct (p0 p1 p2)
(command "rectangle" p1 p2)
(setq ds (distance p0 p1)
an (angle p0 p1)
)
(list (entlast) ds an)
)
(defun ahtch (p0 et ds an)
(command "ucs" "or" (polar p0 an ds))
(command "hatch" "u" 45 10 "n" et "")
(command "ucs" "or" (polar (list 0 0) (+ an pi) ds))
)
Copy the listing to a text file. Save it under the name
AHTCH.LSP. Load it into AutoCAD. And run it by typing
AHTCH at the command prompt.
You will see that rectangles are drawn. And hatch
patterns are added to the two smaller rectangles in the
outer rectangles.
You will also see that the origin of the UCS comes back
to its original positron. That position was point 0,0.
And it still is that point.
Draw a line. Start the LINE command. At the "From
point: " prompt enter "0,0". The line will start in the
point from where the first rectangle is drawn.
That's what we have seen. You can set how a hatch is
added to a drawing. It's all a matter of repositioning
the origin of the UCS.
*******************************************************
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. Paper Space in AutoCAD 2005 4
-------------------------------------------------------
We started with talking about paper space in AutoCAD
2005. You’ve had the first part, the second, and the
third part. Here’s the fourth part.
We can create a new page setup. But let's go the easy
way. We click on the Modify button. The Page Setup
dialog box is displayed.
There are a lot of things we can do in this dialog box.
But we only want to select a printer. We do it in the
Printer/plotter area.
After selecting a printer we click on the OK button.
The Page Setup dialog box closes. We're back in the
Page Setup Manager dialog box.
We don't need to do nothing in that dialog box. We
click on the Close but-ton. The Page Setup Manager
dialog box closes.
Now let's have a look at the how the print will look.
If we print it. We click on the Plot Preview button.
Two things are not correct.
First we see the borders of the floating viewports. We
don't want them. How can we get rid of them? That's the
first thing that must change.
And no border. The drawing has no border. We have
created the A3BORDER drawing. We can add that drawing
to the drawing.
Let's start with the borders of the floating viewports.
You cannot delete them. If you do the complete view is
removed from the drawing.
This is what we do. We put the borders on their own
layer. And then we switch the layer off. The borders
are no longer displayed.
We create the FLOATING VIEWPORT layer. And then we
select the borders and put them on that layer. Click on
the Properties button.
But don't switch the layer off yet. First we're going
to insert the A3BORDER into the drawing. We do it over
the INSERT command.
In the INSERT dialog box we can specify the insertion
point, the scale, and the rotation angle of the block.
That's what we do.
We insert the block with a scale of 0.1. When that is
done we must scale it up the have it fill the complete
drawing.
Now we're done. Maybe we must move the floating
viewports a little. Maybe they are in the lines of the
border.
But now we can print the drawing. First we switch the
FLOATING VIEWPORT layer off. And then we print the
drawing. Very nice.
This is all there is to working in paper space in
AutoCAD 2005. It's indeed very simple and very
convenient.
We had only one drawing. But in the print of the
drawing we find the whole drawing and we find a detail
of the drawing.
*******************************************************
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
*******************************************************
*******************************************************
*******************************************************
_________________________________________________________________
Find love online with MSN Personals.
http://match.msn.com.my/match/mt.cfm?pg=channel
|
|
 |
|