- 积分
- 26504
- 明经币
- 个
- 注册时间
- 2003-8-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 langjs 于 2012-2-4 15:39 编辑
参考这两个帖子,做了一个假尺寸(手动修改过的尺寸)检查工具。假尺寸数值显示红色,再次运行恢复不显示,连续运行闪烁
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=89808。http://bbs.mjtd.com/forum.php?mod=viewthread&tid=87563
;;; ==========================================
;;; 名称: 《假尺寸检查》
;;; 功能:假尺寸(手动修改过的尺寸)数值显示红色
;;; 操作:运行JCC显示假尺寸,再次运行恢复不显示
;;; langjs
;;; ==========================================
(defun C:JCC (/ i ss)
(vl-load-com)
(setvar "cmdecho" 0)
(if (setq ss (ssget "X" '((0 . "DIMENSION") (-3 ("ACAD")))))
(repeat (setq i (sslength ss))
(entmod (list (cons -1 (ssname ss (setq i (1- i)))) (list -3 (list "ACAD"))))
)
(if (setq ss (ssget "X" '((0 . "DIMENSION") (-4 . "<AND")(-4 . "<NOT")(1 . "")(-4 . "NOT>")(-4 . "<NOT")(1 . "*<>*")(-4 . "NOT>")(-4 . "AND>"))))
(repeat (setq i (sslength ss))
(vlax-put-property (vlax-ename->vla-object (ssname ss (setq i (1- i)))) "textcolor" 1)
)
(alert "本图没有找到假尺寸!")
)
)
(princ)
)
13楼建议:"执行过之后标注文字和箭头的大小会还原到当前环境设置的大小,建议修改成文字和箭头大小不变,只变颜色"
做了一下修改,不过代码不精简了,有点罗嗦
;;; ==========================================
;;; 名称: 《假尺寸检查》
;;; 功能:假尺寸(手动修改过的尺寸)数值显示红色
;;; 操作:运行jcc显示假尺寸,再次运行恢复不显示
;;; langjs
;;; ==========================================
(defun c:jcc (/ col ent i ss ss0 ss1)
(vl-load-com)
(setvar "cmdecho" 0)
(if (progn
(setq ss (ssadd) ss1 (ssadd))
(if (setq ss0 (ssget "X" '((0 . "DIMENSION"))))
(progn
(repeat (setq i (sslength ss0))
(setq ent (ssname ss0 (setq i (1- i))))
(if (= (vla-get-textcolor (vlax-ename->vla-object ent)) 1) ; 查找红色的假尺寸
(setq ss (ssadd ent ss))
(setq ss1 (ssadd ent ss1))
)
)
(if (> (sslength ss) 0)
(if (> (sslength ss1) 0)
(setq col (vla-get-textcolor (vlax-ename->vla-object (ssname ss1 0))))
(progn
(setq col (getint "\n 输入尺寸恢复颜色[1红,2黄,3绿,4青,5蓝,6洋红,7白]:<3>"))
(if (null col)
(setq col 3)
)
)
)
)
)
)
(> (sslength ss) 0)
)
(progn
(princ (strcat "\n " (itoa (sslength ss)) "个假尺寸恢复颜色。"))
(repeat (setq i (sslength ss))
(vlax-put-property (vlax-ename->vla-object (ssname ss (setq i (1- i)))) "textcolor" col) ; 颜色恢复
)
)
(if (setq ss (ssget "X" '((0 . "DIMENSION") (-4 . "<AND")(-4 . "<NOT")(1 . "")(-4 . "NOT>")(-4 . "<NOT")(1 . "*<>*")(-4 . "NOT>")(-4 . "AND>"))))
(progn
(princ (strcat "\n " (itoa (sslength ss)) "个假尺寸数值显示红色。"))
(repeat (setq i (sslength ss))
(vlax-put-property (vlax-ename->vla-object (ssname ss (setq i (1- i)))) "textcolor" 1) ; 显示红色
)
)
(alert "\n本图没有找到假尺寸!")
)
)
(princ)
)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
查看全部评分
|