You can try the codes below.
It unlocks all layers before changing the dimension layer.
It only works on the current layout. You can modify it to make it go through all layouts.
(defun C:ADB (/ t1 s1 n1 g1 g1)
(setq t1 (getstring T "Dimension layer name: "))
(command "._-layer" "m" t1 "")
(command "._-layer" "U" "*" "")
(setq s1 (ssget "x" '((0 . "*dim*")))
n1 0)
(command "._draworder" "p" "" "f" )
(repeat (sslength s1)
(setq e1 (ssname s1 n1))
(setq g1 (entget e1))
(entmod (subst (cons 8 t1) (assoc 8 g1) g1))
(setpropertyvalue e1 "Dimtfill" 1)
(setq n1 (1+ n1))
)
(command "._layerp")
(command "._layerp")
(princ)
)