Jump to content

Recommended Posts

Posted

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 

Posted

Um... like this?

(defun c:test nil (sssetfirst nil (ssget '((0 . "INSERT") (2 . "cadtutor block 1"))))))

 

Posted

Thanks Jonathan that's working fine 

Posted (edited)

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
Posted

 

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

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