I had a problem. T was drawing two lines. And I wanted to find in what direction the second line went. From the first line.
Here are the two options that I have got. The first line is the bottom line. The upper line is the second line.
Second
line goes to the right
Second
line goes the the left
I
wanted an AutoLISP program that tells me in what direction the second
line goes. Does it go to the right or does it go to the left?
Complications
There
are two complications. Before I talk about the complications I want
to say something about angles in AutoCAD.
You
can have angles in any way you want. But this is the default value
that AutoCAD uses. I use them too. I don't change them.
Do
you see. The size of the angles increase counter clockwise. And the
zero angle is in the east.
The
first complication is: how can we find in what angle the second line
goes? This is how I do it. I look at the angle of the first line.
Here
is how it is. See the next picture. The first line is drawn from P1
to P2. The second line is drawn from P2 to P3.
What
I did. I extended the first line. And I looked at the area of the
second line. It is in the area between two angles.
It
is in the area between the angle P1 and P2 and the angle P1 and P2
plus 180 degrees. So the second line goes to the left.
I
have solved the first complication. Just look at the area in which
the second line goes. Then I know whether is goes to the left or to
the right.
But
we have a second complication. Look at the picture. The angle of the
first line is 315 degrees and the second line 45 degrees.
We
can make a calculation with the angle of the line from P1 to P2. But
the angle from the second line never fits into it.
In
fact. We have this complication all the time when the angle of the
first line is more than 180 degrees.
What
can be done about it? Easy. Increase the angle of the second line
with 360 degrees.
In
our example. The angle of the first line is 315 degrees. That is more
than 180 degrees. So the angle of the second line is 360 degrees
more.
The
angle of the second line is 405 degrees. That is between 315 degrees
and 495 degrees. So the second line goes to the left.
I
have done a lot of thinking. It took me a whole day and a night to
figure out what I wrote down here.
Next
Post
We
have figured out how we can find the direction of the second line in
reference to the first line. Now you want to see the AutoLISP
program.
In
my next post is my AutoLISP program. I will tell you what is does and
how it works. You will get an explanation in my next pot.
Telling
Others
Do you like what you have read? Do you know other people, that could be interested? Could you tell them about this blog? |
Comment
In the mean time. If you have any questions. Or you want to tell me something. Feel free to add a comment to this blog. I would love to hear from you. And when you come to me with a comment. I will give a reply to your question or remark. |
Warning Don't spend a lot of money on AutoCAD Light. It is only for creating 2D drawings and it doesn't support AutoLISP. There is a very similar CAD program. And that is completely free. The name of the program? DraftSight. How to get it? Do a search on Google for “download DraftSight”. And you will find where you can download the program. |
Only
Create Drawings When your CAD operators don't create the borders of your drawings, a lot of time is saved. You get your drawings much faster. I have created a program that does exactly that. An AutoCAD drawing has been created and the program draws a border around it. If you want to see how the program works, go to YouTube. You'll find the working of the program here: http://www.youtu.be/O8Zy6n9zS8Q Now the AutoLISP program gives you the choice to select the size of your border. You can select A4, A3, A2, or A1. Maybe you already know the size of the border of your drawing. Maybe all your drawings have the size A1. If so. Let me know. That is important. The program finds the proper scale of your drawing. Or do you already know what the scale always is? I can write the AutoLISP program that you want. The price? I will only charge you RM 600.-. That is less than US $ 200.-. |
You are welcome to publish my article provided you include the resource box with links intact. |
Resource
Box Jos van Doorn is an AutoLISP programmer and blogger. He is originally from Holland and now he lives in Malaysia. He is the founder of the Make AutoCAD Fast business. Make AutoCAD Fast is writing AutoLISP programs for AutoCAD users. Make AutoCAD Fast created an AutoLISP program for drawing a border around AutoCAD drawings. The program can be found on YouTube. http://www.youtu.be/O8Zy6n9zS8Q Jos is writing a blog. In it are AutoLISP programs with information and it is about Make AutoCAD Fast. You can find his blog here: http://www.makeautocadfast.blogspot.com Maybe you have a question. Or want to tell me something. You can contact me on this e-mail address: makeautocadfast@ymail.com |
This article may be
freely reprinted or distributed in its entirety in any Ezine,
newsletter, blog, or website. As long as the following resource
box is added: ------------------------------------------------- This article is written by Jos van Doorn. He is an AutoLISP programmer who has helped engineering firms and architects to get their AutoCAD drawings fast, without waiting for hours. You can find more valuable information about his business and AutoLISP at his blog. It is here: http://www.makeautocadfast.blogspot.com If you want to contact him. Go to his blog and leave a comment. ------------------------------------------------- |
No comments:
Post a Comment