- ;; 快速以时间命名建块
- (defun c:tt (/ ss pt doc bn blks i obj lst)
- (if (and (setq ss (ssget))
- (setq pt (getpoint "\n指定插入点: "))
- )
- (progn
- (setq doc (vla-get-activedocument (vlax-get-acad-object))
- blks (vla-get-blocks doc)
- pt (vlax-3d-point (trans pt 1 0))
- bn (strcat "lz_" (rtos (* (getvar 'cdate) 1e6) 2 0))
- mps (if (= (getvar 'cvport) 1)
- (vla-get-paperspace doc)
- (vla-get-modelspace doc)
- )
- blk (vla-add blks pt bn)
- i (sslength ss)
- )
- (repeat i
- (setq i (1- i)
- obj (vlax-ename->vla-object (ssname ss i))
- lst (cons obj lst)
- )
- (vla-put-layer obj "0")
- )
- (vlax-invoke doc 'copyobjects lst blk)
- (vla-insertblock mps pt bn 1 1 1 0)
- (mapcar 'vla-delete lst)
- )
- )
- (princ)
- )
|