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
No comments:
Post a Comment