本帖最后由 chen3732088 于 2025-7-29 14:00 编辑
下面代码可以复制最底层的嵌套块,与其说复制不如说获取块名重新插入,我想修改选到不是嵌套块时复制图元,但是想不出来,求大神提供思路(尽量不要用ncopy,中望只有26版才有) - (defun c:BBC ()
- (setvar "cmdecho" 0)
- (setq data (nentselp "\n选择块内实体: ")
- dataent (cadddr data)
- listcount (length dataent)
- )
- (if (>= listcount 2)
- (progn
- (setq dataX (car dataent)
- blocka (entget dataX)
- bname (cdr (assoc 2 blocka))
- xscale (cdr (assoc 41 blocka))
- yscale (cdr (assoc 42 blocka))
- bton (cdr (assoc 50 blocka))
- pb (getpoint "\n选择块复制位置:")
- )
- (command "INSERT" bname pb xscale yscale (/ (* bton 180) pi))
- )
- (princ "\n所选不是嵌套块:")
- ;(progn
- ;(setq objbz (car data))
- ;(command "NCOPY" objbz "" "" (pause))
- ;)
- )
- (setvar "cmdecho" 1)
- (princ)
- )
|