hosyn Posted July 2, 2013 Posted July 2, 2013 1-Are there any lisp to fix all block in dwg in one command??? 2-what is diffrences between fix and norm the block? 3-what we tend to fix block??? Quote
pBe Posted July 2, 2013 Posted July 2, 2013 1-Are there any lisp to fix all block in dwg in one command???2-what is diffrences between fix and norm the block? 3-what we tend to fix block??? 1.Redefine the block [bedit/via insert] 2.Dont know what that means 3.Dont know what that means Quote
hosyn Posted July 2, 2013 Author Posted July 2, 2013 thanx of both 1--I wanna with lisp for all blocks that all object in the blocks move to layer 0. 2--I have a huge dwg file and i audit and purge it (about 12mb) ...when i want merge some layers dont act well lyrmrg command . there are some blocks there and i wanna fix them by step 1 ... Quote
neophoible Posted July 2, 2013 Posted July 2, 2013 thanx of both1--I wanna with lisp for all blocks that all object in the blocks move to layer 0. 2--I have a huge dwg file and i audit and purge it (about 12mb) ...when i want merge some layers dont act well lyrmrg command . there are some blocks there and i wanna fix them by step 1 ... So, if I understand correctly, you have some (or a lot of) blocks that are defined with objects on layers other than layer 0, and you want to redefine these blocks (or all of the blocks in the drawing) via LISP to place all of those objects in the block definitions on layer 0. This will then allow you to purge the affected layers, assuming this is the only problem with those layers. In other words, 1. Go through all of the blocks in a drawing 2. For each block, place all of its entities on layer 0 3. Update all of the block insertions in the drawing Question: Are there any xrefs that will prevent this from allowing you to purge the drawing afterward? Quote
neophoible Posted July 2, 2013 Posted July 2, 2013 Here are some links for changing block entities to layer 0, etc., via LISP: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Block-lisp-to-set-layer-to-0/td-p/1815551 http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Move-to-0-layer-lisp/td-p/2586044 http://forums.cadalyst.com/showthread.php?t=6061 Quote
hosyn Posted July 2, 2013 Author Posted July 2, 2013 thanx neophoible So, if I understand correctly, you have some (or a lot of) blocks that are defined with objects on layers other than layer 0, and you want to redefine these blocks (or all of the blocks in the drawing) via LISP to place all of those objects in the block definitions on layer 0. This will then allow you to purge the affected layers, assuming this is the only problem with those layers. In other words, 1. Go through all of the blocks in a drawing 2. For each block, place all of its entities on layer 0 3. Update all of the block insertions in the drawing Yes exsactly , u understand correctly and i wanna 3 step above by one lisp code run for all blocks in dwg file .are there any code for it?? Quote
neophoible Posted July 2, 2013 Posted July 2, 2013 (edited) thanx neophoible Yes exsactly , u understand correctly and i wanna 3 step above by one lisp code run for all blocks in dwg file .are there any code for it?? Did you look at the links I provided? The third may be your best option, but you might take a look at all of them for the discussion. Edited July 3, 2013 by neophoible it was a question Quote
pBe Posted July 3, 2013 Posted July 3, 2013 thanx of both1--I wanna with lisp for all blocks that all object in the blocks move to layer 0. 2--I have a huge dwg file and i audit and purge it (about 12mb) ...when i want merge some layers dont act well lyrmrg command . there are some blocks there and i wanna fix them by step 1 ... When you're done with step 1 , I'm guessing step 2 [lyrmrg] wont be a problem then. Quote
hosyn Posted July 6, 2013 Author Posted July 6, 2013 Lyrmrg dont work in my files i dont know exactly why, but it sounds my block in dwg files must be fix (object move to layer 0),,,,,and there are a lot of block there and i must looking for lisp that fix all blocks first. Quote
Dadgad Posted July 7, 2013 Posted July 7, 2013 The shortcall for LAYER MERGE is LAYMRG, not LYRMRG, or at least it has been for the last few years, unless it has been changed in 2014. Quote
neophoible Posted July 7, 2013 Posted July 7, 2013 Lyrmrg dont work in my files i dont know exactly why, but it sounds my block in dwg files must be fix (object move to layer 0),,,,,and there are a lot of block there and i must looking for lisp that fix all blocks first.I'm mentioning this for the third time now--Did you look at the links in post #6 above? Quote
pBe Posted July 7, 2013 Posted July 7, 2013 The shortcall for LAYER MERGE is LAYMRG, not LYRMRG, or at least it has been for the last few years,unless it has been changed in 2014. The only thing that change is my eyesight it is indeed LAYMRG. Use SETBYLAYER command. SETBYLAYER wont change the objects layer inside the block. Quote
hosyn Posted July 7, 2013 Author Posted July 7, 2013 Dear neophoible I'm mentioning this for the third time now--Did you look at the links in post #6 above? I try 3 link you are mentioned them and unfortunately the suggestion lisp working with one block at time not together . Quote
neophoible Posted July 9, 2013 Posted July 9, 2013 Dear neophoible I try 3 link you are mentioned them and unfortunately the suggestion lisp working with one block at time not together . Did you try all of the offered solutions in all three of the links? What about bl0.lsp? What about fixall.lsp? What were the results? Of course, I always recommend trying any solutions on sample drawings, and NOT on any original, only copy DWGs! Quote
Amalgama Posted July 9, 2013 Posted July 9, 2013 (edited) Try this Lisp. It isn't mine, I copied it somewhere long time ago. The credits should go to the autor because for me this LISP works like magic. Read the commands properly and follow them. Or you can miss some steps. (defun C:FixBlock (/ ss cnt idx blkname donelist Grp Update) (defun Grp (gc el) (cdr (assoc gc el))) (defun Update (bname / ename elist) (setq ename (tblobjname "BLOCK" bname)) (if (and ename (zerop (logand 52 (Grp 70 (entget ename '("*")))))) (progn (while ename (setq elist (entget ename '("*")) elist (subst '(8 . "0") (assoc 8 elist) elist) elist (if (assoc 62 elist) (subst '(62 . 0) (assoc 62 elist) elist) (append elist '((62 . 0))))) (entmake elist) (setq ename (entnext ename))) (if (/= "ENDBLK" (Grp 0 elist)) (entmake '((0 . "ENDBLK") (8 . "0") (62 . 0)))) 'T)) ) (if (> (logand (Grp 70 (tblsearch "layer" "0")) 1) 0) (princ "\nLayer 0 must be thawed before running FIXBLOCK!\n") (progn (if (progn (princ "\nPress <Enter> to fix all defined blocks\n") (setq cnt 0 ss (ssget '((0 . "INSERT"))))) (progn (setq idx (sslength ss)) (while (>= (setq idx (1- idx)) 0) (if (not (member (setq blkname (Grp 2 (entget (ssname ss idx)))) donelist)) (progn (if (Update blkname) (setq cnt (1+ cnt))) (setq donelist (cons blkname donelist)))))) (while (setq blkname (Grp 2 (tblnext "BLOCK" (not blkname)))) (if (Update blkname) (setq cnt (1+ cnt))))) (princ (strcat "\n" (itoa cnt) " block" (if (= cnt 1) "" "s") " redefined\n")))) (princ) (command "setbylayer" "y" "y") ) Edited July 11, 2013 by SLW210 Quote
hosyn Posted July 11, 2013 Author Posted July 11, 2013 So thanxxxxxxxxx to all speacially leemac neophoible and Amalgama the suggestion lisp for fix block is great --fixall.all and ,, but my drawing is huge and laymrg at the pogrom dont act well and is stopped -that give me some error when i looking for that error noticed that related to the style font of drawing---it means that donot act well although i fixed my block. Quote
neophoible Posted July 12, 2013 Posted July 12, 2013 So thanxxxxxxxxx to allspeacially leemac neophoible and Amalgama the suggestion lisp for fix block is great --fixall.all and ,, but my drawing is huge and laymrg at the pogrom dont act well and is stopped -that give me some error when i looking for that error noticed that related to the style font of drawing---it means that donot act well although i fixed my block. You are welcome, hosyn. Hope you can get it working. Not sure what to do about the font. If nothing else, perhaps you can break out parts of your drawing into separate drawings, then reassemble once you've gotten everything worked out. Quote
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.