试试这个,它没有错误检查,因为它做得很快,阅读评论,了解它在做什么。我做了测试,它不会改变各种布局上的内容,因为你没有提到。它可以与一个脚本一起使用,一次完成所有80个dwg,我不想让你混淆如何也做到这一点。一个提示是,打开浏览器,将lisp保存到dwg上,只需拖放到dwg上,它就会立即启动,只需保存几个步骤。
- (defun c:reset-blk ( / ss newlay newlt bname)
- (vl-load-com)
- (setq obj (vlax-ename->vla-object (car (entsel "\nPick Block")))) ;pick an object and make it a Vl object
- (setq newlt (getstring "\nEnter linetype name Bylayer")) ; enter linetype name
- (setq newlay (getstring "\nEnter layer name")) ; enter new layer name
- (setq bname (vla-get-name obj)) ; get the blocks name
- (setq ss (ssget "x" (list (cons 0 "INSERT") (cons 2 bname)))) ; make a collection of the block
- (repeat (setq x (sslength ss)) ; loop through the collection and change stuff
- (setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) ; get a block
- ; (vla-put-color blk 0) ; change its color 0 is Bylayer
- (vla-put-linetype blk newlt) ; change linetype note BYLAYER
- (vla-put-layer blk newlay) ; change its layer
- )
- )
- (c:reset-blk)
|