stenna Posted June 26, 2013 Posted June 26, 2013 Morning All, Is the a lisp or some code to delete a hatch from every block in a drawing. The super market chain I'm working with use the same blocks over and over on different projects but there is a hatch on most of the blocks which interferes with my phasing drawings. I've tried Freezing/Turning Off the layer but as they have not set the blocks up with layer intelligence that doesn't work. I'm not worried about loosing the information contained within there blocks as I'm working for the builder producing CAD files that are only issued in PDF format. I don't want to explode the blocks! Look forward to your comments Quote
ReMark Posted June 26, 2013 Posted June 26, 2013 Please do not double post. Try to show some patience. We're all just volunteers here. Thank you. Quote
Tharwat Posted June 26, 2013 Posted June 26, 2013 Try this .. (vl-load-com) (defun c:Test (/ b o) ;;--- Tharwat 26.June.2013 ---;; (or doc (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) ) (vlax-for b (vla-get-blocks doc ) (if (and (eq :vlax-false (vla-get-isLayout b)) (eq :vlax-false (vla-get-isXref b)) ) (vlax-for o b (if (eq "AcDbHatch" (vla-get-objectname o)) (vl-catch-all-apply 'vla-delete (list o)) ) ) ) ) (vla-regen doc acAllViewports) (princ) ) Quote
dbroada Posted June 26, 2013 Posted June 26, 2013 if they are the same blocks used many times in different drawings you only need to modify one instance of each block, behaps using BEDIT or Tharwat's code. Then having modified all the necessary blocks in a single "master" drawing you can use the Design Centre to redefine the blocks in any current drawing. Quote
stenna Posted September 18, 2013 Author Posted September 18, 2013 Tharwat, I've finally had 5 mins to look at your code; it works just fine many thanks apart from one thing could you amend the code so it only works on selected items rather than across the whole drawing. We have a number of blocks that we now use that contain gradient fill/hatching and I don't want to delete the the hatch from them. Look forward to hearing from you Thanks again Stenna Quote
Tharwat Posted September 18, 2013 Posted September 18, 2013 Tharwat,I've finally had 5 mins to look at your code; it works just fine many thanks apart from one thing could you amend the code so it only works on selected items rather than across the whole drawing. Try this ... (vl-load-com) (defun c:Test (/ ss i sn name bd l) ;; Tharwat 18. Sep. 2013 ;; (or acdoc (setq acdoc (vla-get-activedocument (vlax-get-acad-object))) ) (if (setq ss (ssget "_:L" '((0 . "INSERT")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (if (not (member (setq name (cdr (assoc 2 (entget sn)))) l) ) (progn (setq l (cons name l)) (vlax-for x (setq bd (vla-item (vla-get-blocks acdoc) name ) ) (if (and (eq :vlax-false (vla-get-isxref bd)) (eq (vla-get-objectname x) "AcDbHatch") ) (vl-catch-all-apply 'vla-delete (list x)) ) ) ) ) ) (princ) ) (if ss (vla-regen acdoc acAllViewports) ) (princ) ) Quote
Tharwat Posted September 25, 2013 Posted September 25, 2013 Did you find any five minutes more to look at the code or not yet ? Quote
stenna Posted September 25, 2013 Author Posted September 25, 2013 I have just used it for the first time in the last five minutes and it works a blinder.....super coding Many Thanks Quote
Tharwat Posted September 25, 2013 Posted September 25, 2013 I have just used it for the first time in the last five minutes and it works a blinder.....super coding Many Thanks Happy to hear that at last 1 Quote
stenna Posted September 25, 2013 Author Posted September 25, 2013 You've saved me about 2 hours of editing blocks this evening. Many thanks Quote
Tharwat Posted September 25, 2013 Posted September 25, 2013 You've saved me about 2 hours of editing blocks this evening. Many thanks Best of luck and happy CADing Quote
mirco354 Posted March 23, 2015 Posted March 23, 2015 Good morning to you all , loading the lisp indicated by the following error : ; error: syntax error ; error: syntax error you know help me? Mirco Quote
VVA Posted March 29, 2015 Posted March 29, 2015 Try my solution HatchDel More link delete all hatch 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.