- (defun c:G11( / xent obj pt sc1 pt pt2 pt3 sc2 LLe LLt h txt sname dxf)
- (setvar "cmdecho" 0)
- (setq xent (entsel "\n请选择标注对象:"))
- (if (and xent (= (cdr (assoc 0 (entget (car xent)))) "DIMENSION"))
- (progn
- (setq obj (vlax-ename->vla-object (car xent))
- pt (cadr xent))
- (setq sc1 (vla-get-ScaleFactor obj)
- sname (vla-get-StyleName obj))
- (creL pt pt)
- (setq LLe (entget (entlast)))
- (creT)
- (setq LLt (entget (entlast)))
- (while (or (= (car (setq mouse (grread t 5 0))) 5)(= (car mouse) 2))
- (setq pt2 (cadr mouse)
- h (* 0.02 (getvar "VIEWSIZE"))
- sc2 (* sc1 (/ (distance pt pt2) h) 0.1)
- txt (strcat "ScaleF=" (rtos sc2 2))
- pt3 (polar pt2 (* -0.45 pi) (* 1.5 h)))
- (foreach x (list (cons 1 txt)(cons 10 pt3)(cons 40 h))
- (setq LLt (subst x (assoc (car x) LLt) LLt)))
- (entmod LLt)
- (entmod (subst (cons 11 pt2)(assoc 11 LLe) LLe))
- (if (null (equal sc2 0 1e-6)) (vla-put-ScaleFactor obj sc2))
- )
- (setq dxf (entget (tblobjname "dimstyle" sname)))
- (entmod (subst (cons 40 sc2)(assoc 40 dxf) dxf))
- (command "-DIMSTYLE" "R" sname)
- (entdel (cdr (assoc -1 LLE)))
- (entdel (cdr (assoc -1 LLT)))
- ))
- (setvar "cmdecho" 1)
- (princ)
- )
- (defun creT()(entmake (list '(0 . "TEXT") (cons 1 "1") (list 10 0 0 0) (cons 40 1))))
- (defun creL(p1 p2)(entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p2))))
- (princ)
收集的到的源码,这个功能很常用。请求修改源码,改成可以多选改动态标注比例,目前只能单选
|