Jump to content

Select Specific Blocks by knowing their names


Ahmed_Hisham

Recommended Posts

Hi all, 

 

I want to select specific block by knowing its name lets say block name "cadtutor block 1" by using (vl-catch-all-apply) method 

 

Thanks 

Link to comment
Share on other sites

FWIW - Perhaps a little more complete routine for an example: Just remove the "X" from the ssget statement if you want to select items instead of searching the whole drawing.

(defun c:TEST ()
   (if (/= (setq nam (getstring T "\nEnter Name of Block: ")) "")
      (if (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 nam))))
         (progn
            (sssetfirst nil ss)
            (Princ (strcat "\nFound " (itoa (sslength ss)) " Block(s) named \"" nam "\" inserted in this drawing. "))
         )
         (princ (strcat "\n No Block name \"" nam "\" found. "))
      )
      (princ "\nNo Block Name Entered ")
   )
   (princ)
)

 

Edited by pkenewell
Link to comment
Share on other sites

 

If you want just Model space

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 nam)(cons 410 "Model"))))

current layout

(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 nam)(cons 410 (getvar 'ctab)))))

 

  • Like 1
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...