本帖最后由 作者 于 2007-1-4 3:58:04 编辑
- ;;(mkublk ss inspt) =做无名块 ---by 狂刀.
- (defun xt-mkUblk (ss inspt / BLKOBJ *doc I OBJS)
- (setq *doc (vla-get-activedocument (vlax-get-acad-object))
- inspt (vlax-3d-point(trans inspt 1 0 ))
- i -1
- )
- (repeat (sslength ss)
- (setq objs(cons (vlax-ename->vla-object (ssname ss (setq i (1+ i))))objs))
- )
- (setq blkobj(vla-add (vla-get-blocks *doc) inspt "*U"))
- (vlax-invoke *doc 'copyobjects objs blkobj)
- (mapcar 'vla-delete objs)
- (vla-insertblock (vla-get-ModelSpace *doc) inspt(vla-get-name blkobj) 1 1 1 0)
- blkobj
- )
实例:- (defun c:mkublk (/ pt)
- (princ "\n **做无名块**")
- (if (setq ss (ssget))
- (progn
- (setq inspt (getpoint "\n 定义块插入点/<0,0,0>:"))
- (if (not inspt)(setq inspt '(0. 0. 0.)))
- (xt-mkUblk ss inspt)
- )
- )
- )
|