ctrlaltdel Posted July 25, 2016 Share Posted July 25, 2016 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. Quote Link to comment Share on other sites More sharing options...
samifox Posted July 25, 2016 Share Posted July 25, 2016 What u mean convert block to 0? Sent from my Lenovo PB1-770M using Tapatalk Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted July 25, 2016 Author Share Posted July 25, 2016 What u mean convert block to 0? Sent from my Lenovo PB1-770M using Tapatalk Meaning change the blocks & only blocks & blocks within blocks to layer '0' Quote Link to comment Share on other sites More sharing options...
ReMark Posted July 25, 2016 Share Posted July 25, 2016 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. Quote Link to comment Share on other sites More sharing options...
samifox Posted July 25, 2016 Share Posted July 25, 2016 U dont need kisp for that. Just filter selection Sent from my Lenovo PB1-770M using Tapatalk Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted July 25, 2016 Share Posted July 25, 2016 (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) ) Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted July 25, 2016 Author Share Posted July 25, 2016 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. 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' Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted July 25, 2016 Author Share Posted July 25, 2016 U dont need kisp for that. Just filter selection Sent from my Lenovo PB1-770M using Tapatalk Unable to since there are may levels of blocks within blocks Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted July 25, 2016 Author Share Posted July 25, 2016 (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) ) hi Stefan. Tested on a small dwg & it works. WIll test on actual dwg soon. Feedback soon. thank again. Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted July 25, 2016 Share Posted July 25, 2016 hi Stefan. Tested on a small dwg & it works. WIll test on actual dwg soon. Feedback soon. thank again. 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) "*|*,`*[EADX]*")) ) (vlax-for obj blk (if (eq (vla-get-objectname obj) "AcDbBlockReference") (print (vla-get-name obj)) ) ) ) ) (vla-regen acdoc acAllViewports) (princ) ) Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted July 26, 2016 Author Share Posted July 26, 2016 Stefan. Your first code works well for my work. Really is life saver. Will try your other code when time permits. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.