本帖最后由 dcl1214 于 2024-11-12 22:07 编辑
- (defun choose_insert (/ e ents go obj pick)
- (setq go t)
- (setq ents nil)
- (setq i 1)
- (while (and go (<= i 2))
- (setq pick (vl-catch-all-apply 'entsel (list "必须选择属性块")))
- (if (vl-catch-all-error-p pick)
- (progn (setq go nil)
- (setq pick nil)
- (alert "按下了键盘esc,程序退出了")
- )
- )
- (and (setq e (car pick))
- (setq obj (vlax-ename->vla-object e))
- )
- (if (and obj
- (= (vla-Get-ObjectName obj) "AcDbBlockReference")
- (= (vla-Get-HasAttributes obj) :VLAX-TRUE)
- )
- (progn (setq ents (cons e ents)) (setq go nil))
- )
- (setq i (1+ i))
- (if (> i 2)
- (alert "给了您2次机会了,还是没选中,赶快将鼠标扔了")
- )
- (print)
- )
- ents
- )
明明有最简单的写法,非要搞最垃圾的写法 |