Showing posts with label fillet function. Show all posts
Showing posts with label fillet function. Show all posts

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