本帖最后由 自贡黄明儒 于 2013-5-7 11:25 编辑
;;检查尺寸是否标注在端点、交点、中点,否则尺寸标注可能有误-------------自贡黄明儒 2013年5月7日
- ;;检查尺寸是否标注在端点、交点、中点,否则尺寸标注可能有误-------------自贡黄明儒 2013年5月7日
- ;;6.1 返回当前视窗左下角和右上角 坐标
- (defun viewpnts (/ a b c d x)
- (setq b (getvar "viewsize")
- c (car (getvar "screensize"))
- d (cadr (getvar "screensize"))
- a (* b (/ c d))
- x (setq x (getvar "viewctr"))
- x (trans x 1 2)
- c (list (- (car x) (/ a 2.0)) (- (cadr x) (/ b 2.0)) 0.0)
- d (list (+ (car x) (/ a 2.0)) (+ (cadr x) (/ b 2.0)) 0.0)
- c (trans c 2 1)
- d (trans d 2 1)
- )
- (list c d)
- )
- ;;6.2 功能:尺寸起末点不在线端点数值显示红色
- (defun CheckDimesionEndPoint
- (/ ENT I LST NAME POINT13 POINT14 PT3 PT4 SS)
- (setq lst (viewpnts))
- (if (setq ss (ssget "W" (car lst) (cadr lst) '((0 . "DIMENSION"))))
- (progn ;;(command "._zoom" "_E")
- (repeat (setq i (sslength ss))
- (setq name (ssname ss (setq i (1- i)))
- ent (entget name)
- )
- (setq point13 (cdr (assoc 13 ent)))
- (setq point14 (cdr (assoc 14 ent)))
- (setq pt3 (osnap point13 "_end,_int,_cen"))
- (setq pt4 (osnap point14 "_end,_int,_cen"))
- (if (and (equal point13 pt3 0.0001)
- (equal point14 pt4 0.0001)
- )
- nil
- (vlax-put-property
- (vlax-ename->vla-object name)
- "textcolor"
- 1
- )
- )
- )
- )
- )
- ;;(command "._zoom" "_P")
- (princ)
- )
|