Michaels Posted September 25, 2010 Posted September 25, 2010 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. Quote
giskumar Posted September 25, 2010 Posted September 25, 2010 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. Quote
giskumar Posted September 25, 2010 Posted September 25, 2010 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. Quote
Lee Mac Posted September 25, 2010 Posted September 25, 2010 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.") ) Quote
Recommended Posts
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.