本帖最后由 asd19400 于 2014-10-22 01:46 编辑
直接上图,对话框设置大概如下图思路,至少做5组可以选择的范围,如果能做猫老师的那种动态对话框肯定是最好的。最好能判断下错误,实在不行,将就用用了~,
下面这段代码是以前收集的,不过只能一个一个的操作,比较麻烦- (defun c:FB ( / a1 k1 k2 k3 ss)
- (vL-Load-com)
- (setq ss (ssget '((0 . "text"))))
- (setq K1 (getreal "\n 下限<200>:"))
- (if (null K1) (setq K1 200))
- (setq K2 (getreal "\n 上限<300>:"))
- (if (null K2) (setq K2 300))
- (setq K3 (getreal "\n 输入颜色代号<1>:"))
- (if (null K3) (setq K3 1))
- (foreach x (ss->list ss)
- (setq a1 (atof (Vlax-Get (Vlax-Ename->Vla-Object x) 'TextString )))
- (IF(< k1 a1 k2) (ch_dxf x 62 (FIX K3))))
- (princ)
- )
-
- (defun ss->list (ss / i lst)
- (setq i -1)
- (repeat (sslength ss)
- (setq lst (append
- lst
- (list (ssname ss (setq i (1+ i))))
- )
- )
- )
- )
-
- (defun ch_dxf (en num ch / old_num new_num ent)
- (if (setq ent (entget en)
- new_num (cons num ch)
- old_num (assoc num ent)
- )
- (entmod (subst new_num old_num ent))
- (entmod (reverse (cons new_num (reverse ent))))
- ))
|