- ;;建立匿名块
- ;;by 龙龙仔
- (defun C:NONAME_BLK (/ HOLDECHO HOLDBLIP A AA BLKREF)
- (command "_.undo" "_group")
- (setq HOLDECHO (getvar "cmdecho"))
- (setq HOLDBLIP (getvar "blipmode"))
- (setvar "cmdecho" 0)
- (setvar "blipmode" 0)
- (prompt "\n选取对象建立匿名块: ")
- (setq AA (ssget))
- (setq A (rtos (* (getvar "CDATE") 1E8)))
- (if (/= AA NIL)
- (progn
- (command "_.BLOCK" A "0,0" AA "")
- (command "_.INSERT" A "@" "" "" "")
- (setq BLKREF (vlax-ename->vla-object (entlast)))
- (vla-put-name
- (vla-item (vla-get-blocks
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (vla-get-name BLKREF)
- )
- "*U"
- )
- (vlax-release-object BLKREF)
- )
- (alert "\n没有选取任何对象!")
- )
- (setvar "blipmode" HOLDBLIP)
- (setvar "cmdecho" HOLDECHO)
- (command "_.undo" "_end")
- (princ)
- )
|