Tharwat 发表于 2022-7-6 10:57:32

需要Lisp警报功能

你好
下面的Lisp运行良好,但我想在用户选择某个内容时向其添加警报功能
除街区外的其他地方。。。。怎样
(defun c:ib (/ a blo)
(prompt "The Block you select will be inserted")
(setq a (cdr(assoc 2 (entget(car(entsel"\nSelect a Block: "))))))
(while (setq blo(getpoint"\nInsertion Point :"))
           (command "_insert" a blo "" "" "" ))
(princ "Written by Tharwat")
(princ))

谢谢和问候
塔瓦在这里

jammie 发表于 2022-7-6 11:09:19

也许这可以给你一些关于自己日常生活的想法
 
(defun c:ib (/ elist etype input)

   (if
   
   (setq input (car (entsel"\nSelect a Block: ")))

   (progn
(setq elist (entget input))
(setq etype (cdr (assoc 0 elist)))

(if
(= etype "INSERT")
(alert (strcat etype " , {"(cdr (assoc 2 elist)) "} selected "))
(alert (strcat etype " selected"))
)
)
   (alert "No point picked")
   )
   )

MSasu 发表于 2022-7-6 11:18:13

通过使用SSGET函数,可以使用过滤器约束用户选择:
 
(ssget ":S" '((0 . "INSERT")))
 
当做

Tharwat 发表于 2022-7-6 11:23:24

 
非常感谢你,杰米,你让我的日常生活变得很吸引人
顺致敬意,
塔瓦特

jammie 发表于 2022-7-6 11:27:36

 
不客气,很乐意帮忙

Tharwat 发表于 2022-7-6 11:40:53

 
谢谢你的回复,但我想知道如何使用ssget进行过滤,而不是在我的情况下使用entget。。。。你怎么想。。。。?
 
顺致敬意,
塔瓦特

MSasu 发表于 2022-7-6 11:47:35

 
下面的例子怎么样?
(defun c:ib( / OldOsnap InsPoint theBlock )
(setvar "CMDECHO" 0)
(setq OldOsnap (getvar "OSMODE"))
(prompt "\nThe Block you select will be inserted: ")
(if (setq theBlock (ssget ":S" '((0 . "INSERT"))))
(progn
(setq theBlock (cdr (assoc 2 (entget (ssname theBlock 0)))))
(while (setq InsPoint (getpoint "\nInsertion Point :"))
   (setvar "OSMODE" 0)
   (command "_INSERT" theBlock InsPoint "" "" "")
   (setvar "OSMODE" OldOsnap)
)
)
(prompt "\Nothing selected!")
)
(setvar "OSMODE" OldOsnap)
(princ)
)
 
当做

Tharwat 发表于 2022-7-6 11:51:19

 
这是一种奇妙的,也是一种巧妙的Lisp循环方式。
 
非常感谢您的关心。
 
塔瓦特

alanjt 发表于 2022-7-6 12:02:02

要更接近地模拟entsel,请使用:
 
(ssget "_+.:E:S" '((0 . "INSERT")))
页: [1]
查看完整版本: 需要Lisp警报功能