ctrlaltdel 发表于 2022-7-5 17:26:56

Covert all blocks & blocks ins

Have many blocks & blocks within blocks that we need to convert to '0' layer excluding other entity such as lines,circles,text,dimensions.....inside this blocks.
 
Google and found many lisp & but never one that convert only blocks.
 
Please assists.

samifox 发表于 2022-7-5 17:36:04

What u mean convert block to 0?
 
Sent from my Lenovo PB1-770M using Tapatalk

ctrlaltdel 发表于 2022-7-5 17:42:17

 
Meaning change the blocks & only blocks & blocks within blocks to layer '0'

ReMark 发表于 2022-7-5 17:50:17

OK...after one eliminates all geometry, all text and all dimensions what's left of a block?
 
Can you provide us with a copy of one of these mystery blocks?An actual .dwg file not an image file.

samifox 发表于 2022-7-5 17:51:13

U dont need kisp for that. Just filter selection
 
Sent from my Lenovo PB1-770M using Tapatalk

Stefan BMR 发表于 2022-7-5 17:59:43

(defun C:LAY0 ( / acdoc) (vl-load-com) (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for blk (vla-get-blocks acdoc)   (vlax-for obj blk   (if   (eq (vla-get-objectname obj) "AcDbBlockReference")   (vla-put-layer obj "0")   )   ) ) (vla-regen acdoc acAllViewports) (princ) )

ctrlaltdel 发表于 2022-7-5 18:05:11

 
Hi Remark. nothing particular regarding the blocks. The purpose is we need to delete some entity of some layers using a 'layer delete' lisp routine. Unfortunately some blocks are in that layer, which will get deleted until we can change them all to layer '0'

ctrlaltdel 发表于 2022-7-5 18:14:14

 
Unable to since there are may levels of blocks within blocks

ctrlaltdel 发表于 2022-7-5 18:15:59

 
hi Stefan. Tested on a small dwg & it works. WIll test on actual dwg soon. Feedback soon. thank again.

Stefan BMR 发表于 2022-7-5 18:25:22

OK, great...
You might want to filter out Xrefs, Xref's blocks, dim definitions and more...

(defun LAY0 ( / acdoc) (vl-load-com) (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for blk (vla-get-blocks acdoc)   (if   (and       (eq (vla-get-isxref blk) :vlax-false)       (not (wcmatch (vla-get-name blk) "*|*,`**"))   )   (vlax-for obj blk       (if         (eq (vla-get-objectname obj) "AcDbBlockReference")         (print (vla-get-name obj))       )   )   ) ) (vla-regen acdoc acAllViewports) (princ))
页: [1] 2
查看完整版本: Covert all blocks & blocks ins