把右键确认过掉
(defun c:deby()(princ "\n 右键确定")
(setq ss(ssget '((0 . "ARC" ))))
(setq len(sslength ss))
(setq i -1)
(repeat len
(setq i (1+ i))
(setq en1(ssname ss i))
(setq e1 (entget en1))
(setq o (cdr (assoc 10 e1))
r (cdr (assoc 40 e1))
p0 (cdr (assoc 50 e1))
pn (cdr (assoc 51 e1)))
(command "circle" o r ))
(command "erase" ss "")
(princ)
)
优化成:不需要右键确认, 直接执行
(defun c:deby()
(princ "\n 右键确定")
(setq ss(ssget ":S" '((0 . "ARC" ))))
(setq len(sslength ss))
(setq i -1)
(repeat len
(setq i (1+ i))
(setq en1(ssname ss i))
(setq e1 (entget en1))
(setq o (cdr (assoc 10 e1))
r (cdr (assoc 40 e1))
p0 (cdr (assoc 50 e1))
pn (cdr (assoc 51 e1)))
(command "circle" o r ))
(command "erase" ss "")
(princ)
) TLQ 发表于 2023-7-2 10:39
(defun c:deby()
(princ "\n 右键确定")
这样就只能单选了,不能框选 这么简单的问题还问一下 搜一下ssget用法 就有好多 飞雪神光 发表于 2023-7-2 11:19
这么简单的问题还问一下 搜一下ssget用法 就有好多
要框选的话,选择完后必须要确认,不然程序哪知道你选择完成了?
(defun c:deby (/ E1 EN1 I LEN O R SS)
(princ "\n请选择要变成圆的圆弧:")
(if (setq ss (ssget '((0 . "ARC"))))
(progn
(setq len (sslength ss))
(setq i 0)
(repeat len
(setq en1 (ssname ss i))
(setq e1 (entget en1))
(setq o (cdr (assoc 10 e1))
r (cdr (assoc 40 e1))
)
(entmake (list '(0 . "CIRCLE")
(cons 10 o)
(cons 40 r)
)
)
(entdel en1)
(setq i (1+ i))
)
(princ "\n已完成<")
(princ (rtos i 2 0))
(princ ">个圆弧变圆!:")
)
(princ "\n没有选择到圆弧!")
)
(princ)
) andyding 发表于 2023-7-3 14:32
要框选的话,选择完后必须要确认,不然程序哪知道你选择完成了?
(defun c:deby (/ E1 EN1 I LEN O R SS)
...
多谢大佬,
页:
[1]