Dimension Centerlines cant get any easier!

Over the years I’ve done a lot of research looking for a good solution to creating centerline linetype dimensions. I’ve tried suppressing the extension lines, setting centerline types current and drawing plines over the dimension. I’ve tried some program found on the Internet (Don’t remember where) and could never get it work. Long story short I was stumped.

In the release of AutoCAD 2006 there was a new property added to Linear, and Aligned dimensions that allowed you to set a dimensions extension lines to something other than a continuous line. A lot of people did back flips over this. I sure did, but quickly realized that it wasn’t so simple. Have you ever noticed how hard it is at times to find the linetype you want? Here is a screen shot of my properties palette on my second monitor.

Take a look at the alphabetical order, or lack there of. Our drawings typically have around 20 to 30 different linetype’s loaded up in the drawing. And having to manually hunt through this mess each time, sometimes twice for each extension line can be pretty time consuming.

So I decided to take a look at the system variables associated with the dimension extension line linetype’s. Then threw together a quick lisp program to change dimension line extension line linetype’s quickly. (Wow that’s a mess to say)

Simply copy the code below then paste the contents into notepad and save with the .lsp extension. Next inside AutoCAD, issue the Appload command and browse for this file you just saved. Next on your command line issue CENDIM. It will prompt you to select a linear dimension. Once selected, you can choose to apply the linetype to both extension lines, the right extension line, the left extension line or clear the extension lines and reset it back to ByBlock.

Its a relatively quick operation, if you want to apply this to many dimensions in you’re drawing, you can quickly use the MATCHPROP command to apply the dimension extension line settings to other dimensions.

(defun c:cendim (/ diment censtyle censtylelinetype LT centerlinename)
(setq diment
(entsel
"\nSelect Linear Dimension to Change to Center Line Display:"
)
)
(setq censtyle "B")
(setq censtyle (strcase (getstring "\n<B>oth Extension Lines or <L>eft/<R>ight or <C>lear: <B> ")))

(if (= censtyle "C")
(progn
(setvar "dimltex1" "ByBlock")
(setvar "dimltex2" "ByBlock")
(command "-dimstyle" "A" diment "")
))
(if (/= censtyle "C" )
(progn

(if (eval LT)
(setq LT LT)
(setq LT "3")
)
(setq censtylelinetype 3)
(setq censtylelinetype (getstring
(strcat "\nWhich Center Line Type (1, 2, 3 or 4) <"
LT
">: "
)
)
)
(if (= censtylelinetype "")
(setq censtylelinetype "3"))

(setq centerlinename (strcat "Center" censtylelinetype))

(if (= censtyle "B")
(progn
(setvar "dimltex1" centerlinename)
(setvar "dimltex2" centerlinename)
(command "-dimstyle" "A" diment "")
))

(if (= censtyle "")
(progn
(setvar "dimltex1" centerlinename)
(setvar "dimltex2" centerlinename)
(command "-dimstyle" "A" diment "")
))

(if (= censtyle "L")
(progn
(setvar "dimltex1" centerlinename)
(command "-dimstyle" "A" diment "")
(command "-dimstyle" "A" diment "")
))

(if (= censtyle "R")
(progn
(setvar "dimltex2" centerlinename)
(command "-dimstyle" "A" diment "")
(command "-dimstyle" "A" diment "")
))
(setvar "dimltex1" "ByBlock")
(setvar "dimltex2" "ByBlock")))
(princ)
)

Click here to download the lisp program. Download CENDIM.LSP

Go to Source