本帖最后由 尘缘一生 于 2018-5-6 18:18 编辑
程序修改下:增加改后变色,增加垂直书写判断合理调节。
- ;;; -----------------------------------
- ;;; 单行文本动态拉伸 by:langjs
- ;;; -----修改:白领坛主------------------------------
- (defun c:qq (/ box data ent gr h hb hh loop p ss w wb ang)
- (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))
- ang (cdr (assoc 50 ent))
- box (textbox (cdr ent))
- hb (/ (cadr (cadr box)) h)
- 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)
- (if (/= 1 (sin ang))
- (progn
- (setq hh (* hb (abs (- (cadr data) (cadr p))))
- ent (emod 40 hh ent)
- )
- (emod 41 (/ (abs (- (car data) (car p))) (* hh wb)) ent)
- )
- )
- (if (= 1 (sin ang))
- (progn
- (setq hh (/ (* hb (abs (- (cadr data) (cadr p)))) 2)
- ent (emod 40 hh ent)
- )
- (emod 41 (/ (abs (- (cadr data) (cadr p))) (* hh wb)) ent)
- )
- )
- )
- ((member (car gr) '(11 25))
- (setq loop nil
- ent (emod 40 h ent)
- )
- (emod 41 w ent)
- )
- )
- )
- )
- )
- (setq oldlup (getvar "LUPREC"))
- (setvar "LUPREC" 0) ; 精度到各位,以便后续取得标准颜色号
- (command "CHANGE" (ssname ss 0) "" "P" "C" (rtos (1+ (rem (getvar "CPUTICKS")
- 8
- )
- )
- ) ""
- )
- (setvar "LUPREC" oldlup) ; 恢复数值小数位数
- (princ)
- )
|