Jump to content

Construct a list for sssetfirst


Michaels

Recommended Posts

Hello

 

I do wonder how to make the function sssetfirst to select objects according to the name of the entity . !!!

 

Here is my start .

 

(defun c:TEst (/ ss en)
 (if (and (setq ss (car (entsel "\n Select an Object :")))[color=blue]; Suppose a CIRCLE [/color]
          (setq en (cons 0 (cdr (assoc 0 (entget ss)))))  [color=blue]; return (0 . "CIRCLE")[/color]
      )
   (sssetfirst nil [color=red](ssget ....... en <== What's the right code(s) in here ?[/color] 
   (princ " Nothing's Selected ")
   )
 (princ)
 )
   

Thanks.

Link to comment
Share on other sites

Hi

 

if you want to select the entities by name you can try this

 

 
(setq sel (ssget "x" (list(cons 0 "CIRCLE"))))

 

This code will selects the all circles in the drawing.

Link to comment
Share on other sites

you can also do this

 

 
(setq sel (ssget (list(cons 0 "CIRCLE"))))

 

This code will allow you to make a selection on model space and filters circles only from the selection.

Link to comment
Share on other sites

I would advise that you name your variables more descriptively, 'ss' usually refers to a SelectionSet, but you point it to a single entity.

 

Using your code structure:

 

(if
 (and
   (setq entity (car (entsel)))
   (eq "CIRCLE" (cdr (assoc 0 (entget entity))))
 )
 (sssetfirst nil (ssadd entity))
 (princ "\nNothing Selected.")
)

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