Showing posts with label Donuts. save time. Show all posts
Showing posts with label Donuts. save time. Show all posts

Sunday, January 19, 2014

AutoLISP Program Drawing Donuts And A Hatch 1

Introduction


I have an AutoLISP program. At the start it draws a room. This is how the room looks. It is pretty straight forward.




After the room has been drawn there is asked to pick point in the room. When that is done, the donuts are drawn and a hatch is added.


This is what you get. See the donuts that have been added and see the hatch that can be found in the room.




The AutoLISP Program


I know. Now you expect me to give you the AutoLISP program. Very good. Here is the complete AutoLISP program.


(defun c:dnsrm (/ pt et ls)
(start)
(drlns)
(setq pt (getpoint "\nPoint in room: "))
(setq et (fndet pt))
(setq ls (fndls et))
(drwdn ls)
(command "-bhatch" "p"
"ANSI31"
50
0
(list 60 60)
""
)
(endpr)
)


(defun start (/ ss p1 p2)
(setvar "cmdecho" 0)
(command "blipmode" "off")
(command "limits" (list 0.0 0.0)
(list 120.0 120.0)
)
(command "snap" "on")
(command "snap" 10)
(command "grid" 10)
(command "zoom" "all")
(command "zoom" "0.8x")
(setq p1 (getvar "vsmin")
p2 (getvar "vsmax")
)
(setq ss (ssget "c" p1 p2))
(if ss
(command "erase" "all" "")
)
)


(defun drlns ()
(command "line" (list 10 10)
(list 30 10)
(list 30 30)
(list 60 30)
(list 60 10)
(list 110 10)
(list 110 110)
(list 10 110)
"c"
)
)


(defun fndet (pt / ds ss)
(setq ds 10
ss nil
)
(while (null ss)
(setq ss (ssget "c"
pt
(polar pt 0 ds)
)
)
(if ss
(setq et (ssname ss 0))
(setq ds (+ ds 10))
)
)
et
)


(defun fndls (et / fe cn el p1 p2 ls ss et pt)
(setq fe et
cn T
el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
ls (list p2)
ls (append (list p1) ls)
)
(while cn
(setq ss (ssget "c" p1 p1)
e1 (ssname ss 0)
)
(if (equal e1 et)
(setq et (ssname ss 1))
(setq et e1)
)
(setq el (entget et)
pt (cdr (assoc 10 el))
)
(if (equal pt p1)
(setq p1 (cdr (assoc 11 el)))
(setq p1 pt)
)
(setq ls (append (list pt) ls))
(if (equal et fe)
(setq cn nil)
)
)
ls
)


(defun drwdn (ls / ct)
(setq ct 0)
(while (setq pt (nth ct ls))
(command "donut" 0 2.5 pt "")
(setq ct (1+ ct))
)
)


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


(c:dnsrm)


Next Post


In the next post I'm going to talk about all the functions that can be found in the AutoLISP program. I will explain how they work.


Telling Others


Do you like what you have read? Do you know other people, that also could be interested in what I'm saying? 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.


YouTube


I have added videos to YouTube. The videos give examples of my AutoLISP programming work. You could engage me if you want.


If you are thinking of engaging me. Listen. I work for free. I write an AutoLISP program for you. You only pay when you are satisfied.


That is important. When you come to me with an AutoLISP programming job, you are not spending any money.


On YouTube you can find my videos here:


http://youtu.be/zgTWKo7DpeM
http://youtu.be/sd-sbyM3-d8
http://youtu.be/2yhk7G5KlAs
http://youtu.be/mEA6lymElqI
http://youtu.be/eyOdOTHPH-o
http://youtu.be/O8Zy6n9zS8Q
http://youtu.be/5sMBtfnnizk
http://youtu.be/QrmbXvmFa2o
http://youtu.be/4Ol-YpDC2MY
http://youtu.be/DWFke-Nie0E


Drawing A Z Profile In AutoLISP

There was a request on an AutoLISP forum. Pity. I do not know exactly what AutoLISP forum. I did not write it drown.


Z Profile


A man wanted an AutoLISP profile that could draw a Z profile. That is how he called it. He called it a Z profile. Here it is.




The Z profile has got six sizes. I has got three length sizes: L1, L2, and L3. And three thickness sizes: T1, T2, and T3.


I wrote an AutoLISP program for him that could draws the Z profile. You must enter the sizes first.


I could have created an AutoLISP program that works with a dialog box. I did not do that. I kept the program simple.


The AutoLISP Program


Here is the AutoLISP program.


(defun c:drzpr ()
(start)
(setq ls (fdszs)
l1 (nth 0 ls)
l2 (nth 0 ls)
l3 (nth 0 ls)
s1 (nth 0 ls)
s2 (nth 0 ls)
s3 (nth 0 ls)
)
(drzpr l1 l2 l3 t1 t2 t3)
(endpr)
)


(defun start (/ ss)
(setvar "cmdecho" 0)
(command "limits" (list 0 0)
(list 120 120)
)
(command "snap" 10)
(command "grid" 10)
(command "zoom" "all")
(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"
)
(command "zoom" "all")
(command "zoom" "0.8x")
)


(defun fdszs (/ l1 l2 l3 t1 t2 t3)
(setq l1 (getint "\nL1: ")
l2 (getint "\nL2: ")
l3 (getint "\nL3: ")
t1 (getint "\nT1: ")
t2 (getint "\nT2: ")
t3 (getint "\nT3: ")
)
(list l1 l2 l3 t1 t2 t3)
)


(defun drzpr (l1 l2 l3 t1 t2 t3 / pt)
(command "line" (setq pt (polar (list 0 0)
(* pi 0.5)
l2
)
)
(setq pt (polar pt
0
l1
)
)
(setq pt (polar pt
(* pi 1.5)
(- l2 t1)
)
)
(setq pt (polar pt
0
(- l3 t2)
)
)
(setq pt (polar pt
(* pi 1.5)
t1
)
)
(setq pt (polar pt
pi
l3
)
)
(setq pt (polar pt
(* pi 0.5)
(- l2 t3)
)
)
(setq pt (polar pt
pi
(- l1 l2)
)
)
"c"
)
)


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


(c:drzpr)


The Functions


There is not much to say about the AutoLISP program. You see the START function and the ENDPR function. You know how they work.


For entering the sizes the GETINT function is used. My guess is that users only want to enter integer values.


In the function for drawing the Z profile the LINE command is used. Points are found and at the end of the LINE command there is a CLOSE.




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, December 17, 2013

Is It Really Wrong To Get Your AutoLISP Drawings Right Away?

You are working with AutoCAD. You are using the program for creating technical drawings. You know how it is. You must always wait.


It takes hours, sometimes even days, before your AutoCAD drawing is created. And once it is created. You cannot use it right away.


The AutoCAD drawing needs to be checked. And if that is needed, it needs to be corrected. That takes time too.


IntelliCAD Or Another Alternative


Wait. I was talking about AutoCAD. But maybe you are working with IntelliCAD or another alternative of AutoCAD.


That doesn't make a difference. You still have to wait a long time before your CAD drawing has been finished and can be used.


Option


Is this how it always is? No. You have the option to save a lot of time. That is done by working with AutoLISP programs.


With an AutoLISP program you can create AutoCAD drawing right away. There is no waiting for hours. There is no checking of the drawing.


You can even create parts of your AutoCAD drawing. Do the parts that are drawn all the time. You will save a lot of time.


Interested


If you are interested in getting an AutoLISP program for creating AutoCAD drawings or parts of it. I can help you.




I can write an AutoLISP program for you. For a very affordable price. Use the program and in no time you have your investment back.


Moron


Oh. I opened this article with a question. Let me tell you why. I have asked this question on Yahoo Answers.


One person was telling me that it is very good to wait for hours before your AutoCAD drawing is created.


He was telling me. If you wait for hours, then you get the chance to learn everything from the AutoCAD program.


I told him that I was not interested in learning everything of the AutoCAD program. I want my AutoCAD drawings without waiting.


I guess he did not agree with me. Wanting your AutoCAD drawing right away? The person did not agree. He called me a moron.


Prefer To Wait For Hours?


Do you too prefer to wait for hours? Do you find me a moron too, because I want AutoCAD drawings right away?


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 20, 2013

AutoLISP Program For Drawing A Border

Introduction


That is what all AutoCAD people have. It is a problem. And AutoCAD drawing is created and then a border needs to be drawn around it.


Drawing the border takes time. The border also has a drawing head. And filling in the drawing head takes a lot of time too.


The Solution


Here is a solution for that problem. It is an AutoCAD program that draws the border and the drawing head once the drawing is finished.


This program works with a dialog box. In it you can select the size of the border that you want: A4, A3, A2, or A1.


How The AutoLISP Program Works


At the start of the program an AutoCAD drawing is created. The drawing represents the three views of an AutoCAD drawing. See the drawing.


Next a dialog box is displayed. In the dialog box the user can select the format of the border that he wants. It can be A4, A3, A2, or A1.


Once the selection is made, the border is drawn. The scale of the drawign is calcualted by the AutoLISP program.


The scale of the drawing and the size of the drawing is written to the drawing. Have a look at the drawing and see how it looks.






That is important. The AutoLISP program shows what can be done. The colors of the border lines is not correct.


There hasn't been drawn a real drawing head. But if you want. We can adjust the AutoLISP program to make it as you want.


Something else. The user of the AutoLISP program can select a format for the border. But maybe he already knows what format he wants.


If that is so, then the dialog box can be omitted for the AutoLISP program. Let me know what you want. And I write the program for you.


Contact


If you are interested and you would like to get the AutoLISP program. Get in touch. You can give me a call. This is my telephone number in Malaysia:


012-9312742


If you call me from outside Malaysia you must dial the following number:


006012-9312742


Jos van Doorn


Oh. I have created a video in which the program is explained. Here is the video:






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


Sunday, November 17, 2013

Who Else Wants An AutoLISP Training?

Training




After writing an AutoLISP program, I give the complete program to my customer. The listing of the program is not hidden.


I want my customer to see how the program was written. And I want him and his staff to understand how the program works.


To have an understanding of AutoLISP and to see how it works. It is important for my customer and his staff that they know AutoLISP.


I have an e-book. The e-book is an AutoLISP course. I give the e-book to my customers and his staff. So they learn AutoLISP.


That is what I also do. I show the AutoLISP program to my customer. If he likes it, then he gets it. But there is more.


I give an explanation of the AutoLISP program to my customer and his staff. I want my customer and his staff to know how it works.


Once the customer and his staff know how the AutoLISP program works, then they can make changes to it. If they want.


If there is asked for, then I also give an AutoLISP training to my customer and his staff. In person. I will answer all their questions.


Next Post


So you are thinking of engaging Make AutoCAD Fast for writing an AutoLISP program. But you are a first time customer. How is that?




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


AutoLISP And Lines Around A Text In AutoLISP

Introduction


The AutoLISP program, that I have got, is not too complicated. You select a text, you enter a space, and lines are drawn around the text.


The AutoLISP Program


Here is the AutoLISP program. A text is selected, the spacing between the text and the liens are entered, and the lines are drawn.


(defun c:txtbx (/ ls et sp ls lg ip ht al)
(setvar "cmdecho" 0)
(setq ls (sssel)
et (nth 0 ls)
sp (nth 1 ls)
)
(setq ls (fndsz et)
lg (nth 0 ls)
ip (nth 1 ls)
ht (nth 2 ls)
al (nth 3 ls)
)
(drlns sp lg ip ht al)
(setvar "cmdecho" 1)
(princ)
)


(defun sssel (/ et sp)
(setq et (car (entsel "\nSelect text: "))
sp (getint "\nSpace around text: ")
)
(list et sp)
)


(defun fndsz (et / el ls p1 p2 lg ip ht al)
(setq el (entget et)
ls (textbox el)
)
(setq p1 (nth 0 ls)
p2 (nth 1 ls)
lg (- (car p2) (car p1))
ip (cdr (assoc 10 el))
ht (cdr (assoc 40 el))
al (cdr (assoc 72 el))
)
(list lg ip ht al)
)


(defun drlns (sp lg ip ht al)
(if (= al 4)
(setq ip (polar ip (* pi 0.5) (* ht 0.5)))
)
(setq ip (polar ip pi sp)
ip (polar ip (* pi 1.5) sp)
)
(command "line" ip
(setq ip (polar ip
0
(+ lg (* sp 2))
)
)
(setq ip (polar ip
(* pi 0.5)
(+ ht (* sp 2))
)
)
(polar ip pi (+ lg (* sp 2)))
"c"
)
)


(c:txtbx)


Three Functions


The TXTBX AutoLISP program works with three functions:


1. SSSEL
2. FNDSZ
3. DRLNS


The first function is for selecting a text and for entering the spacing between the text and the lines.


In the second function the sizes of the text are found. This is what is found:


- The length of the text
- The insertion point of the text
- The height of then text
- The alignment of the text


In the third function the lines are drawn around the text. There is a consideration for the spacing that has been entered.


The Alignment Of The Text


I must explain something about the alignment of the text. A text can have the following alignments:


- Left
- Center
- Middle
- Right
- Bottom left
- Bottom Center
- Bottom Right
- Middle left
- Middle Center
- Middle Right
- Bottom left
- Bottom Center
- Bottom Right


The alignment of the text can be found in the entry list of the text. It has the number 72. But it is no really important.


In the entity list the insertion point of the text is found. It is at the bottom left of the text. Except when the alignment is middle.


If the alignment of the text is middle then the insertion point is below the bottom left of the text. It is half the height lower.


You can see that the alignment of the text is middle. If is found in the entity list. There you find (72 . 4).


Look at the DRLNS function. In it is checked what the alignment of the text is. If it is 4, then the insertion point is adjusted.


How The AutoLISP Program Works


I think that is very clear. I do not have to explain how it works. Or let me talk about the TEXTBOX function.


You find the TEXTBOX function in the FNDSZ function. The entity list of the function is given to the function and a list is given back.


In the list are two points of the text. These points are the lower left point and the upper top point.


You can use the points to find the length of the text. That is done by using the CAR function on the points.


How It Looks


Here is how it looks after the AutoLISP program runs and the text has been selected. Lines are drawn around the text.




The text has been selected and for the spacing 2 is entered. See how it looks. But you can copy the file and see for yourself.




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


Sunday, November 10, 2013

AutoLISP For Drawing Donuts 3

The Two Remaining Functions


Here is an explanation of the two remaining functions. Here is an explanation of the FNDLS function and the DWDNS function.


The FNDLS Function


Here is the FNDLS function.


(defun fndls (el ip / e1 e2 el et ls p1 p2 pt ss)
(setq et (cdr (car el))
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ls (list p1)
ls (append (list p2) ls)
)
(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq ss (ssget "c" p2 p2))
)
(setq e1 (ssname ss 0)
e2 (ssname ss 1)
)
(if (equal e1 et)
(setq et e2)
(setq et e1)
)
(setq el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ls (append (list p1) ls)
ls (append (list p2) ls)
)
(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq ss (ssget "c" p1 p2))
)
(setq e1 (ssname ss 0)
e2 (ssname ss 1)
)

(if (= e1 et)
(setq et e1)
(setq et e2)
)
(setq el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq pt p1)
(setq pt p2)
)
(setq ls (append (list pt) ls))
ls
)


This function is a very long function. It has 50 lines. And the function works on the three lines of the drawing.


Handling The First Line


Let me start with looking at the first line of the drawing. These are the lines of the function that handle the first line.


(setq et (cdr (car el))
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ls (list p1)
ls (append (list p2) ls)
)


The entity list of the first line is given to the function. The entity list is used to find the name of the line entity.


It is the first element of the entity list. We use the CAR function to find it. But we want the second element. The CDR function is used.


Using the entity list we find the two points of the list. And we store them in the LS variable. We create a list out of them.


That is important. We use the LIST function to create a list from the point. We want to add the second point to the list.


For adding the second point to the list the APPEND function is used. But it only works if a list is added to the list.


So we can only add the second point to the list if the point has been turned into a list. Therefor we use the LIST function again.


Handling The Second Line


These are the lines of the FNDLS function that deal with the second line.


(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq ss (ssget "c" p2 p2))
)
(setq e1 (ssname ss 0)
e2 (ssname ss 1)
)
(if (equal e1 et)
(setq et e2)
(setq et e1)
)
(setq el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ls (append (list p1) ls)
ls (append (list p2) ls)
)


We have found the two points of the first line. The second line is going through one of the two points.


We create a selection set at the first point of the first line. We see how many entities are in that selection set.


If the number is one, then we need to take the selection set, that is found at the second point. We have a selection set with two entities.


We find the entities in the elections set. We check that it is not the first line. And we take the points of the proper line.


The two points are added to the list. We have done it before. You know how it is done. The points are turned into a list.


Handling The Third Line


We go to the lines of the function that deal with the third line of the drawing. Here they are:


(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq ss (ssget "c" p1 p2))
)
(setq e1 (ssname ss 0)
e2 (ssname ss 1)
)
(if (= e1 et)
(setq et e1)
(setq et e2)
)
(setq el (entget et)
p1 (cdr (assoc 10 el))
p2 (cdr (assoc 11 el))
)
(setq ss (ssget "c" p1 p1))
(if (= (sslength ss) 1)
(setq pt p1)
(setq pt p2)
)
(setq ls (append (list pt) ls))


It is pretty much the same as what was done with the lines for handling the second line of the drawing.


There is the point found that produces a selection set with two entities. There is checked that the third line is taken.


The remaining point is found. At that point there is a selection set with only one entity. The point is written to the list.


The list is given back to the main program. We need the list for adding all the donuts at the points of the line.


The DWDNS Function


Here is the DWDNS function.


(defun dwdns (ls / ct pt)
(setq ct 0)
(while (setq pt (nth ct ls))
(command "donut" 0 2.5 pt "")
(setq ct (1+ ct))
)
)


We start with the introduction of the CT variable. That variable gets the value zero. It is used for the NTH function.


We want to find all the points that are stored in the LS variable. Once we have a point the DONUT command is used.


The function works with a WHILE loop. The WHILE loop continues as long as a point is found. And a donut can be drawn.


That Is All


You now have seen how the AutoLISP works. You have got the compete AutoLISP program and you have got an explanation.


What I said. Was it clear? If not. Let me know. Add a comment to this blog. And I will come back to you. I'll give you an answer.




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