Friday, March 28, 2014

Drawing A Polyline with AutoLISP 7


The Main Part Of The AutoLISP Program


Every AutoLISP program has got a main part. You can recognize that part. It has C: in the function name.


Here is the main part:


(defun-c:drwpl-(/-ct-ls-et-sp)
---(start)
---(drlns)
---(setq-ct-T)
---(while-ct
------(setq-ls-(fndet)
------------et-(nth-0-ls)
------------sp-(nth-1-ls)
------)
------(if-(null-et)
---------(setq-ct-nil)
---------(progn
------------(delpl)
------------(drwpl-et-sp)
---------)
------)
---)
---(endpr)
)


In the second post of this AutoLISP program I was talking about the functions of the program. This is what I wrote:


Function Action


START Setting the limits, erasing everything in the screen, setting the snap and grid, zooming out of the screen


DRLNS Drawing four lines


FNDET Finding line or polyline entity


DELPL Delete polyline


DRWPL Draw polyline, no intersection with other line


DPLIP Draw polyline, intersection with other line


ENDPR Ending of the program


You will find all functions mentioned in the main part of the AutoLISP program. A call is made to these functions.


Something else. In the main part of the AutoLISP program is a WHILE loop. There is a repetition in the AutoLISP program.


When the program is running there is asked to select a line. That question is repeated all the time. Until no line is selected.


This is how it is done:


(setq ct T)
(while ct
(setq ls (fndet)
et (nth 0 ls)
sp (nth 1 ls)
)
(if (null et)
(setq ct nil)
; The AutoLISP program draws a polyline
)
)


The CT variable is introduced. The variable gets the value true. As long as the value is true, the loop continues.


A call is made to the FNDET function. In that function there is asked to select a line. But no selection can be made.


The user clicks the right mouse button if he no longer wants to select a line in the screen. Then the values of ET and SP are nil.


The value of the ET variable is checked. If it is nil, then the CT variable gets the value nil too. And the WHILE loop terminates.


OK. Now I have told you everything about the AutoLISP program for drawing a polyline. I trust I have been clear enough.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Friday, March 21, 2014

Drawing A Polyline with AutoLISP 6

The DPLIP Function


This function is long. And it is also a little bit complicated. But you will understand the function. I hope.


Here is the function:


(defun-dplip-(et-sp-ss-/-e1-el-ip-p1-p2-p3-p4)
---(setq-el-(entget-et)
---------p1-(cdr-(assoc-10-el))
---------p2-(cdr-(assoc-11-el))
---)
---(setq-e1-(ssname-ss-0))
---(if-(equal-et-e1)
------(setq-e1-(ssname-ss-1))
---)
---(setq-el-(entget-e1)
---------p3-(cdr-(assoc-10-el))
---------p4-(cdr-(assoc-11-el))
---)
---(if-(or-(=-(angle-p1-p2)(angle-p1-p3))
-----------(=-(angle-p1-p2)-(angle-p2-p3))
-------)
------(setq-ip-p3)
------(setq-ip-p4)
---)
---(if-(=-(+-(distance-p1-sp)
-------------(distance-sp-ip)
----------)
----------(distance-p1-ip)
-------)
------(command-"pline"-p1
-----------------------"w"
-----------------------2.5
-----------------------2.5
-----------------------ip
-----------------------""
------)
------(command-"pline"-p2
-----------------------"w"
-----------------------2.5
-----------------------2.5
-----------------------ip
-----------------------""
------)
---)---
)


We give an entity to the function together with the selection point and the selection set that was found in the previous function.


Finding Two Points Of The Line


We want to find the two points of the entity. The entity is a line. This is how we find the two points of trhe line.


(setq-el-(entget-et)
p1-(cdr-(assoc-10-el))
p2-(cdr-(assoc-11-el))
)


Finding The Other Line


Another line is coming to the line that we have selected. We want to know what that line is. It is in the selection set.


There are two entities or two lines in the selection set. We take the first entity of the selection set.


We see if it is the same as the entity that was given to the function. If it is, then we take the second entity of the selection set.


Here are the programming lines:


(setq-e1-(ssname-ss-0))
(if-(equal-et-e1)
(setq-e1-(ssname-ss-1))
)


Now we have the line that is drawn against the line that has been selected. We find the points of that line. Here is how.


(setq-el-(entget-e1)
p3-(cdr-(assoc-10-el))
p4-(cdr-(assoc-11-el))
)


The Point On The Selected Line


Now we need to find what point is on the line that has been selected. We check the angles. Here is how it is done.


(if (or (= (angle p1 p2)(angle p1 p3))
(= (angle p1 p2)(angle p2 p3))
)
(setq ip p3)
(setq ip p4)
)


Now we know the two points of the line that has been selected. And we know the point of the other line that is on the line.


How The Polyline Is To Be Drawn


Now we must figure out how a polyline is to be drawn. We must figure out between what points the polyline must be drawn.


We know. The polyline is drawn to the point of the other line that is on the selected line. But from where is it drawn?


Is it drawn from point P1 or is it drawn from point P2. The points P1 and P2 are from the selected line.


It is quite simple to find out between what points the polyline must be drawn. We look at the distances.


There is the distance between P1 and the selection point and the distance between the selection point and the point of the other line.


If the total of those distances are the same as the distance between P1 and the point of the other line, then we know.


Then the polyline is drawn from point P1 to the point of the other line. Otehrwise it comes from point P2.


Here are the lines of the AutoLISP program.


(if (= (+ (distance p1 sp)
(distance sp ip)
)
(distance p1 ip)
)
(command "pline" p1
"w"
2.5
2.5
ip
""
)
(command "pline" p2
"w"
2.5
2.5
ip
""
)
)


Next Post


In the next post I'm going to talk about the main part of the AutoLISP program. And then I'm done talking about this AutoLISP program.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Monday, March 17, 2014

Drawing A Polyline with AutoLISP 5

The DELPL Function


Now I'm going to talk about the next function of the AutoLISP program. I'm going to talk about the DELPL function. Here it is:


(defun-delpl-(/-et-el-tp)
---(setq-et-(entlast)
---------el-(entget-et)
---------tp-(cdr-(assoc-0-el))
---)
---(if-(=-tp-"LWPOLYLINE")
------(command-"erase"-(entlast)-"")
---)
)


The function is used as the AutoLISP program starts. It deletes a polyline. A call to it is in the main AutoLISP program.


Working Of The Function


The function works like this. The last entity in the drawing is found. The ENTLAST function is used.


The type of the last entity is found. If the type is a polyline, the name is LWPOLYLINE, then it is deleted.


The polyline is deleted with this programming line:


(command-"erase"-(entlast)-"")


Important


I told you. As the AutoLISP program works, then the polyline that has been drawn by the program, is deleted.


Next Post


I keep this post short. In my next post I'm going to talk about the next function. I'm going to talk about the DRWPL function.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Sunday, March 16, 2014

Drawing A Polyline with AutoLISP 4

Now I'm going to talk about all the functions of the AutoLISP program. I already gave you a list of all the functions. Here it is again:


The Functions


Function Action


START Setting the limits, erasing everything in the screen, setting the snap and grid, zooming out of the screen


DRLNS Drawing four lines


FNDET Finding line or polyline entity


DELPL Delete polyline


DRWPL Draw polyline, no intersection with other line


DPLIP Draw polyline, intersection with other line


ENDPR Ending of the program


The START And The END Function


Earlier I talked about those two functions. You know how they work. I don't have to tell you once more.


The DRLNS Function


This function is used to draw the lines in the screen. It is a very simple function. The LINE command is used twice.


Here is the function.


(defun-drlns-()
---(command-"line"-(list-120-0)
-------------------(list-10-0)
-------------------(list-10-120)
-------------------(list-120-120)
-------------------""
---)
---(command-"line"-(list-10-60)
-------------------(list-120-60)
-------------------""
---)
)


The FNDET Function


Let's first talk about this function. Let me tell you what it does. Let me tell you what is happening through the function.


There is asked to make a selection. A selection could have bene made or there is no selection made. The right mouse button is clicked.


What ever is done. A selection has been made or no selection has been made. An entity and the selection point is given back.


If a selection has been made, then a polyline has been selected or a line. If a polyline has been selected, then the points of it are found.


After the points have been found, the polyline is deleted and the line under the polyline is found. The points are needed for doing that.


If a line has been selected, then the entity of the line can easily be found. And the selection point is known too.


If no selection has been made, then the entity and the selection point, that are given back to the main program, get the value of nil.


Here is the FNDET function.


(defun-fndet-(/-an-el-et-ls-p1-p2-pt-sl-sp-ss-tp)
---(setq-sl-(entsel-"\nSelect-line: "))
---(if-sl
------(progn
---------(setq-et-(car-sl)
---------------el-(entget-et)
---------------sp-(cadr-sl)
---------------sp-(osnap-sp-"nea")
---------------tp-(cdr-(assoc-0-el))
---------)
---------(setq-ls-nil)
---------(if-(=-tp-"LWPOLYLINE")
------------(progn
---------------(while-(setq-nr-(caar-el))
------------------(if-(=-nr-10)
---------------------(progn
------------------------(setq-pt-(cdar-el))
------------------------(if-ls
---------------------------(setq-ls-(append-
-------------------------------------(list-pt)
-------------------------------------ls
------------------------------------)
---------------------------)
---------------------------(setq-ls-(list-pt))
------------------------)
---------------------)
------------------)
------------------(setq-el-(cddr-el))
---------------)
---------------(setq-p1-(nth-1-ls)
---------------------p2-(nth-0-ls)
---------------------an-(angle-p1-p2)
---------------)
---------------(command-"erase"-et-"")
---------------(setq-ss-(ssget-"c"-(polar-p1-
------------------------------------------an-
------------------------------------------1
-----------------------------------)
-----------------------------------(polar-p2-
------------------------------------------(+-an
---------------------------------------------pi
------------------------------------------)
------------------------------------------1
-----------------------------------)
------------------------)
---------------)
---------------(setq-et-(ssname-ss-0))
------------)
---------)
------)
------(setq-et-nil
------------sp-nil
------)
---)
---(list-et-sp)
)


I have told you what the function does. And I have told you what is happening through the function. Lets now see how it done.


Asking to make a selection. It is done with this line. The ENTSEL function is used. That function gives back a list.


(setq sl (entsel "\nSelect-line: "))


This is an example of the list that is given back by the ENTSEL function.


(<Entity name: 37d85a0> (61.8922 59.7297 0.000000))


If a selection has been made, then we want to know the name of the entity and the selection popint. We use these lines.


(setq-et-(car-sl)
el-(entget-et)
sp-(cadr-sl)
sp-(osnap-sp-"nea")
tp-(cdr-(assoc-0-el))
)


First we find the name of the entity. It is the first element in the list from the ENTSEL function. We use the CAR function.


The second element of the list is the selection point. To find it we use the CADR function. And we use the OSNAP function.


The OSNAP function is used to have the point laying on the polyline or the line that has been selected.


We also want to know the type of the entity. The type can be LINE or LWPOLYLINE. A polyline has been selected if it is LWPOLYLINE.


We find the type of the entity with this line.


(setq-tp-(cdr-(assoc-0-el))


If a line has been selected, then we have the name of the entity and the selection point. But a polyline could have been selected.


If a polyline has been selected, we need to find the points of the polyline. This is how it is done:


(while (setq nr (caar el))
(if (= nr 10)
(progn
(setq pt (cdar el))
(if ls
(setq ls (append (list pt) ls))
(setq ls (list pt))
)
)
)
(setq el (cddr el))
)


I start with a WHILE loop. The WHILE loop continues as long as a number has been found. The number is in the sub list of the entity list.


The CAAR function is used. With that function the first sub list of the entity list is taken and the first element in it.


There is checked if that number is ten. If so, the point is found in the sub list with the CDAR function.


Next the first sub list of the entity list is removed from the entity list with the CDDR function. And we continue with the WHILE loop.


The points of the polyline are found in the sub lists that have the number ten. We create a list. The kist has two points.


After the points have been found, the polyline is deleted and the line under the polyline is found. The points are needed for doing that.


The polyline is deleted with this line:


(command-"erase"-et-"")


These are the lines that are used to find the line under the polyline. We use the points of the polkyline for doing that.


Here are the programming lines:


(setq-ss-(ssget-"c"-(polar-p1-an-1)
(polar-p2-(+-an-pi)-1)
)
)
(setq-et-(ssname-ss-0))


The angle between the point P1 and P2 is measured. And the points of the SSGET function are one from the points.


We do not want to find the lines that cross the line at the points P1 and P2. That is why we go to points 1 from the original points.


We find a selection set. I call it SS. The first entity in the selection set is the line that we are looking for. Here is the programming line.


(setq-et-(ssname-ss-0))


If a line has been selected, then the entity of the line can easily be found. And the selection point is known too.


If no selection has been made, then the entity and the selection point, that are given back to the main program, get the value of nil.


Very good. We have found the line and we have found the selection point. Those two are put in a list and given back to the main program.


We put these two in a list. This is how it is done:


(list-et-sp)


Next Post


I have talked about the FNDET function. You have got a lot of information. I hope I was clear enough. If not, let me know.


In my next post I'm going to talk about the DELPL function. That function is used to delete the polyline that has been drawn.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Saturday, March 15, 2014

Drawing Polylines with AutoLISP 3

Here is the complete AutoLISP program for drawing polylines. Run it in your CAD program and see how it works.


Oh. You see all the slashes. And now you are thinking. What is that? Let me tell you what it is. It is done to make things clear.


In a Blogger blog I cannot add a listing with spaces. The spaces are removed by Blogger. So you do not see spaces.


What I did. I have replaced all spaces with a slash. You can do the same after copyin gthe program. Replaced slashes with spaces.


(defun-c:drwpl-(/-ct-ls-et-sp)
---(start)
---(drlns)
---(setq-ct-T)
---(while-ct
------(setq-ls-(fndet)
------------et-(nth-0-ls)
------------sp-(nth-1-ls)
------)
------(if-(null-et)
---------(setq-ct-nil)
---------(progn
------------(delpl)
------------(drwpl-et-sp)
---------)
------)
---)
---(endpr)
)


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


(defun-drlns-()
---(command-"line"-(list-120-0)
-------------------(list-10-0)
-------------------(list-10-120)
-------------------(list-120-120)
-------------------""
---)
---(command-"line"-(list-10-60)
-------------------(list-120-60)
-------------------""
---)
)


(defun-fndet-(/-an-el-et-ls-p1-p2-pt-sl-sp-ss-tp)
---(setq-sl-(entsel-"\nSelect-line"-))
---(if-sl
------(progn
---------(setq-et-(car-sl)
---------------el-(entget-et)
---------------sp-(cadr-sl)
---------------sp-(osnap-sp-"nea")
---------------tp-(cdr-(assoc-0-el))
---------)
---------(setq-ls-nil)
---------(if-(=-tp-"LWPOLYLINE")
------------(progn
---------------(while-(setq-nr-(caar-el))
------------------(if-(=-nr-10)
---------------------(progn
------------------------(setq-pt-(cdar-el))
------------------------(if-ls
---------------------------(setq-ls-(append-
-------------------------------------(list-pt)
-------------------------------------ls
------------------------------------)
---------------------------)
---------------------------(setq-ls-(list-pt))
------------------------)
---------------------)
------------------)
------------------(setq-el-(cddr-el))
---------------)
---------------(setq-p1-(nth-1-ls)
---------------------p2-(nth-0-ls)
---------------------an-(angle-p1-p2)
---------------)
---------------(command-"erase"-et-"")
---------------(setq-ss-(ssget-"c"-(polar-p1-an-1)
-----------------------------------(polar-p2-(+-an-pi)
-----------------------------------1)
------------------------)
---------------)
---------------(setq-et-(ssname-ss-0))
------------)
---------)
------)
------(setq-et-nil
------------sp-nil
------)
---)
---(list-et-sp)
)


(defun-delpl-(/-et-el-tp)
---(setq-et-(entlast)
---------el-(entget-et)
---------tp-(cdr-(assoc-0-el))
---)
---(if-(=-tp-"LWPOLYLINE")
------(command-"erase"-(entlast)-"")
---)
)


(defun-drwpl-(et-sp-/-el-p1-p2-an-ss)
---(setq-el-(entget-et)
---------p1-(cdr-(assoc-10-el))
---------p2-(cdr-(assoc-11-el))
---------an-(angle-p1-p2)
---------ss-(ssget-"c"-(polar-p1-an-1)
-----------------------(polar-p2-(+-an-pi)-1)
------------)
---)
---(if-(=-(sslength-ss)-1)
------(command-"pline"-p1
-----------------------"w"
-----------------------2.5
-----------------------2.5
-----------------------p2
-----------------------""
------)
------(dplip-et-sp-ss)
---)
)


(defun-dplip-(et-sp-ss-/-e1-el-ip-p1-p2-p3-p4)
---(setq-el-(entget-et)
---------p1-(cdr-(assoc-10-el))
---------p2-(cdr-(assoc-11-el))
---)
---(setq-e1-(ssname-ss-0))
---(if-(equal-et-e1)
------(setq-e1-(ssname-ss-1))
---)
---(setq-el-(entget-e1)
---------p3-(cdr-(assoc-10-el))
---------p4-(cdr-(assoc-11-el))
---)
---(if-(or-(=-(angle-p1-p2)(angle-p1-p3))-
-----------(=-(angle-p1-p2)-(angle-p2-p3))
-------)
------(setq-ip-p3)
------(setq-ip-p4)
---)
---(if-(=-(+-(distance-p1-sp)
-------------(distance-sp-ip)
----------)
----------(distance-p1-ip)
-------)
------(command-"pline"-p1
-----------------------"w"
-----------------------2.5
-----------------------2.5
-----------------------ip
-----------------------""
------)
------(command-"pline"-p2
-----------------------"w"
-----------------------2.5
-----------------------2.5
-----------------------ip
-----------------------""
------)
---)---
)


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


(c:drwpl)


Next Posts


In the next posts I'm going to talk about all the functions of the AutoLISP program. I already have told what they are.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Friday, March 14, 2014

Drawing Polylines with AutoLISP 2

Drawing Polylines with AutoLISP 2


In my last post I told you that I'm going to talk about the AutoLISP program. That is what I'm going to do now.


But I want to do it in a different way than what you possibly are expecting. I will tell you what needs to be done by the program.


What Needs To Be Done


You know how the program works:


- At the start a screen with four line is drawn
- The user selects a line.
- After the selection of a line the polyline is erased, if it is in the drawing.
- A polyline is drawn over the line.
- Even if a polyline has been selected, a polyline is drawn over it.
- When no more line or polyline is selected, the AutoLISP program terminates.


Now you know what needs to be done by the AutoLISP program. And it is done by separate functions of the AutoLISP program.


The Functions


These are the functions that can be found in the AutoLISP program:


Function Action


START Setting the limits, erasing everything in the screen, setting the snap and grid, zooming out of the screen


DRLNS Drawing four lines


FNDET Finding line or polyline entity


DELPL Delete polyline


DRWPL Draw polyline, no intersection with other line


DPLIP Draw polyline, intersection with other line


ENDPR Ending of the program


Writing An AutoLISP Program


Knowing what must be done by the AutoLISP program, that is very important if you want to write an AutoLISP program.


It is figuring out what separate functions need to be written. And that makes programming in AutoLISP so easy.


Next Post


In my next post you will find the complete AutoLISP program. You can copy it to a text file and work with it in your CAD program.


When you work with it, you will see how the AutoLISP program works and you can test it by yourself.


In the posts that are coming after my next post I will be talking about the functions. I will explain how they work.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.



The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.

Thursday, March 13, 2014

Drawing Polylines with AutoLISP 1

I haven't been talking about AutoLISP lately. I don't know. Are you thinking I feel I have talked enough about AutoLISP?


If you were thinking in a negative way. Stop doing that. Now I'm going to talk about an AutoLISP program that I created.


I have created the AutoLISP program for a couple of my students. They wanted to learn programming in AutoLISP.


The Program




The program starts. Four lines are drawn. See the opening screen that shows up. See how the four lines look.


After the program has started. The opening screen is displayed in the screen. And there is asked to select a line.


A line is selected. And a polyline is drawn over the line. This is how it looks if a horizontal line has been selected.




But the vertical line could also have been selected. If that is done, then the polyline is drawn over the selected area.


See how looks. The polyline is not drawn over the whole line. It is only drawn over the area where the line was selected.




That is important. After a line has been selected, the previously drawn polyline is erased. So it is no longer there.


One more thing. The user is asked to select a line. But you know how users are. Do they do it on purpose? They may select a polyline.


Well. If they select a polyline, the AutoLISP program will not crash. The polyline will be erased and a new one is drawn.


Next Post


In my next post I'm going to talk about the AutoLISP program. I'm going to give you the whole listing and tell you what needs to be done.


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.


The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.








Wednesday, March 12, 2014

What AutoLISP Reveals

You are working with AutoCAD. Or maybe you are working with an alternative of AutoCAD such as IntelliCAD.


In the program you are creating technical drawings. The guess is that you are creating a lot of technical drawings with the program.


That Is How It Is


It takes a lot of time before your technical drawing is is created. And once it is created, you cannot use it right away.


The technical drawing needs to be checked first. And checking the technical drawing. That takes a lot of time too.


Wasting Time And Money


That is what AutoLISP reveals. You are wasting a lot of time and money. You could work with an AutoLISP program.


The AutoLISP program could be used to create parts of your technical drawing. It could even be used to create a complete drawing.


And that is how it is. Creating a complete technical drawing with an AutoLISP program is very fast. It is done in seconds.


If a complete technical drawing is created with an AutoLISP program. You don't have to wait for hours before the technical drawing is created.


And you don't have to check the technical drawing. In the AutoLISP program is laid down what standards are to be used.


OK. I said that a technical drawing is created in seconds with an AutoLISP program. Let's be honesty. It may take longer.


Suppose the AutoLISP program works with dialog boxes. Filling in the dialog boxes takes time. So it may be one minute.


Even if the AutoLISP program is creating parts of your technical drawing, you are saving a lot of time. You can imagine.


No AutoLISP Program


If you want to create a complete technical drawing with AutoLISP or parts of it, then you need an AutoLISP program.


But an AutoLISP program is not the only solution. You could also have a Visual Basic program or a program written in C++.


A Visual Basic program? Sure. Your program could be a Visual Basic program if you are working with an older version of AutoCAD.


Because nowadays AutoCAD is no longer supporting program that are written in Visual Basic. Now only AutoLISP and C++ programs are supported.


Disadvantage Of A C++ Program


A C++ program has got a big disadvantage. It is the price. The price of a C++ program is much higher than that of an AutoLISP program.


Can more be done with a C++ program than an AutoLISP program? No. You can do the same with AutoLISP and C++ programs.


Make AutoCAD Fast


If you are interested in getting an AutoLISP program, you could come to me. I can write an AutoLISP program for you.




If interested, give me a call. If you are from Malaysia. This is my telephone number:


012-9312742


From outside Malaysia you must dial:


+60129312742


Something Completely Different


Here is something completely different from what you normally read in this blog. It is an imagination.


Imagine this. One day you wake up and you are a millionaire! Look at how different your life will be:


- You no longer have to worry about your debts, bills, and slaving for money.


- You can spend your time doing things you love, spend your time with your beloved family and friends.


- You no longer have to worry about money or have to be poor again. Never again living the life you used to have.


Do you want to be a millionaire? Make your dream lifestyle came true. Here's your chance to be a millionaire. Check this out.


Wake Up Millionaire:
http://l1nk.com/rfbzla



To Your Success


Free AutoLISP Course


Sorry. This offer is only for my readers from Malaysia. I want to give an AutoLISP course to them. Free of charge.


I have more than 900 readers. The majority of them is from the USA. More than 500. But I also have readers from Malaysia. About 120.


I don't know what my readers from Malaysia are doing. Are they with an engineering firm or architecture? Or just interested in AutoLISP?


I offer them a free AutoLISP course. It works like this. You let me know if interested and I'll come to your place.


I will give the AutoLISP course at your office. Your people can attend the AutoLISP course. The course consist of 15 lessons.


The first ten lessons are about AutoLISP. All the functions of AutoLISP are explained and there is talked about the system variables.


During the last five lessons we are going to write an AutoLISP program. The people attending the course come with a wish.


That is why this offer is only for my readers from Malaysia. I live in Malaysia. And I do not see how I could travel abroad.


The AutoLISP course is completely free. I will not charge you for the course. But I will ask you to refund my travel expenses.


The people attending the course will get an e-book about AutoLISP. The e-book is a PDF file. What is said in the course, can be found in the book.