Okay. Here is the final version that I am putting into my lisp routines. If there is any problem let me know.
Code:
(defun c:ChangeDimObject (/ ss Ent EntData Pt1 Pt2 Pt3 ocmd omode olay odim)
; Redraw dimension that were drawn as aligned as rotated on correct layer, and with correct dimension style.
(setq ocmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.undo" "_end")
(command "_.undo" "_begin")
(setq omode (getvar "osmode"))
(setvar "osmode" 0)
(setq olay (getvar "clayer"))
(setq odim (getvar "dimstyle"))
(if (setq ss (ssget '((0 . "DIMENSION"))))
(while (setq Ent (ssname ss 0))
(setq EntData (entget Ent))
(if (not (member '(100 . "AcDbRotatedDimension") EntData))
(progn
(setq Pt1 (cdr (assoc 13 EntData)))
(setq Pt2 (cdr (assoc 14 EntData)))
(setq Pt3 (cdr (assoc 11 EntData)))
(if (< (car Pt1) (car Pt2))
(command "_.ucs" "_3" Pt1 Pt2 (polar Pt1 (+ (DTR 90) (angle Pt1 Pt2)) 5))
(command "_.ucs" "_3" Pt2 Pt1 (polar Pt2 (+ (DTR 90) (angle Pt2 Pt1)) 5))
)
(setvar "clayer" (cdr (assoc 8 EntData)))
(command "_.dimstyle" "_r" (cdr (assoc 3 EntData)))
(entdel Ent)
(command "_.dim" "_horizontal" (trans Pt1 0 1) (trans Pt2 0 1) (trans Pt3 0 1) "" "_exit")
(command "_.ucs" "_p")
)
)
(ssdel Ent ss)
)
)
(command "_.dimstyle" "_r" odim)
(command "_.undo" "_end")
(setvar "clayer" olay)
(setvar "osmode" omode)
(setvar "cmdecho" ocmd)
(princ)
)
Tim