- 积分
- 15341
- 明经币
- 个
- 注册时间
- 2002-2-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-10-30 12:24:00
|
显示全部楼层
r0r发表于2003-10-30 9:16:0053楼内容已改,请注意
;;解决第1,2 问题
;;当鼠标移动到满足过滤条件的像素上时,像素会闪动
;;USAGECS_EntSel "\n请选Polyline物件: " '((0 . "*Polyline")))
;;出自某人(忘了)
(defun CS_ENTSEL (STR FILTER / PT SS_NAME SS)
(if (/= (type STR) 'STR)
(progn
(princ "\n变量类型不对,STR应为字符串。\n")
(eval NIL)
)
(progn
(if (/= (type FILTER) 'list)
(progn
(princ "\n变量类型不对,FILTER应为表。\n")
(eval NIL)
)
(progn
(princ STR)
(setq PT (grread t 4 2))
(while (/= 3 (car PT))
(if (= 5 (car PT))
(progn
(setq PT (cadr PT))
(setq SS (ssget PT FILTER))
(if SS_NAME
(redraw SS_NAME 4)
)
(setq SS_NAME NIL)
(if SS
(progn
(setq SS_NAME (ssname SS 0))
(redraw SS_NAME 3)
)
)
)
(setq PT (grread t 4 2))
)
)
(setq PT (cadr PT))
(setq SS (ssget PT FILTER))
(if SS_NAME
(redraw SS_NAME 4)
)
(setq SS_NAME NIL)
(if SS
(progn
(setq SS_NAME (ssname SS 0))
(list SS_NAME PT)
)
(eval CS_NAME)
)
)
)
)
)
)
(defun C:DRAWCIRCLE_LAI (/ QQ1 QQ2 QQ3 QQ4
PTT HOLDECHO HOLDOSMODE
ENT PT R ENTC ENTL
PTS RARC PTARC ENTSS
)
(if (setq QQ1 (CS_ENTSEL "\n选择直线或圆弧..."
'((0 . "ARC,CIRCLE,LINE"))
)
)
(progn
(setq ENT (car QQ1))
(setq RARC (cdr (assoc 40 (entget ENT))))
(setq PTARC (cdr (assoc 10 (entget ENT))))
(setq PT (getpoint "\n输入通过点:"))
(setq HOLDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq HOLDOSMODE (getvar "osmode"))
(setvar "osmode" 0)
(setq QQ2 (cadr QQ1))
(setq QQ3 (entlast))
;;实时拉动、观察
(while (= (car (setq PTT (grread 2 4))) 5)
(if (not (equal (entlast) QQ3))
(progn
(prompt
(strcat "\r目前圆半径= "
(rtos (cdr (assoc 40 (entget (entlast)))) 2 4)
" "
)
)
(command "_.erase" (entlast) "")
)
)
(command "_.circle" "3p" PT "tan" QQ2 (cadr PTT))
;;(command "_.circle" "3p" PT "tan" QQ2 (osnap (cadr PTT) "_end,_int,_mid,_qua"))
)
(setq QQ4 (entlast))
(if (not (equal QQ4 QQ3))
(progn
(setq R (getdist "\n输入圆半径: "))
(entdel QQ4)
)
)
(if (and (< (distance PT PTARC) RARC) (> R RARC))
(exit)
)
(command "_.circle" PT R)
(setq ENTC (entlast))
(command "_.offset" R ENT PT "")
(setq ENTL (entlast))
(if (not (equal ENTC ENTL))
(progn
(setq PTS (GETINTERPOINT ENTC ENTL))
(entdel ENTL)
(setq ENTSS (DRAW PTS R ENT))
)
)
(if (> R RARC)
(progn
(command "_.circle" PTARC (- R RARC))
(setq ENTL (entlast))
(setq PTS (GETINTERPOINT ENTC ENTL))
(setq ENTSS (SSCAT ENTSS (DRAW PTS R ENT)))
(entdel ENTL)
)
)
(entdel ENTC)
(while (= (car (setq PT (grread 2 5))) 5)
(SSREDRAW ENTSS 3)
(redraw (setq ENTC (GETCLOSEDENT ENTSS (cadr PT))) 4)
)
(ssdel ENTC ENTSS)
(command "_.erase" ENTSS "")
(setvar "osmode" HOLDOSMODE)
(setvar "cmdecho" HOLDECHO)
)
)
(princ)
) |
|