修改块名
(defun $block-rename$ (ent oldname newname lst / blocks blk rename obj);修改块名
(if (not oldname)
(ifent
(progn
(if (= (TYPE ent) 'ENAME)
(SETQ OBJ (vlax-ename->vla-object ent))
)
(setq oldname (vl-catch-all-apply
'vla-get-effectivename
(list obj)
)
)
(if (vl-catch-all-error-p oldname)
(setq oldname (vl-catch-all-apply 'vla-get-name (list obj)))
)
(if (vl-catch-all-error-p oldname)
(setq oldname nil)
)
)
)
)
(if newname
(progn
(setq blocks (vla-get-blocks
(vla-get-activeDocument (vlax-get-acad-object))
)
)
(setq blk (vl-catch-all-apply 'vla-item (list blocks oldname)))
(vl-catch-all-apply 'vla-put-name (list blk newname))
(setq rename (vla-get-name blk))
(vl-catch-all-apply 'vlax-release-object (list blocks))
(vl-catch-all-apply 'vlax-release-object (list blK))
)
)
rename ;返回
)
学的了,很有用 我的梦想 谢谢分享谢谢分享谢谢分享 多了一个参数lst? 谢谢分享,写得好严谨的函数。 可以搞一个修改块插入点的功能吗 感谢大佬分享 感谢大佬分享
页:
[1]