
Originally Posted by
tyeelaw13
The variables are saved correctly in the dimstyle, and when i go to the dimension style manager, everything looks as it should. However, the drawing creates a dimension style with "$0" at the end of it, and the only way i can see that is through the properties command. It doesn't show up anywhere else. If I use the "dim" "up" command it saves the dimension string back to the "cga-4$0" dimstyle, even though i've got the "cga-4" set current.
Thanks again.
I have tried your code as posted. I could not get that "$0" style. How do execute the dimensions? Do you have macro that may change any of the dimension variables?
I also noticed that the variable "DIMTIM" should probably be "DIMTM", as there is not a variable of the former.
Here is some code that sets most of the variables through the SETVAR command. It also checks to see if the text style is created. If it is not then that variable is not changed. You would need to add the necessary code to add the text style if it is not currently in the drawing.
Code:
(defun C:CGA4 ( / dstyle cmde)
(setq cmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq DSTYLE "CGA-4")
(command "DIM"
"SAVE"
DSTYLE
(if (tblsearch "DIMSTYLE" DSTYLE)
"y"
)
"E"
)
(setvar "DIMADEC" 0)
(setvar "DIMALT" 0)
(setvar "DIMALTD" 2)
(setvar "DIMALTF" 25.4000)
(setvar "DIMALTRND" 0)
(setvar "DIMALTTD" 2)
(setvar "DIMALTTZ" 0)
(setvar "DIMASZ" (/ 1.0 16.0))
(setvar "DIMATFIT" 3)
(setvar "DIMAUNIT" 0)
(setvar "DIMAZIN" 0)
(setvar "DIMBLK" "ARCHTICK")
(setvar "DIMCEN" 0)
(setvar "DIMCLRD" 7)
(setvar "DIMCLRE" 256)
(setvar "DIMCLRT" 4)
(setvar "DIMDEC" 4)
(setvar "DIMDLE" 0)
(setvar "DIMDLI" (/ 1.0 8.0))
(setvar "DIMDSEP" ".")
(setvar "DIMEXE" (/ 1.0 8.0))
(setvar "DIMEXO" (/ 1.0 8.0))
(setvar "DIMFRAC" 2)
(setvar "DIMGAP" (/ 1.0 16.0))
(setvar "DIMJUST" 0)
(setvar "DIMLDRBLK" ".")
(setvar "DIMLFAC" 1.000)
(setvar "DIMLIM" 0)
(setvar "DIMLUNIT" 4)
(setvar "DIMLWD" -1)
(setvar "DIMLWE" -2)
(setvar "DIMRND" (/ 1.0 8.0))
(setvar "DIMSAH" 0)
(setvar "DIMSCALE" 48.0000)
(setvar "DIMSD1" 0)
(setvar "DIMSD2" 0)
(setvar "DIMSE1" 0)
(setvar "DIMSE2" 0)
(setvar "DIMSOXD" 0)
(setvar "DIMTAD" 1)
(setvar "DIMDEC" 4)
(setvar "DIMTFAC" 1.0000)
(setvar "DIMTIH" 0)
(setvar "DIMTIX" 0)
(setvar "DIMTM" 0)
(setvar "DIMTMOVE" 2)
(setvar "DIMTOFL" 0)
(setvar "DIMTOH" 0)
(setvar "DIMTOL" 0)
(setvar "DIMTOLJ" 1)
(setvar "DIMTP" 0)
(setvar "DIMTSZ" 0)
(setvar "DIMTVP" 0.0000)
(if (tblsearch "STYLE" "CGA-TEXT")
(setvar "DIMTXSTY" "CGA-TEXT")
)
(setvar "DIMTXT" (/ 5.0 64.0))
(setvar "DIMTZIN" 0)
(setvar "DIMUPT" 0)
(setvar "DIMZIN" 3)
(command "DIM" "SAVE" "CGA-4" "y" "E")
(setvar "cmdecho" cmde)
(princ)
)