woow谢谢Bigal
它已经运行得很好了。
我只根据需要更改了范围和颜色。我的Lisp程序水平不允许我做更多的事情呵呵
- (defun C:test ()
- (setq ss (ssget "X" (list (cons 0 "Text,Mtext")))) ;
- selection set of text within polygon
- (if (= ss nil)
- (princ "\nnothing
- inside")
- (progn
- (setq numb2 (sslength ss))
- (setq y numb2)
- (repeat
- y
- (setq tobj (vlax-ename->vla-object (ssname ss (setq y (- y
- 1)))))
- (setq textht (vlax-get-property tobj "Height"))
- ;(princ textht) ;
- change to write text to file
- (COND ((and (> textht 0.0) (< textht
- 2.15)) (vla-put-Color tobj 7)) ; 1 is color number
- ((and (> textht 2.151)
- (< textht 3.0)) (vla-put-Color tobj 3))
- ((and (> textht 3.001) (<
- textht 4.25)) (vla-put-Color tobj 2))
- ((and (> textht 4.251) (< textht
- 6.0)) (vla-put-Color tobj 1))
- ((> textht 6.001) (vla-put-Color tobj
- 6))
- ); end cond
- ); repeat
- ); end progn
- ); end if
- ) ;_ end of
- defun
只有两件事。是否有可能使其在块内(如果可能,还包括动态块)和属性中工作?
非常感谢你的帮助,它已经帮了我很多 |