本帖最后由 lee50310 于 2023-6-18 05:55 编辑
修改後
- ;;; -----------------------------------
- ;;; 单行文本动态拉伸 by:langjs
- ;;; -----------------------------------
- (defun C:qq (/ box data ent gr h hb hh loop p ss w wb)
- (defun emod (h w ent)
- (entmod (subst (cons h w) (assoc h ent) ent))
- )
- (if (setq ss (ssget ":E:S" '((0 . "TEXT"))))
- (progn
- (setq ent (entget (ssname ss 0))
- p (cdr (assoc 10 ent))
- h (cdr (assoc 40 ent))
- w (cdr (assoc 41 ent))
- box (textbox (cdr ent))
- hb (/ h (cadr (cadr box)))
- wb (/ (car (cadr box)) (* h w))
- loop t
- )
- (princ "\n指定拉伸点:")
- (while loop
- (setq gr (grread t 15 0)
- data (cadr gr)
- )
- (cond
- ((= (car gr) 3) (setq loop nil))
- ((= (car gr) 5)
- (setq hh (* hb (abs (- (cadr data) (cadr p)))))
- (if (<= hh 0)(setq hh 0.1)) ;预防分母为0
- ;;((setq ent (emod 40 hh ent))
- (emod 41 (/ (abs (- (car data) (car p))) (* hh wb)) ent)
- )
- ((member (car gr) '(11 25))
- (setq loop nil
- ent (emod 40 h ent)
- )
- (emod 41 w ent)
- )
- )
- )
- )
- )
- (princ)
- )
.
.
|