如何在Lisp編程中生成群組時(如用-Group指令),使其具有Selectable特性
TOGGLE_SELECTABLE
本帖最后由 作者 于 2003-3-19 8:03:26 编辑(defun C:TOGGLE_SELECTABLE
(/ HOLDBLIP HOLDPICKSTYLE SELECTABLE NAME A N A330 B)
(setq HOLDECHO (getvar "cmdecho"))
(setq HOLDBLIP (getvar "blipmode"))
(setq HOLDPICKSTYLE (getvar "PICKSTYLE"))
(setvar "PICKSTYLE" 0)
(setvar "cmdecho" 0)
(setvar "blipmode" 0)
(setq A (entget (car (entsel "\n选择群组对象: "))))
(while (= (assoc 102 A) NIL)
(prompt "\n你所选非群组物件: ")
(setq A (entget (car (entsel "\n请选择群组对象: "))))
)
(if (/= (assoc 102 A) NIL)
(progn
(setq A330 (cdr (assoc 330 A)))
(setq B (entget (cdr (nth 6 (entget (cdr (nth 4 A)))))))
(setq N 1)
(while (not (equal A330 (cdr (nth N B))))
(setq N (+ N 1))
)
(setq SELECTABLE (cdr (assoc 71 (entget (cdr (nth N B))))))
(setq NAME (cdr (nth (- N 1) B)))
(if (= SELECTABLE 0)
(progn
(command "GROUP" "S" NAME "")
(prompt (strcat "\n群组名称: " NAME " 设为可选择\n"))
)
(progn
(command "GROUP" "S" NAME "")
(prompt (strcat "\n群组名称: " NAME " 设为不可选择\n"))
)
)
)
)
(setvar "blipmode" HOLDBLIP)
(setvar "PICKSTYLE" HOLDPICKSTYLE)
(setvar "cmdecho" HOLDECHO)
(princ)
)
页:
[1]