Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Object selection with color

4 REPLIES 4
Reply
Message 1 of 5
Philip-John
1761 Views, 4 Replies

Object selection with color

I found a lisp by Lee Mac (see below link) to select objects by color and it's fine.

 

object select by color

 

Can anybody modify the same lisp to select objects within a selection only, and not the entire drawing?

4 REPLIES 4
Message 2 of 5
dlanorh
in reply to: Philip-John

Find this section in the lisp and insert the blue text. This will comment out the red text allowing it to be "re-instated" should that be required later. If you want to make it permanent just remove "_X"

 

           (sssetfirst nil
               (ssget ;(ssget "_X"
                   (if l
                       (list

I am not one of the robots you're looking for

Message 3 of 5
Philip-John
in reply to: dlanorh

Thanks a lot dlanorh,

Your solution is working. But it is not working if there no selection. Can you make it select objects in entire drawing if there is no selection.

 

Thanks & regards

Philip John

 

 

Message 4 of 5
dbhunia
in reply to: Philip-John

Try this ......

 

(defun c:SelectByColour ( / c d e l )
(princ "\nSelect objects from which you want to filter your objects....")
(ssget)
   (if (setq e (car (entsel "\nSelect the Colour to Filter...")))
       (progn
           (setq c
               (cond
                   (   (cdr (assoc 62 (entget e)))   )
                   (   (abs (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 (entget e)))))))   )
               )
           )                     
           (while (setq d (tblnext "LAYER" (null d)))
               (if (= c (abs (cdr (assoc 62 d))))
                   (setq l (cons "," (cons (cdr (assoc 2 d)) l)))
               )
           )
           (sssetfirst nil
               (ssget "_p"
                   (if l
                       (list
                           (cons -4 "<OR")
                               (cons 62 c)
                               (cons -4 "<AND")
                                   (cons 62 256)
                                   (cons 8 (apply 'strcat (cdr l)))
                               (cons -4 "AND>")
                           (cons -4 "OR>")
                       )
                       (list (cons 62 c))
                   )
               )
           )
       )
   )
   (princ)
)

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 5 of 5
Philip-John
in reply to: dbhunia

Thank you dbhunia and 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report