如何实现一个功能,炸开块中块,但是最外层的块不炸开
就像题目说的,我想实现一个功能,炸开块中块,但是最外层的块不炸开。我在论坛里看到一炸到底的工具,这个我大概理解了,就是设置一个循环,直到炸无可炸。但是保留最外层,将块里面炸开还没有这样的帖子。希望有大佬看见指点一二,不胜感激。http://bbs.mjtd.com/thread-183752-1-1.html undo代码你自己去写一下
(defun c:xx(/ s i res)
(setq s (ssget "_+.:E:S" '((0 . "INSERT"))))
(undobe)
(setq i 0)
(setq res (xpinside s))
(if (= (member "on" res) nil)
(princ "\n对象内不含嵌套块")
(PROGN
(while
(member "on" res)
(setq res (xpinside s))
)
(princ "\n已分解嵌套块"))
)
(setq i nil)
(undoe)
(prin1)
)
(defun xpinside (s / lock)
(setq lock "off")
(LM:ApplytoBlockObjects
(vla-get-blocks
(vla-get-activedocument (vlax-get-acad-object)))
(vla-get-effectivename
(vlax-ename->vla-object (ssname s 0)))
'(lambda (obj)
(if
(= (vla-get-ObjectName obj) "AcDbBlockReference")
(PROGN (vla-explode obj) (vla-delete obj) (setq lock "on"))
)
)
)
)
(defun LM:ApplytoBlockObjects (blks name func / result)
(setq func (eval func))
(if
(not
(vl-catch-all-error-p
(setq def (vl-catch-all-apply 'vla-item (list blks name)))
)
)
(vlax-for obj def (setq result (cons (func obj) result)))
)
(reverse result)
)
菜卷鱼 发表于 2023-8-28 08:37
undo代码你自己去写一下
大佬 UNDO代码咋写,方便写一下吗 dting2011 发表于 2023-12-29 10:37
大佬 UNDO代码咋写,方便写一下吗
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=168922 muwind 发表于 2023-12-29 22:27
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=168922
感谢分享,先mark下,学会了再来改
页:
[1]