Saturday, November 30, 2013

AutoLISP And Finding A Direction 2

Introduction


In the previous post I promised you that here you'll get my AutoLISP program. Well. Here it is. With an explanation and how it works.


The AutoLISP program


(defun c:fnddr (/ dr e1 e2 e3 e4 e5 e6 ls p1 p2
p3
)
(start)
(setq p1 (getpoint "\nP1: ")
p2 (getpoint "\nP2: " p1)
)
(command "line" p1 p2 "")
(while (setq p3 (getpoint "\nP3: " p2))
(command "line" p2 p3 "")
(setq dr (fnddr p1 p2 p3))
(princ "\nDirection: ")
(princ dr)
(setq p1 p2
p2 p3
)
)
(endpr)
)


(defun start (/ ss)
(setvar "cmdecho" 0)
(textscr)
(command "limits" (list 0 0)
(list 420 297)
)
(command "snap" 10)
(command "grid" 10)
(setq ss (ssget "c" (list 0 0)
(list 420 297)
)
)
(if ss
(command "erase" "all" "")
)
(command "zoom" "all")
(command "zoom" "0.8x")
)


(defun fnddr (p1 p2 p3 / a1 a2 an dr)
(setq a1 (angle p1 p2)
a2 (angle p2 p3)
)
(if (> a1 pi)
(setq a2 (+ a2 (* pi 2)))
)
(princ "\nA1: ")
(princ (antdg a1))
(princ "\nA1 + pi: ")
(princ (antdg (+ a1 pi)))
(princ "\nA2: ")
(princ (antdg a2))
(if (and (< a1 a2)
(> (+ a1 pi) a2)
)
(setq dr "left")
(setq dr "right")
)
dr
)


(defun antdg (an)
(* (/ an pi) 180)
)


(defun endpr ()
(setvar "cmdecho" 1)
(princ)
)


(c:fnddr)


What The Program Does


Copy the program to a text file, save it under the name FNDDR.LSP, and run the program in AutoCAD or any other suitable CAD program.


The program starts right away. There is asked to pick a point in the screen. That point is P1. Next there is asked to pick point P2.


A line is drawn from P1 to P2. And then there is asked to pick point P3. Again a line is drawn. This time from P2 to P3.


The angles of the line from P1 to P2 and the angle of the line from P2 to P3 is printed in the screen. Also the direction is given.


Again there is asked for point P3. If you want to stop with the program, then press the right mouse button or the ENTER key.


An Example Of The Program


See the picture. It gives an example of how the program works. Eight lines have been drawn. The angles and direction are given.


How The Program Works


The AutoLISP program start with the START function. You already know how that function works. No explanation.


There is asked for the points P1 and P2. And a line is drawn between these two points. And then a WHILE loop starts.



The WHILE loop continues as long as the point P3 is picked. In the WHILE loop a line is drawn and the direction is found.


The line is drawn from point P2 to point P3. And the direction is found in the function FNDDR. I talk about it later.


The direction is printed in the screen. After that the value of the points P1 and P2 are changed. P1 becomes P2 and P2 becomes P3.


The FNDDR Function


Here is the FNDDR function.


(defun fnddr (p1 p2 p3 / a1 a2 an dr)
(setq a1 (angle p1 p2)
a2 (angle p2 p3)
)
(if (> a1 pi)
(setq a2 (+ a2 (* pi 2)))
)
(princ "\nA1: ")
(princ (antdg a1))
(princ "\nA1 + pi: ")
(princ (antdg (+ a1 pi)))
(princ "\nA2: ")
(princ (antdg a2))
(if (and (< a1 a2)
(> (+ a1 pi) a2)
)
(setq dr "left")
(setq dr "right")
)
dr
)


(defun antdg (an)
(* (/ an pi) 180)
)


The angle between the points P1 and P2 is found and the angle between the points P2 and P3. Those angels are stored in the variables A1 and A2.


If the angle A1 is more than 180 degrees, then the value is increased with 360 degrees. That is done with the IF function.


The angles are written down and the direction of the second line is found. The area of the second angle is checked.


We also have the ANTDG function. That function is used to turn angels in radians into angels in degrees.


The Complete AutoLISP Program


Very good. Now you have got the complete AutoLISP program. With an explanation of it and an explanation of how it works.




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.
-------------------------------------------------


Friday, November 29, 2013

AutoLISP And Finding A Direction 1

Introduction


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.
-------------------------------------------------


Thursday, November 28, 2013

Tell Me What You Want To Know

August 2013


You have been reading my blog for a while now. I started with it in August 2013. I was talking about AutoLISP programs.


Blog Posts


I gave you AutoLISP programs and I have told you how the programming of those programs have been done. I gave an explanation.


I was also talking about saving time with AutoCAD. And I was talking about saving money with AutoCAD. You can do it with AutoLISP.


I was talking about AutoCAD. I talked about the truth of AutoCAD and I gave you five alternatives for AutoCAD.


What You Want


But what I was posting in my blog. Was that what you wanted to read? Did you want to learn about AutoLISP and AutoCAD?


I have written an awful lot of AutoLISP programs. And I know about AutoCAD and alternatives for AutoCAD.


Where I have been writing about it. I had my own ideas. I thought I was giving you good information. But was I?


Look. That is how I feel that it should be. I should write about what you want to know. And now what I think is good.


Comment


I would like to know. Could you tell me what you want to know? You could add a comment to this blog. If you do, I'll write about it.


What you want to know. Maybe you are having difficulties with an AutoLISP program. Let me know and I'll help you to fix it.


Make AutoCAD Fast


Oh. Make AutoCAD Fast is my business. You could ask me to write an AutoLISP program for you. But don't feel obliged to do so.


The information of this blog is free. Anybody can read this. Even if you don't want to engage me for an AutoLISP job.



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.
-------------------------------------------------








Wednesday, November 27, 2013

The Inters Function Of AutoLISP 2

Introduction


You have seen the AutoLISP program for the INTERS function. You have seen the images that are produced and you have seen the listing.


Functions


Now I'm going to talk about the functions of the AutoLISP program. Here is a list of all the functions and what they do.


Function Task


START Starting the program
DRWLN Drawing lines
DRWDN Drawing the donut
ENDPR Ending the program


The START Function And The ENDPR Function


In previous posts I have been talking about those two functions. I have explained how they work. So I can skip talking about them.


The DRWLN Function


Here is the function:


(defun drwln (tx / p1 p2)
(setq p1 (getpoint (strcat tx " - point 1: "))
p2 (getpoint (strcat tx " - point 2: "))
)
(command "line" p1 p2 "")
(list (list p1) (list p2))
)


From the main progrma a call is made to the function. Two times. And a text is given to the function.


The first time the text is “First line” and the second time the text is “Second line”. The text comes in the GETPOINT function.


With the GETPOINT function two points are picked. The points are given back to the main program. An there they are given names.


The first time the two points are given the names P1 and P2. The second time the points are given the names P3 and P4.


In the DRWLN function not only two points are entered. There is also a line drawn between those two points.


The DRWDN Function


Here is the function:


(defun drwdn (p1 p2 p3 p4 / p5)
(setq p5 (inters p1 p2 p3 p4))
(if p5
(princ "\nThe lines cross")
(progn
(princ "\nThe lines don't cross")
(setq p5 (inters p1 p2 p3 p4 nil))
)
)
(command "donut" 0 0.5 p5 "")
)


The points P1, P2, P3, and P4 are given to the function. The ITERS function is used to find the point where the lines cross.


But maybe the lines do not cross. If so. The INTERS function gives back the variable P5. And then the variable has no value.


If the P5 variable has no value, we want to find the point where the extension of the lines cross. We use the INTERS function again.


But this time the four points are given to the function. And behind the four points is added NIL. Now is found where the extended lines cross.


Whatever. We have found P5. And a donut can be drawn in the place of P5. That is all that is done in this function.


The Whole AutoLISP Program


You have now had the whole AutoLISP program and an explanation of it. Now you have seen how the whole AutoLISP program is.




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.
-------------------------------------------------


The Inters Function Of AutoLISP 1

Introduction


Now I'm going to talk about the INTERS function of AutoLISP. You know what the INTERS function does. It finds the point where two line cross.


I can also find the find where the extension of tow lines cross. But then the use is a little bit different.


What The AutoLISP Program Does


The AutoLISP starts. Id there is something in the screen, then it is deleted. We start with an empty screen.


The AutoLISP program asks us to pick two points for the first line and two points for the second line. The lines are drawn.


Now two things can happen:


1. The lines cross
2. The lines don't cross


If the lines cross, then see what you will get in the AutoCAD screen. A donut is drawn in the point where the lines cross.


If the lines do not cross, then a donut is drawn where the extended lines cross. Look at the picture that I have got.


That is clear. No matter if the lines cross or don't cross. A donut is drawn where the lines cross or the extended lines cross.



The AutoLISP Program


Here is the AutoLISP program:


(defun c:inter (/ ls p1 p2 p3 p4)
(start)
(setq ls (drwln "\nFirst line")
p1 (car (nth 0 ls))
p2 (car (nth 1 ls))
)
(setq ls (drwln "\nSecond line")
p3 (car (nth 0 ls))
p4 (car (nth 1 ls))
)
(drwdn p1 p2 p3 p4)
(endpr)
)


(defun start (/ p1 p2 ss)
(setvar "cmdecho" 0)
(command "zoom" "all")
(setq p1 (getvar "vsmin")
p2 (getvar "vsmax")
ss (ssget "c" p1 p2)
)
(if ss
(command "erase" "all" "")
)
)


(defun drwln (tx / p1 p2)
(setq p1 (getpoint (strcat tx " - point 1: "))
p2 (getpoint (strcat tx " - point 2: "))
)
(command "line" p1 p2 "")
(list (list p1) (list p2))
)


(defun drwdn (p1 p2 p3 p4 / p5)
(setq p5 (inters p1 p2 p3 p4))
(if p5
(princ "\nThe lines cross")
(progn
(princ "\nThe lines don't cross")
(setq p5 (inters p1 p2 p3 p4 nil))
)
)
(command "donut" 0 0.5 p5 "")
)


(defun endpr ()
(setvar "cmdecho" 1)
(princ)
)


(c:inter)


Next Post


In the next post I'm going to talk about the functions of the AutoLISP program. I'm also going to explain how they work.




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.
-------------------------------------------------


Tuesday, November 26, 2013

Get Your AutoCAD Drawings Right Away And Save A Lot Of Money 2


Now we are going to talk about the listing of the AutoLISP application. You saw the listing of the AutoLI application in the previous post.


As you have seen there are functions in the AutoLISP application. Here is a list of the functions and what they do.



The Functions


Function Task


START Start of the application
MKLAY Creating layers of the application
DRFRV Drawing the front view
DRSDV Drawing the side view
DRTPV Drawing the top view
STDMV Setting the dimension variables
DMFRV Dimensioning the front view
DMSDV Dimensioning the side view
DMTPV Dimensioning the top view
DRWHD Drawing the drawing head
DRBRD Drawing the border
ENDPR Ending the application


An Explanation Of The Functions


I already have talked about the START function and the ENDPR function. So I can forget about talking of them now.


You see how all the layers of the AutoCAD drawing have been created. The LAYER command is used and the Make option of it.


The front view, side view and the top view is drawn by using the LINE command. That is imp[ortant. A start point is used.


The start point is specified in the main program. It is the point (LIST 25 100). The point is given to all the draw functions.


Before the dimension can be drawn the dimension variables must be set. It is done in the STDMV function.


Maybe you like the way in which the dimensions were drawn. If so and you want to know what variables are used. See how I did it.


How the dimensions of the front view, the side view and the top view are drawn. That is very clear. The DIMLINEAR function is used.


For the drawing head the text “Make AutoCAD Fast” is drawn. And a line around the text is drawn. It is a very simple drawing head.


For the border two rectangles are drawn. The size of the drawing is A4. The points of the rectangles are set with LIST commands.


The Complete Explanation


That is it. This is the complete explanation of the AutoLISP application. The AutoLISP application was not too complicated.




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:


Make AutoCAD Fast
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


Get Your AutoCAD Drawings Right Away And Save A Lot Of Money 1




That is the question most AutoCAD users have. I'm not sure if they did. But let's say they have heard about AutoLISP.


Maybe they know that you can write applications in AutoLISP. But they are not sure whether they should get an AutoLISP application.


That is the question most AutoCAD users have. Why should you get an AutoLISP application? What is the advantage of an AutoLISP application?


The Advantage Of An AutoLISP Application


Let me tell you what the advantage of an AutoLISP application is. You can use it for creating complete AutoCAD drawings.


And when an AutoLISP application is used for creating an AutoCAD drawing, it is done in no time. You don't have to wait for hours.


That is great. But how fast is an AutoLISP application with creating an AutoCAD drawing. How much time can you save?


An AutoLISP Application


I have created an AutoLISP application that demonstrates how fast an AutoLISP application is. It creates an AutoCAD drawing.


I could have added a dialog box to it for entering the sizes. But I did not do that. I wanted to show how fast an AutoLISP application is.


See the drawing that is created by the AutoLISP application. It took less than one second to create the AutoCAD drawing.




The Listing Of The AutoLISP Program


But you want the have the listing of the AutoLISP program. OK. You will get it. Copy it to a text file and save it under the name MKACF.LSP.


(defun c:mkacf ()
(start)
(setq sp (list 25 100))
(mklay)
(drfrv sp)
(drsdv sp)
(drtpv sp)
(stdmv)
(dmfrv sp)
(dmsdv sp)
(dmtpv sp)
(drwhd)
(drbrd)
(endpr)
)


(defun start (/ ss)
(setvar "cmdecho" 0)
(command "zoom" "extents")
(setq p1 (getvar "vsmin")
p2 (getvar "vsmax")
)
(setq ss (ssget "c" p1 p2))
(if ss
(command "erase" "all" "")
)
(command "-style" ""
"Courier New"
0
1
0
"No"
"No"
)
)


(defun mklay ()
(if (null (tblsearch "layer" "070"))
(command "layer" "m"
"070"
"c"
"cyan"
""
""
)
)
(if (null (tblsearch "layer" "050"))
(command "layer" "m"
"050"
"c"
"green"
""
""
)
)
(if (null (tblsearch "layer" "025"))
(command "layer" "m"
"025"
"c"
"red"
""
""
)
)
(if (null (tblsearch "layer" "center"))
(command "layer" "m"
"center"
"c"
"red"
""
"lt"
"center"
""
""
)
)
(if (null (tblsearch "layer" "dimensions"))
(command "layer" "m"
"dimensions"
"c"
"red"
""
""
)
)
(command "ltscale" 10)
)


(defun drfrv (sp)
(command "layer" "s" "center" "")
(command "line" (setq pt sp)
(polar pt 0 210)
""
)
(command "layer" "s" "050" "")
(command "line" (setq pt (polar sp 0 5)
pt (polar pt
(* pi 1.5)
37.5
)
)
(setq pt (polar pt 0 50))
""
)
(command "line" (setq pt (polar pt 0 25))
(setq pt (polar pt 0 125))
(setq pt (polar pt
(* pi 0.5)
75
)
)
(setq pt (polar pt pi 125))
""
)
(command "line" (setq pt (polar pt pi 25))
(setq pt (polar pt pi 50))
(setq pt (polar pt
(* pi 1.5)
75
)
)
""
)
(command "line" (setq pt (polar pt 0 50)
pt (polar pt
(* pi 1.5)
12.5
)
)
(setq pt (polar pt 0 25))
(setq pt (polar pt
(* pi 0.5)
100
)
)
(polar pt pi 25)
"c"
)
(command "line" pt
(setq pt (polar pt 0 125))
(polar pt (* pi 1.5) 12.5)
""
)
)
(defun drsdv (sp)
(command "layer" "s" "center" "")
(command "line" (setq pt (polar sp 0 220))
(polar pt 0 110)
""
)
(setq pt (polar pt 0 55))
(command "line" (polar pt (* pi 0.5) 55)
(polar pt (* pi 1.5) 55)
""
)
(command "layer" "s" "050" "")
(command "circle" pt 37.5)
(command "circle" pt 50)
(command "line" (setq pt (polar pt (* pi 0.5) 10)
pt (polar pt pi 5)
)
(polar pt (* pi 0.5) 60)
""
)
(setq et (entlast)
el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(command "trim" "" p1 p2 "")
(command "line" (setq pt (polar pt 0 10))
(polar pt (* pi 0.5) 60)
""
)
(setq et (entlast)
el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(command "trim" "" p1 p2 "")
)


(defun drtpv (sp)
(command "layer" "s" "center" "")
(command "line" (setq pt (polar sp
(* pi 0.5)
120
)
)
(polar pt 0 210)
""
)
(command "layer" "s" "050" "")
(command "line" (setq pt (polar pt 0 5)
pt (polar pt
(* pi 1.5)
37.5
)
)
(setq pt (polar pt 0 50))
""
)
(command "line" (setq pt (polar pt 0 25))
(setq pt (polar pt 0 125))
(setq pt (polar pt
(* pi 0.5)
75
)
)
(setq pt (polar pt pi 125))
""
)
(command "line" (setq pt (polar pt pi 25))
(setq pt (polar pt pi 50))
(setq pt (polar pt
(* pi 1.5)
75
)
)
""
)
(command "line" (setq pt (polar pt 0 50)
pt (polar pt
(* pi 1.5)
12.5
)
)
(setq pt (polar pt 0 25))
(setq pt (polar pt
(* pi 0.5)
100
)
)
(setq pt (polar pt pi 25))
"c"
)
(command "line" (setq pt (polar pt 0 25)
pt (polar pt
(* pi 1.5)
45
)
)
(polar pt 0 125)
""
)
(command "line" (setq pt (polar pt
(* pi 1.5)
10
)
)
(polar pt 0 125)
""
)
)


(defun stdmv ()
(command "layer" "s" "dimensions" "")
(command "-style"
"dimension"
"courier new"
0
1
0
"no"
"no"
)
(setvar "dimasz" 5)
(setvar "dimcen" 5)
(setvar "dimclrt" 2)
(setvar "dimdec" 0)
(setvar "dimdli" 1.25)
(setvar "dimexe" 1.25)
(setvar "dimexo" 1.25)
(setvar "dimgap" 1.25)
(setvar "dimtad" 1)
(setvar "dimtdec" 0)
(setvar "dimtih" 0)
(setvar "dimtoh" 0)
(setvar "dimtvp" 1.25)
(setvar "dimtxsty" "dimension")
(setvar "dimtxt" 5)
)


(defun dmfrv (sp)
(command "dimlinear"
(setq pt (polar sp 0 5)
pt (polar pt (* pi 1.5) 37.5)
)
(setq pt (polar pt 0 50)
pt (polar pt (* pi 1.5) 12.5)
)
(polar pt (* pi 1.5) 20)
)
(command "dimlinear"
pt
(setq pt (polar pt 0 25))
(polar pt (* pi 1.5) 20)
)
(command "dimlinear"
pt
(setq pt (polar pt 0 125)
pt (polar pt (* pi 0.5) 12.5)
)
(polar pt (* pi 1.5) 32.5)
)
)


(defun dmsdv (sp)
(command "dimlinear"
(setq pt (polar sp 0 275)
pt (polar pt (* pi 0.5) 37.5)
)
(polar pt (* pi 1.5) 75)
(polar pt 0 70)
)
(command "dimlinear"
(setq pt (polar pt (* pi 0.5) 12.5))
(polar pt (* pi 1.5) 100)
(polar pt 0 85)
)
)


(defun dmtpv (sp)
(command "dimlinear"
(setq pt (polar sp (* pi 0.5) 125)
pt (polar pt 0 205)
)
(polar pt (* pi 1.5) 10)
(polar pt 0 15)
)
)


(defun drwhd ()
(command "layer" "s" "070" "")
(command "text" "r"
(setq pt (polar (list 0 0)
0
407.5
)
pt (polar pt
(* pi 0.5)
12.5
)
)
7.5
0
"Make AutoCAD Fast"
)
(command "line" (setq pt (polar pt 0 2.5)
pt (polar pt
(* pi 0.5)
10
)
)
(setq pt (polar pt pi 143))
(polar pt (* pi 1.5) 12.5)
""
)
)


(defun drbrd ()
(command "layer" "s" "025" "")
(command "line" (list 0 0)
(list 420 0)
(list 420 297)
(list 0 297)
"c"
)
(command "layer" "s" "070" "")
(command "line" (list 10 10)
(list 410 10)
(list 410 287)
(list 10 287)
"c"
)
(command "zoom" "extents")
(command "zoom" "0.8x")
)


(defun endpr ()
(setvar "cmdecho" 1)
(princ)
)


(c:mkacf)


Next Post


In the next post I will give a full explanation of the AutoLISP program. I will tell how it was written.




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://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:


Make AutoCAD Fast
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