Jump to content

find and mark block lisp


esputro

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by pBe
Link to comment
Share on other sites

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

find-block.jpg

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

ahh. i think i misunderstood the OP :lol:

 

(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.

Link to comment
Share on other sites

  • 7 years later...
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 { ........

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...