So you mean there's 30-40-50 different prefixes you want to apply? Are you sure? Sounds a bit worrying to me! You know that you can select 30-40-50-1000000000..... dimensions at once and apply the change in one instruction?
Sorry, I just can't understand this. If I had to code something where I'd have various prefixes to apply to various dimensions I'd not have the code ask me each time what that prefix was. I'd rather have different codes placing different prefixes onto the selected dimensions. Perhaps something like this?
(defun AffixDim (en prefix suffix / )
(entmod (list (cons -1 en) (cons 1 (strcat prefix "<>" suffix))))
)
(defun SelectDimsAndAffix (prefix suffix / ss n)
(if (setq ss (ssget '((0 . "*DIMENSION"))))
(progn
(setq n (sslength ss))
(while (>= (setq n (1- n)) 0)
(AffixDim (ssname ss n) prefix suffix)
)
)
)
)
(defun c:PrefixDim-2X (/) (SelectDimsAndAffix "2X" "") (princ))
(defun c:PrefixDim-9X (/) (SelectDimsAndAffix "9X" "") (princ))
(defun c:AffixDim (/ prefix suffix)
(or *AffixDim-Prefix* (setq *AffixDim-Prefix* ""))
(or *AffixDim-Suffix* (setq *AffixDim-Suffix* ""))
(if (and (setq prefix (getstring t (strcat "Prefix (. for None) <" *AffixDim-Prefix* ">: ")))
(not (eq prefix ""))
)
(progn
(if (eq prefix ".")
(setq prefix "")
)
(setq *AffixDim-Prefix* prefix)
)
(setq prefix *AffixDim-Prefix*)
)
(if (and (setq suffix (getstring t (strcat "Suffix (. for None) <" *AffixDim-Suffix* ">: ")))
(not (eq prefix ""))
)
(progn
(if (eq suffix ".")
(setq suffix "")
)
(setq *AffixDim-Suffix* suffix)
)
(setq suffix *AffixDim-Suffix*)
)
(SelectDimsAndAffix prefix suffix)
(princ)
)
That way I can have a command for each of the most usual prefixes/suffixes - which I can place on a toolbar or so for quick selection. The last one is a general purpose one which remembers the previous prefix/suffix.