esputro Posted October 17, 2012 Posted October 17, 2012 Dear all, Sorry if this title was discussed before, please does anyone know lisp to find block and mark them. i have a lot block with my drawing and make some change with them, but it's to much time to find one by one. thanks you, esputro Quote
BIGAL Posted October 17, 2012 Posted October 17, 2012 What changes do you want to make, are you looking at changing the attributes, is each change the same or individual. Quote
esputro Posted October 17, 2012 Author Posted October 17, 2012 Hi bigal, thanks for reply, i just want to find block and after that mark them all block that i want, and no changing for attributes. thanks. Quote
pBe Posted October 17, 2012 Posted October 17, 2012 (edited) I believe what Bigal is suggesting to you is use Bedit to make changes on the block globally. or highlight the blocks (sssetfirst nil (ssget "_X" '((2 . "blockname")))) Edited October 17, 2012 by pBe Quote
esputro Posted October 17, 2012 Author Posted October 17, 2012 Hi Pbe, sorry, please find attachment for illustarion. examples, I have drawing with huge off block, and i want to find (Ex.Block LF9) and after that mark of them automatically with lisp where there are. if i do manually i think it will spend the time.. Thanks, esputro Quote
pBe Posted October 17, 2012 Posted October 17, 2012 I understand what you mean esputro, but tell us what exactly are you're going to do with the block when found? Put a marked on the block and leave the mark there? Quote
esputro Posted October 17, 2012 Author Posted October 17, 2012 hi pbe, it's just for my reference, i am electrical and i have equipment tagging that i need to change. thanks, rgds Quote
pBe Posted October 17, 2012 Posted October 17, 2012 if thats all you want to do then use the snip i posted on my first post or (defun c:markb (/ bn blks e)(vl-load-com) (setq bn "Block LF9") (if (setq blks (ssget "_x" (list (cons 2 bn)(cons 410 (getvar 'ctab))))) (repeat (sslength blks) (vla-highlight (vlax-ename->vla-object (setq e (ssname blks 0))) :vlax-true) (ssdel e blks) ) ) ) or even QSELECT Quote
esputro Posted October 17, 2012 Author Posted October 17, 2012 thanks pbe that works, but the problem is if i choose for others block i must change again for lisp. do you have any idea for general options to show all existing blocks. Rgds, esp Quote
pBe Posted October 17, 2012 Posted October 17, 2012 (edited) EDIT: see post # 12 Next page ----->>>> Edited October 17, 2012 by pBe Quote
Tharwat Posted October 17, 2012 Posted October 17, 2012 Try this simple routine with Dialogue . Put the dcl file in the following path C:\Program Files\AutoCAD 2010\SupportThen run the following routine .MarkBlock.LSP MarkBlock.DCL Quote
pBe Posted October 17, 2012 Posted October 17, 2012 ahh. i think i misunderstood the OP (defun c:markb (/ bn blks e hl) (vl-load-com) (setq ef (lambda (e) (vla-get-effectivename (vlax-ename->vla-object e)))) (prompt "\nSelect Block to highlight") (if (and (setq hl (ssadd) bl (ssget ":S:E" '((0 . "INSERT")))) (setq bn (ef (ssname bl 0))) (setq blks (ssget "_x" (list '(0 . "INSERT") (cons 2 (strcat bn ",`*u*"))(cons 410 (getvar 'ctab)))))) (progn (repeat (sslength blks) (if (eq bn (ef (setq e (ssname blks 0)))) (ssadd e hl)) (ssdel e blks) ) (sssetfirst nil hl) ) ) ) but then again. if the OP is planning to change a value on the block ...equipment tagging that i need to change.... , change the sssetfirst line to whatever function. Quote
pBe Posted October 17, 2012 Posted October 17, 2012 Nice tharwat Suggest to exclude xref nested blocks (xxx|yyy) and to include anonymous names on the ssget filter. Quote
Tharwat Posted October 17, 2012 Posted October 17, 2012 Thanks pBe. I completely forgot about Dynamic Blocks Here is a better one for all kinds of Blocks Xref included . MarkBlock.DCL MarkBlock.LSP Quote
troggarf Posted October 17, 2012 Posted October 17, 2012 Here is one that was made by Patrick http://www.patrickemin.com/ All i did was change a couple of prompts from French into english http://autocadtips.wordpress.com/2012/09/10/autolisp-find-blocks-and-mark-them/ Quote
troggarf Posted October 9, 2020 Posted October 9, 2020 Hey Tharwat, How do I increase the width of the dialog box for the MarkBlock routine? Quote
Tharwat Posted October 9, 2020 Posted October 9, 2020 8 minutes ago, troggarf said: Hey Tharwat, How do I increase the width of the dialog box for the MarkBlock routine? Hi, You can add the width attribute to do so and you can increase the digit ( 40 ) to fit your desired presentation as follows; MarkBlock: dialog { label = "Search for Blocks"; width = 40; : column { ........ Quote
troggarf Posted October 9, 2020 Posted October 9, 2020 Thank you Tharwat. That worked great. Thanks again ~Greg 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.