AutoLISP: Dodgy Dimension Detector

Recently, The “Mistress of the Dorkness” (AKA Melanie) posted a routine to help the effort in finding dimensions in a drawing that have been deceitfully “fudged” [Found Here]. I remembered that I also found a routine that locates dimensions that have had an “override” applied to them. It appears that this routine was a “Hot Tip Harry” tip from long ago. It is a great routine that not only finds these “dodgy” dims but also makes its own layer called “dodgy” and puts the actual dimension value with its “dodgy” value next to each other and then freezes the other layers so as to highlight these shady dimensions.

This routine is great for CAD instructors or CAD managers who want to catch their drafters in their dubious schemes…

Here’s how:

  • DDD <enter> to start “Dodgy Dimension Detector”
  • That’s it, The routine will do the rest. However, you will need to “Thaw” all of the layers with the “LAYTHW” command so that you can see the rest of your drawing again.

; TIP1116.LSP: DDD.LSP Detect Revised Dimensions (c)1995, Patrick Wheatley

;copy associative dims with modified text to Layer DODGY-DIMS, freeze all

;other layers and update the dimension text to show the "real" dimension

;with the dodgy dimension in brackets then zoom extents

(defun initlayer (LAYERNAME COLOUR)

(if (tblsearch "LAYER" LAYERNAME) ;if exist make current or create it

(command "layer" "thaw" LAYERNAME "on" LAYERNAME

"set" LAYERNAME "")

(command "layer" "make" LAYERNAME "color" COLOUR LAYERNAME "")


(prin1);no nil


(defun dxf (CODE ELIST)

(cdr (assoc CODE ELIST)))


(command "setvar" "CMDECHO" "0")

(setq SET (ssget "X" '((0 . "dimension")))

I -1

NUM (sslength SET))

(repeat NUM

(setq I (+ I 1)

EN (ssname SET I)

ED (entget EN)

TXT (dxf 1 ED))

(if (/= TXT "") ;if dimension is modified

(setq DODGY-DIM (cons EN DODGY-DIM));add it to list



(if (/= nil DODGY-DIM) ;if DODGY DIMENSIONS exist


(initlayer "DODGY-DIMS" "magenta")

(setq I -1)

(repeat (length DODGY-DIM)

(setq I (+ I 1))

(command "copy" (nth I DODGY-DIM) "" '(0 0) '(0 0))

(command "change" "P" "" "P" "LA" "DODGY-DIMS" "")


(setq SET (ssget "X" '((8 . "dodgy-dims")))

i -1)

(repeat (sslength SET)

(setq i (+ i 1)

EN (ssname SET I)

ED (entget EN)

DD (dxf 1 ED)

ED (subst (cons 1 "") (assoc 1 ED) ED))

(entdel EN)

(entmake ED)

(command "layer" "f" "*" "" "")

(setq SU (strcat "(" DD ")"))

(command "dim" "dimpost" SU "" "exit")

(command "dim" "update" (entlast) "" "exit");add suffix = DODGY-DIM


(setq SU nil)

(command "dim" "dimpost" SU "" "exit") ;reset suffix to nil

(command "zoom" "E")



(prompt "\nNo DODGY DIMS in this drawing - take the rest of the day off.")

);IF /= nil DODGY-DIM

); end ddd.lsp

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Dimensions, Modifying. Bookmark the permalink.

One Response to AutoLISP: Dodgy Dimension Detector

  1. Joel Sampson says:

    After seeing and reading this post (news to me!!), I’m seeing one slight improvement… Use Layer Isolate instead of freezing everything then thawing everything – lots of current layer-state settings could be drastically upset. LAYISO, then LAYUNISO at the end. Good tip!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s