Friday, September 27, 2013

AutoLISP Program For Drawing A Cabinet 9


Setting The Dimension Variables


We want to add dimensions to the cabinet drawing. But before we can do that, we need to set the dimension variables.


The AutoLISP Function


Here is the function for setting the dimension variables. More is done. Something is done with text and something with layer.


(defun setdm ()
(command "-style"
"dimension"
"courier new"
0
1
0
"no"
"no"
)
(if (tblsearch "layer" "dimension")
(command "layer" "s"
"dimension"
""
)
(progn
(command "layer" "m"
"dimension"
"c"
"red"
""
""
)
)
)
(setvar "dimasz" 10)
(setvar "dimcen" 10)
(setvar "dimclrt" 2)
(setvar "dimdec" 0)
(setvar "dimdli" 5)
(setvar "dimexe" 5)
(setvar "dimexo" 5)
(setvar "dimgap" 5)
(setvar "dimtad" 1)
(setvar "dimtdec" 0)
(setvar "dimtih" 0)
(setvar "dimtoh" 0)
(setvar "dimtvp" 5)
(setvar "dimtxsty" "dimension")
(setvar "dimtxt" 10)
)


How The Function Works


We want to use the font COURIER NEW for the dimensions. That is why we create a text style with that font first.


Do you see? As we invoked the command, we specified for the name of the command “-STYLE”. That is done to have prompts.


If we would specify the name of the command as “STYLE”, then a dialog box would have been displayed. We don't want that.


Bext we want to set the DIMENSION LAYER as the default layer. We want the dimensions being drawn on that layer.


The TBLSEARCH function is used to see whether the DIMENSION layer is there. If so it is set. If not the layer is created.


Now we come to all the system variables for the dimensions. How could we find all the values for the dimension variables?


Easy. Set the dimension style. And once the dimension style has been set. Check the value of all dimension system variables.


Enter SETVAR at the command prompt. The following two prompts show up:


Variable name or ? :
Variable(s) to list <*>:


At the first prompt enter “?”. At the second promkpt enter “dim*”.


A list of all system variables with a name that starts with DIM is displayed. You can copy that list. And use it for the function.


The list is very long. You don't need all the system variables. You can see in the function what system variables are important.


Next Post


You have seen how all the system variables for the dimensions are set. Now we can go to drawing all the dimensions. That is in my next post.


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