You are most probably
working with AutoCAD. I don't know what version you are using. Is it
AutoCAD Light or the full version?
I already talked about
AutoCAD Light. I told you. Taking AutoCAD Light is a big mistake. You
are wasting money if you do.
The
Full Version Of AutoCAD
But taking the full
version of AutoCAD instead. I think that is wasting money too. How
much is the full version of AutoCAD? $ 6,000.-?
You could take the
IntelliCAD program. I'm working with the IntelliCAD program from 4M.
There are three versions:
Program Use Price
1. 2D drawings
2. 2D/3D drawings
3. 2D/3D drawings
Much
More Affordable
Do you see? The IntelliCAD
program is much more affordable than the full version of AutoCAD. And
all programs have AutoLISP support.
You can download a trail
version of IntelliCAD and see how the program is. Go to this website
to download a trail version:
http://www.4msa.com
Like
AutoCAD
That is good about
IntelliCAD. You will see it when you download a trail version of
IntelliCAD. It looks like AutoCAD.
In AutoCAD you have
toolbars, a drawing area, and a command window. In IntelliCAD you
have the same. IntelliCAD is exactly the same.
There is a difference with
AutoCAD. Only the full version of AutoCAD has got AutoLISP support.
All versions of IntelliCAD have AutoLISP support.
Work
With AutoLISP Appreciations
So if you are only
creating 2D drawings and you want to work with AutoLISP
appreciations, take the cheapest version of IntelliCAD.
Here is something else
that is the same with AutoCAD and IntelliCAD. The drawing files are
saved in the AutoCAD format.
In IntelliCAD you can
select the file format that you want for your drawing. That file
format can be
from AutoCAD 10 till
AutoCAD 2013.
Creating
AutoCAD Drawings
But that is the most
important aspect of IntelliCAD. You are creating AutoCAD drawings in
IntelliCAD.
You can open drawings that
have been created in IntelliCAD in AutoCAD. And you can open AutoCAD
drawings in IntelliCAD.
Go
For IntelliCAD
I don't know about you? Do
you have too much money? Or are you thinking about getting a CAD
program? I would go for IntelliCAD.
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, January 31, 2014
Sunday, January 26, 2014
How To Create Layers With AutoLISP
You know about layers. You
can create them in AutoCAD or an alternative program for AutoCAD. And
draw on them.
But you can also create them with AutoLISP. I know. You want to know how it is done. That is what you'll find in this post.
Kishore Gave Me An Idea
Talking about creating layers with AutoLISP. Kishore gave me that idea. I read about it on his blog. His blog is here:
http://autolisp-kishore.blogspot.com/
Kishore had an AutoLISP program for creating layers with AutoLISP. This is the program that he had.
Kishore's AutoLISP Program
(defun create_layer()
(command "layer" "n" "text"
"c" "blue" "text"
""
)
(command "layer" "n" "wall"
"c" "white" "wall"
""
)
(command "layer" "n" "line"
"c" "red" "dim"
""
)
(command "layer" "n" " title "
"c" "cyan" " title "
""
)
(command "layer" "n" "cir"
"c" "13" "cir"
""
)
(command "layer" "n" "hatch"
"c" "magenta" "hatch"
""
)
(command "layer" "n" "Beam"
"c" "green" "Beam"
""
)
(command "layer" "n" "crossb"
"c" "yellow" "crossb"
"lt" "hidden" "crossb"
""
)
)
With the AutoLISP program the following layers were created:
- TEXT
- WALL
- LINE
- TITLE
- CIR
- HATCH
- BEAM
- CROSSB
All the layers were given a color and of the last layer even the line type was changed.
Extra Information
I would like to give you a little bit extra information. Let's talk about the LAYER command first. This is the prompt:
? to list/New/Make/Set/Color/Ltype/LWeight/Print/ PStyle/ON/OFF/Freeze/Thaw/LOck/Unlock:
As you can see the LAYER command has got 15 options. You can invoke an option by entering the capitalized character at the prompt.
I'm not going to talk about all the options of the LAYER command. I do not want to write an AutoCAD course. But two options I will mention.
NEW Option And MAKE Option
I will mention the NEW option and the MAKE option. Both options can be used for creating a new layer with AutoLISP.
But these two options do not work the same. They work differently. Kishore has used the New option. I only use the MAKE option.
If you use the NEW option, then there is asked for the name of the new layer. Next you want to give the new layer a color.
You invoke the COLOR option. You enter the color that you want. Next there is asked what layer gets that color.
You gave the name of the new layer. But that name isn't shown. So you must enter the name of the new layer again.
OK. A new layer is created. But the new layer is not activated. If you want to draw on that layer, you must SET it first.
Do you see. In the AutoLISP program from Kishore the name of the new layer is given again after a color has been selected.
The MAKE Option
The MAKE option is different. Let me show you with a program of myself.
(defun nwlyr ()
(command "layer" "m" "025"
"c" "red" ""
""
)
(command "layer" "m" "035"
"c" "yellow" ""
""
)
(command "layer" "m" "050"
"c" "green" ""
""
)
)
Do you see? I have entered the color of the new layer. There is asked to what layer the color goes. Between brackets is the new layer.
So I do not have to enter the name of the layer again. I can give a return or click on the right mouse button.
New Layer Is Activated
There is another difference with NEW option of the LAYER command. The newly created layer is activated. You can draw on it right away.
I think that is a very important advantage. I create new layers with the MAKE option. I don't have to set the new layer.
OK. I gave you some additional information. I did not do that to suggest the Kishore didn't give good information.
The Blog Of Kishore
In fact. You can visit the blog of Kishore. He has got a lot more AutoLISP programs on his blog. This is the address:
http://autolisp-kishore.blogspot.com/
But you can also create them with AutoLISP. I know. You want to know how it is done. That is what you'll find in this post.
Kishore Gave Me An Idea
Talking about creating layers with AutoLISP. Kishore gave me that idea. I read about it on his blog. His blog is here:
http://autolisp-kishore.blogspot.com/
Kishore had an AutoLISP program for creating layers with AutoLISP. This is the program that he had.
Kishore's AutoLISP Program
(defun create_layer()
(command "layer" "n" "text"
"c" "blue" "text"
""
)
(command "layer" "n" "wall"
"c" "white" "wall"
""
)
(command "layer" "n" "line"
"c" "red" "dim"
""
)
(command "layer" "n" " title "
"c" "cyan" " title "
""
)
(command "layer" "n" "cir"
"c" "13" "cir"
""
)
(command "layer" "n" "hatch"
"c" "magenta" "hatch"
""
)
(command "layer" "n" "Beam"
"c" "green" "Beam"
""
)
(command "layer" "n" "crossb"
"c" "yellow" "crossb"
"lt" "hidden" "crossb"
""
)
)
With the AutoLISP program the following layers were created:
- TEXT
- WALL
- LINE
- TITLE
- CIR
- HATCH
- BEAM
- CROSSB
All the layers were given a color and of the last layer even the line type was changed.
Extra Information
I would like to give you a little bit extra information. Let's talk about the LAYER command first. This is the prompt:
? to list/New/Make/Set/Color/Ltype/LWeight/Print/ PStyle/ON/OFF/Freeze/Thaw/LOck/Unlock:
As you can see the LAYER command has got 15 options. You can invoke an option by entering the capitalized character at the prompt.
I'm not going to talk about all the options of the LAYER command. I do not want to write an AutoCAD course. But two options I will mention.
NEW Option And MAKE Option
I will mention the NEW option and the MAKE option. Both options can be used for creating a new layer with AutoLISP.
But these two options do not work the same. They work differently. Kishore has used the New option. I only use the MAKE option.
If you use the NEW option, then there is asked for the name of the new layer. Next you want to give the new layer a color.
You invoke the COLOR option. You enter the color that you want. Next there is asked what layer gets that color.
You gave the name of the new layer. But that name isn't shown. So you must enter the name of the new layer again.
OK. A new layer is created. But the new layer is not activated. If you want to draw on that layer, you must SET it first.
Do you see. In the AutoLISP program from Kishore the name of the new layer is given again after a color has been selected.
The MAKE Option
The MAKE option is different. Let me show you with a program of myself.
(defun nwlyr ()
(command "layer" "m" "025"
"c" "red" ""
""
)
(command "layer" "m" "035"
"c" "yellow" ""
""
)
(command "layer" "m" "050"
"c" "green" ""
""
)
)
Do you see? I have entered the color of the new layer. There is asked to what layer the color goes. Between brackets is the new layer.
So I do not have to enter the name of the layer again. I can give a return or click on the right mouse button.
New Layer Is Activated
There is another difference with NEW option of the LAYER command. The newly created layer is activated. You can draw on it right away.
I think that is a very important advantage. I create new layers with the MAKE option. I don't have to set the new layer.
OK. I gave you some additional information. I did not do that to suggest the Kishore didn't give good information.
The Blog Of Kishore
In fact. You can visit the blog of Kishore. He has got a lot more AutoLISP programs on his blog. This is the address:
http://autolisp-kishore.blogspot.com/
Labels:
AutoCAD,
AutoLISP,
CAD,
IntelliCAD,
save money,
save time
Location:
Puchong, Selangor, Malaysia
Friday, January 24, 2014
Do You Make This Mistake?
Do
You Make This Mistake?
You are working with AutoCAD. You want to create true AutoCAD drawings, but you do not have enough money for buying the full version of AutoCAD.
You thought to be smart. You bought AutoCAD Light. Big mistake. You were wasting a lot of money. You could have saved that money.
Limited Program
AutoCAD Light is a very limited program. In it you can only create 2D drawings. And it doesn’t have AutoLISP support.
It doesn't have AutoLISP support. So you have no way of speeding up AutoCAD. You keep on waiting for hours before your drawing is created.
Waiting For Hours
OK. Maybe you do not mind that you have to wait for hours before your AutoCAD drawing is created. But still. Only 2D drawing.
Getting AutoCAD Light. It is a big mistake. All the money that you spend on AutoCAD Light. You could have saved that money.
DraftSight
You should have taken DraftSight. DraftSight is a free CAD program from Dassault. They are from France and making planes.
DraftSight is even better than AutoCAD Light. In it you can even create 3D drawings. And the drawings are saved in the AutoCAD format.
You save your DraftSight drawings with the DWG extension. So you are creating true AutoCAD drawings in DraftSight. For free!
Getting DraftSight
How to get DraftSight? Easy. Do a search on Google for “Download DraftSight”. And you will go to the website from where you can download it.
This message is a warning. I'm not talking to CAD users that already have bought AutoCAD Light. They made a big mistake. I cannot change it.
Buying AutoCAD Light
I'm talking to CAD users that are considering buying AutoCAD Light. To them I want to say. Don't. Get DraftSight instead.
When you get DraftSight you are not spending any money. You are not spending any money at all. And you are creating true AutoCAD drawings.
You are working with AutoCAD. You want to create true AutoCAD drawings, but you do not have enough money for buying the full version of AutoCAD.
You thought to be smart. You bought AutoCAD Light. Big mistake. You were wasting a lot of money. You could have saved that money.
Limited Program
AutoCAD Light is a very limited program. In it you can only create 2D drawings. And it doesn’t have AutoLISP support.
It doesn't have AutoLISP support. So you have no way of speeding up AutoCAD. You keep on waiting for hours before your drawing is created.
Waiting For Hours
OK. Maybe you do not mind that you have to wait for hours before your AutoCAD drawing is created. But still. Only 2D drawing.
Getting AutoCAD Light. It is a big mistake. All the money that you spend on AutoCAD Light. You could have saved that money.
DraftSight
You should have taken DraftSight. DraftSight is a free CAD program from Dassault. They are from France and making planes.
DraftSight is even better than AutoCAD Light. In it you can even create 3D drawings. And the drawings are saved in the AutoCAD format.
You save your DraftSight drawings with the DWG extension. So you are creating true AutoCAD drawings in DraftSight. For free!
Getting DraftSight
How to get DraftSight? Easy. Do a search on Google for “Download DraftSight”. And you will go to the website from where you can download it.
This message is a warning. I'm not talking to CAD users that already have bought AutoCAD Light. They made a big mistake. I cannot change it.
Buying AutoCAD Light
I'm talking to CAD users that are considering buying AutoCAD Light. To them I want to say. Don't. Get DraftSight instead.
When you get DraftSight you are not spending any money. You are not spending any money at all. And you are creating true AutoCAD drawings.
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://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. 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: Make AutoCAD Fast Maybe you have a question. Or want to tell me something. You can contact me on this e-mail address: makeautocadfast@ymail.com |
Labels:
AutoCAD,
AutoLISP,
CAD,
IntelliCAD,
save money,
save time
Location:
Puchong, Selangor, Malaysia
Tuesday, January 21, 2014
AutoLISP Program Drawing Donuts And A Hatch 2
AutoLISP
Program Drawing Donuts And A Hatch 2
Before talking about all the functions of the AutoLISP program, I want to say something about the working of the AutoLISP program.
Several tasks are performed with the AutoLISP program. For every task there is a function. Here is a list of the task and functions.
The Main Function
There is also a hatch drawn between the line sof the AutoLISP prgoram. That is done in the main fucntion of the AutpoLIUSP prgoram.
Here it is:
(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)
)
See how the BHATCH command is used. The tpyer of the hatch is selected, the scale and the rotation angle, and a point is picked.
The Functions
The START and ENDPR functions
Here they are:
(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 endpr ()
(setvar "cmdecho" 1)
(princ)
)
There has been talked enough about these two functions. So no need to repeat what has been said before.
The DRLNS Function
Here is the function:
(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"
)
)
The LINE command is used in the function. Points have been specified. At the end of the LINE conmand the CLOSE option is used.
The FNDET Function
Here is the function:
(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
)
A point has been picked between the lines. Now a line has to be found. The SSGET function is used to create a selection set.
The SSGET function works with two points. The first point is the point that has been picked. That point was given to the function.
The second point is on an angel of zero degrees from the first point. It is on a distance. The distance changes until a selection set is found.
If a selection set is found, then the name of the entity in the selections set is found using the SSNAME function. The name is given back.
The FNDLS Function
Here is the fucntion.
(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
)
The entity, that has been found, is given to the function. The points of the entity are found and with them all other entities are found.
The points of the entities are the points of the lines. They are put in a list. And at the end the list is given back.
How it all is done. I guess that is clear.
The DRWDN Function
Here it is:
(defun drwdn (ls / ct)
(setq ct 0)
(while (setq pt (nth ct ls))
(command "donut" 0 2.5 pt "")
(setq ct (1+ ct))
)
)
A list of points have been found. That list is given to the function. In the function the DONUT command is used to draw the donuts.
That Is It
These are all the functions of the AutoLISP program. The number of functions is not too much. So we talk about a simple AutoLISP program.
Before talking about all the functions of the AutoLISP program, I want to say something about the working of the AutoLISP program.
Several tasks are performed with the AutoLISP program. For every task there is a function. Here is a list of the task and functions.
Starting
and ending the
AutoLISP program START, ENDPR Drawign lines DRLNS Finding a line FNDET Finding a list of points FNDLS Drawign donuts DRWDN |
The Main Function
There is also a hatch drawn between the line sof the AutoLISP prgoram. That is done in the main fucntion of the AutpoLIUSP prgoram.
Here it is:
(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)
)
See how the BHATCH command is used. The tpyer of the hatch is selected, the scale and the rotation angle, and a point is picked.
The Functions
The START and ENDPR functions
Here they are:
(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 endpr ()
(setvar "cmdecho" 1)
(princ)
)
There has been talked enough about these two functions. So no need to repeat what has been said before.
The DRLNS Function
Here is the function:
(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"
)
)
The LINE command is used in the function. Points have been specified. At the end of the LINE conmand the CLOSE option is used.
The FNDET Function
Here is the function:
(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
)
A point has been picked between the lines. Now a line has to be found. The SSGET function is used to create a selection set.
The SSGET function works with two points. The first point is the point that has been picked. That point was given to the function.
The second point is on an angel of zero degrees from the first point. It is on a distance. The distance changes until a selection set is found.
If a selection set is found, then the name of the entity in the selections set is found using the SSNAME function. The name is given back.
The FNDLS Function
Here is the fucntion.
(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
)
The entity, that has been found, is given to the function. The points of the entity are found and with them all other entities are found.
The points of the entities are the points of the lines. They are put in a list. And at the end the list is given back.
How it all is done. I guess that is clear.
The DRWDN Function
Here it is:
(defun drwdn (ls / ct)
(setq ct 0)
(while (setq pt (nth ct ls))
(command "donut" 0 2.5 pt "")
(setq ct (1+ ct))
)
)
A list of points have been found. That list is given to the function. In the function the DONUT command is used to draw the donuts.
That Is It
These are all the functions of the AutoLISP program. The number of functions is not too much. So we talk about a simple AutoLISP program.
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. ------------------------------------------------- |
Labels:
AutoCAD,
AutoLISP,
CAD,
donuts,
hatch,
IntelliCAD,
save money,
save time
Location:
Puchong, Selangor, Malaysia
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
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
Labels:
AutoCAD,
AutoLISP,
CAD,
donuts,
Donuts. save time,
hatch,
save money
Location:
Puchong, Selangor, Malaysia
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.
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. ------------------------------------------------- |
Labels:
AutoCAD,
AutoLISP,
CAD,
Donuts. save time,
profile,
save money
Location:
Puchong, Selangor, Malaysia
Saturday, January 18, 2014
About Make AutoCAD Fast
You are reading this blog
post. You have read other blog posts too. Still. I don't know who you
are.
Are you an AutoCAD user or are you only interested in AutoLISP and AutoLISP programming. Whatever you are. It is fine with me.
But there are a couple of things I want you to know. If you are an AutoCAD user or the user of a CAD program that is an alternative.
Ask yourself. Do you want keep on waiting for hours before your CAD drawing is created and waste a lot of money?
Or do you want an AutoLISP program to speed up your CAD program and save a lot of time? Do you want your CAD drawings right away?
If you want an AutoLISP program. I could write it for you. And when you engage me, you are not spending a lot of money.
You could give me a call. My number is 012-9312742. But that is a number in Malaysia. Outside Malaysia it is +012-9312742.
If you are here because you are only interested in AutoLISP and AutoLISP programming. Let me know what you want to know.
The programs, that I have written, were all made up by myself. But you could have good ideas too. Send me a comment. Let me know.
Are you an AutoCAD user or are you only interested in AutoLISP and AutoLISP programming. Whatever you are. It is fine with me.
But there are a couple of things I want you to know. If you are an AutoCAD user or the user of a CAD program that is an alternative.
Ask yourself. Do you want keep on waiting for hours before your CAD drawing is created and waste a lot of money?
Or do you want an AutoLISP program to speed up your CAD program and save a lot of time? Do you want your CAD drawings right away?
If you want an AutoLISP program. I could write it for you. And when you engage me, you are not spending a lot of money.
You could give me a call. My number is 012-9312742. But that is a number in Malaysia. Outside Malaysia it is +012-9312742.
If you are here because you are only interested in AutoLISP and AutoLISP programming. Let me know what you want to know.
The programs, that I have written, were all made up by myself. But you could have good ideas too. Send me a comment. Let me know.
Labels:
AutoCAD,
AutoLISP,
CAD,
IntelliCAD,
save money,
save time
Location:
Puchong, Selangor, Malaysia
Friday, January 17, 2014
My First AutoLISP Customer
Danny Sin was my fist AutoLISP customer. His company was building shutters for shops, steel doors and steel racks.
A Factory For Shutters
Danny had studied at a university in Taiwan. He came back to Malaysia. His father had a factory for shutters.
But his father's factory was a family business. Danny wanted to start his own business. And that is what he did.
Danny's business was doing very well. He was getting a lot of orders. But he felt he had a problem. With AutoCAD.
Problem With AutoCAD
I was like this. A prospect or customer came to him. Looking for a shutter. Danny made an offer and with the offer came a drawing.
The drawing was an AutoCAD drawing. It was a drawing of the shutter that was offered. But creating a drawing took a lot of time.
I had been writing e-mails to AutoCAD users. I told them how they could save a lot of time when they worked with an AutoLISP program.
Writing AutoLISP Programs
Danny was interested. He engaged me for writing AutoLISP programs for him. He was selling different types of shutters.
For each type of shutter a different AutoLISP program had to be written. I had to write five different AutoLISP programs.
I wrote the AutoLISP programs. And then I found out about the steel doors. For them also AutoCAD drawings had to be created.
I wrote an AutoLISP program for creating AutoLISP drawings of steel doors. Those drawings were created in no time too.
Saving A Lot Of Time
Before Danny had his AutoCAD programs, it took a whole day to create an AutoCAD drawing of a shutter or steel door.
The AutoLISP program worked with dialog boxes. So the AutoCAD drawing wasn't create right away. But still a lot of time was saved.
Each AutoCAD drawing was created within one minute. It was no longer a matter of waiting a whole day for a quotation.
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. ------------------------------------------------- |
Labels:
AutoCAD,
AutoLISP,
CAD,
IntelliCAD,
Programming in AutoLISP,
save money,
save time
Location:
Puchong, Selangor, Malaysia
Friday, January 10, 2014
Another AutoLISP And DCL Program 2
Introduction
Now I'm going to talk about the AutoLISP file and the DCL file. I will start with talking about the DCL file.
The DCL File
Here is the DCL file. It is not really complicated. See how the ALIGNMENT attributes and the SPACER attributes are used.
selpt : dialog
{
label = "Select Point";
: boxed_column
{
label = "Sample Point";
: spacer
{
height=1;
}
: button
{
label = "Pick Point <";
key = "hide";
width = 12;
fixed_width = true;
mnemonic = "P";
alignment = centered;
}
: spacer
{
height=1;
}
: edit_box
{
key = "px";
label = "&X:";
width = 8;
fixed_width = true;
alignment = centered;
}
: edit_box
{
key = "py";
label = "&Y:";
width = 8;
fixed_width = true;
alignment = centered;
}
: edit_box
{
key = "pz";
label = "&Z:";
width = 8;
fixed_width = true;
alignment = centered;
}
: spacer
{
height=1;
}
}
: spacer
{
height=1;
}
ok_cancel;
}
In the DCL file a button is specified and there are three edit boxes in the dialog box file. You see what text is displayed.
You can also see what the keys of the button and the text boxes are. The AutoLISP program makes a reference to them.
The AutoLISP Program
Here is the AutoLISP program. I did not follow what was given by AFRALISP. Their program has no functions. My version has.
(defun c:selp ()
(start)
(setq px "0.000"
py "0.000"
pz "0.000"
fl 4
)
(setq di (load_dialog "c:/make/selpt.dcl"))
(while (> fl 2)
(if (not (new_dialog "selpt" di))
(exit)
)
(sttle px py pz)
(action_tile "cancel" "(done_dialog 1)")
(action_tile "accept"
"(setq px (get_tile \"p1\"))
(setq py (get_tile \"p2\"))
(setq pz (get_tile \"p3\"))
(done_dialog 2)"
)
(action_tile "hide" "(done_dialog 4)")
(setq fl (start_dialog))
(if (= fl 4)
(progn
(setq ls (selpt)
px (nth 0 ls)
py (nth 1 ls)
pz (nth 2 ls)
)
)
)
)
(unload_dialog di)
(endpr)
)
(defun start (/ ss)
(setvar "cmdecho" 0)
(command "limits" (list 0 0)
(list 120 120)
)
(command "snap" 10)
(command "grid" 10)
(command "zoom" "all")
(command "zoom" "0.8x")
(setq ss (ssget "c" (list 0 0)
(list 120 120)
)
)
(if ss
(command "erase" "all" "")
)
(command "-style" ""
"Courier New"
0
1
0
"No"
"No"
)
)
(defun sttle (px py pz)
(set_tile "px" px)
(set_tile "py" py)
(set_tile "pz" pz)
)
(defun selpt ()
(setq selpoint (getpoint
"\nInsertion Point: "
)
)
(setq px (rtos (car selpoint) 2 4))
(setq py (rtos (cadr selpoint) 2 4))
(setq pz (rtos (caddr selpoint) 2 4))
(list px py pz)
)
(defun endpr ()
(setvar "cmdecho" 1)
(princ)
)
(c:selp)
I have added the following functions to the program:
1. START
2. STTLE
3. SELPT
4. ENDPR
You already know about the first and the last function. So I don't have to give an explanation about them.
As the AutoLISP program starts, a call is made to the START function. You know what is done by the START function.
Next start values are given to the following three variables:
PX
PY
PZ
The variables get the value “0.000”.
The FL variable gets the value. That variable is used for the WHILE function, that comes next. If continues as long as the value is more than two.
Before the WHILE function is started the dialog box is loaded into the AutoLISP program. It isn't displayed yet.
In the WHILE function the dialog box is displayed. And the PX, PT, and PZ tile get the value that has been given to the variables.
That is done with the second function. It is done with the STTLE function. That function is used again and again.
Next ACTION_TILE functions are used. Those functions are used as there is clicked on one of the buttons.
There can be clicked on the CANCEL button, on the OK button, or on the PICK Point button. These are the keys of the buttons:
Button |
Key |
|
|
CANCEL |
CANCEL |
OK |
ACCEPT |
PICK POINT |
HIDE |
DONE_DIALOG is given a value. The value depends on the button that has been clicked. These are the values:
Button |
Value |
|
|
CANCEL |
0 |
OK |
1 |
PICK POINT |
4 |
If there has been clicked on the PICK Point button, then a point is picked in the screen. And a new value for PX, PY, and PZ is found.
We come again to the STTLE function. And the new values are given to the PX, PY, and PZ tiles. And they are displayed in the dialog box.
After clicking on the PICK POINT button, the FL value is given the value 4. So we stay in the WHILE loop.
If there is clicked on the CANCEL button or the OK button, then the FL variable gets the value zero or one. There is jumped out of the WHILE loop.
When there is jumped out of the WHILE loop, then the AutoLISP program ends. No so if there is clicked on the PICK POINT button.
OK. This is the explanation of the AutoLISP program. Now you know how the AutoLISP program works. I hope it is clear.
But that is the most important part. Now you have seen how you can perform an AutoLISP action if a dialog box is displayed.
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
Labels:
AutoCAD,
AutoLISP,
CAD,
DCL,
IntelliCAD,
Make AutoCAD Fast,
Programming in AutoLISP,
save money,
save time
Location:
Puchong, Selangor, Malaysia
Subscribe to:
Posts (Atom)