Jump to content

Autolisp For Selection Sets


VHMN

Recommended Posts

Hello, my name is Victor, and this is my first post here, I'm currently learning Autolisp (this site has been very useful) i'm trying to create a LISP routine that allows me to pick a block, extract it's block name, asign it to a variable, and then select all the blocks with the same name, I got it right untill the extraction of the block name, but I can't assign that name to a variable, any help would be appreciated, thanks.

 

 

(DEFUN C:SBN ()

(SETQ BNAME(cdr (assoc 2 (entget (car (entsel)))))))

(SSGET "X" BNAME))

Link to comment
Share on other sites

Thanks a lot, it worked really well, I've never heard about the "sssetfirst" function, I guess it's for keeping my selection active, I'll use it for selecting objects specifying colors too.

 

Thanks

Link to comment
Share on other sites

Food for thought...

 

(defun c:SBN (/ ent eLst)
 (if (setq ent (car (entsel "\nSelect block: ")))
   (if (eq "INSERT" (cdr (assoc 0 (setq eLst (entget ent)))))
     (sssetfirst nil (ssget "_X" (list '(0 . "INSERT") (assoc 2 eLst))))
     (princ "\nInvalid object.")
   )
 )
 (princ)
)

Link to comment
Share on other sites

Hey, thanks for that, I'll try to add that "if-then-else" routine, I mostly use Autolisp for macross to help me draw stuff, but it would be mor proffessional to have more user-friendly routines.

 

Thanks

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