就像这样- (defun c:tt(/ get-dxf pt1 pt2 set-dxf ss)
- (defun set-dxf (ename code val / ent)
- (setq ent (entget ename))
- (if (and (listp code) (listp val))
- (mapcar '(lambda (x y) (set-dxf ename x y)) code val)
- (progn
- (if (assoc code ent)
- (setq ent (subst (cons code val) (assoc code ent) ent))
- (setq ent (append ent (list (cons code val))))
- )
- (entmod ent)
- (entupd ename)
- )
- )
- ename
- )
- (defun get-dxf(en n)
- (if (not (listp en)) (setq en (entget en)))
- (cdr (assoc n en))
- )
- (setvar "cmdecho" 0)
- (setq pt1 (getpoint "\n第一点:"))
- (setq ss (ssget "c" pt1 pt1))
- (setq pt2 (getpoint pt1 "\n第二点:"))
- (vl-cmdf "_dimaligned" "non" pt1 "non" pt2 pause)
- (if ss
- (set-dxf (entlast) 8 (get-dxf (ssname ss 0) 8))
- )
- (princ)
- )
|