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.

No comments:

Post a Comment