请尝试以下操作:
- (defun c:fixdims ( / ent enx idx sel )
- (if (setq sel (ssget "_:L" '((0 . "*DIMENSION") (1 . "~*?*"))))
- (repeat (setq idx (sslength sel))
- (setq idx (1- idx)
- ent (ssname sel idx)
- enx (entget ent)
- )
- (entmod (subst (cons 1 (LM:getdimstring ent)) (assoc 1 enx) enx))
- )
- )
- (princ)
- )
- ;; Get Dimension String - Lee Mac
- ;; Returns the displayed content of a dimension
- (defun LM:getdimstring ( ent / enx rtn )
- (if
- (and
- (setq enx (entget ent))
- (wcmatch (cdr (assoc 0 enx)) "*DIMENSION")
- (setq ent (tblobjname "block" (cdr (assoc 2 enx))))
- (setq ent (entnext ent)
- enx (entget ent)
- )
- )
- (while (and ent (null rtn))
- (if (= "MTEXT" (cdr (assoc 0 enx)))
- (setq rtn (cdr (assoc 1 enx)))
- )
- (setq ent (entnext ent)
- enx (entget ent)
- )
- )
- )
- rtn
- )
- (princ)
|