- 积分
- 26499
- 明经币
- 个
- 注册时间
- 2003-8-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 langjs 于 2011-12-22 22:17 编辑
;;; 《相同刷》v1.0
;;; ========================================================
;;; 功能:将目标文字内容刷成源文字内容,将目标圆大小刷成源圆
;;; 的大小,将目标块刷成源块一样,将目标线、圆、圆弧、
;;; 多段线等刷成源多段线相同的线宽。源为线、尺寸、填充
;;; 圆弧则目标特性匹配
;;; 使用:命令:xts,选择一个源对象,程序自动判断,再选择集
;;; 作者:langjs qq:59509100 日期:2011年12月19日
;;; ========================================================
(defun c:xts (/ ent i lst mame na pt ss tp ty u1 u2 u3 u4 uu)
(setvar "cmdecho" 0)
(vl-load-com)
(defun #err (s)
(redraw mame 4)
(setvar "nomutt" 0)
(command ".UNDO" "E")
(setq *error* $orr)
(princ)
)
(setq $orr *error*)
(setq *error* #err)
(command ".UNDO" "BE")
(while (not (and
(setq mame (car (entsel "\n选择源对象:")))
(setq ent (entget mame))
(setq ty (cdr (assoc 0 ent)))
(member ty '("TEXT" "MTEXT"
"LWPOLYLINE" "CIRCLE"
"INSERT" "LINE"
"ARC" "HATCH"
"DIMENSION"
)
)
)
)
(if (= 52 (getvar "errno"))
(vl-exit-with-error "")
)
)
(redraw mame 3)
(setvar "nomutt" 1)
(if (member ty '("TEXT" "MTEXT"))
(progn
(setq uu (cdr (assoc 1 ent)))
(princ "\n选择目标对象:<文字相同>")
(setq ss (ssget '((0 . "TEXT,MTEXT"))))
(repeat (setq i (sslength ss))
(setq ent (entget (ssname ss (setq i (1- i)))))
(entmod (subst
(cons 1 uu)
(assoc 1 ent)
ent
)
)
)
)
)
(if (= ty "CIRCLE")
(progn
(setq uu (cdr (assoc 40 ent)))
(princ "\n选择目标对象:<圆相同>")
(setq ss (ssget '((0 . "CIRCLE"))))
(repeat (setq i (sslength ss))
(setq ent (entget (ssname ss (setq i (1- i)))))
(entmod (subst
(cons 40 uu)
(assoc 40 ent)
ent
)
)
)
)
)
(if (= ty "INSERT")
(progn
(setq u1 (cdr (assoc 2 ent)))
(setq u2 (cdr (assoc 41 ent)))
(setq u3 (cdr (assoc 42 ent)))
(setq u4 (* (/ (cdr (assoc 50 ent)) pi) 180))
(princ "\n选择目标对象:<块相同>")
(setq ss (ssget '((0 . "INSERT"))))
(repeat (setq i (sslength ss))
(setq ent (entget (ssname ss (setq i (1- i)))))
(setq lst (cons (cdr (assoc 10 ent)) lst))
)
(command "erase" ss "")
(repeat (setq i (length lst))
(setq pt (nth (setq i (1- i))
lst
)
)
(command "insert" u1 pt u2 u3 u4)
)
)
)
(if (= ty "LWPOLYLINE")
(progn
(if (setq uu (cdr (assoc 43 ent)))
(princ)
(setq uu (cdr (assoc 40 ent)))
)
(princ "\n选择目标对象:<线宽相同>")
(setq ss (ssget '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE,CIRCLE"))))
(repeat (setq i (sslength ss))
(setq na (ssname ss (setq i (1- i))))
(setq ent (entget na))
(setq tp (cdr (assoc 0 ent)))
(if (member tp '("LINE" "ARC"))
(command "pedit" na "Y" "w" uu "x")
)
(if (member tp '("POLYLINE" "LWPOLYLINE"))
(command "pedit" na "w" uu "x")
)
(if (= tp "CIRCLE")
(progn
(setq u1 (cdr (assoc 10 ent)))
(setq u2 (cdr (assoc 40 ent)))
(setq u3 (- (* u2 2) uu))
(setq u4 (+ (* u2 2) uu))
(command "donut" u3 u4 u1 "")
(entdel na)
)
)
)
)
)
(if (member ty '("LINE" "ARC"
"HATCH" "DIMENSION"
)
)
(progn
(princ "\n选择目标对象:<特性匹配>")
(setq ss (ssget (list (cons 0 ty))))
(command "matchprop" mame ss "")
)
)
(redraw mame 4)
(setvar "nomutt" 0)
(command ".UNDO" "E")
(setq *error* $orr)
(princ)
)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
评分
-
查看全部评分
|