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

change color of selection set named MySel

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
GeryKnee
590 Views, 4 Replies

change color of selection set named MySel

Helo,

I need a lisp routine that changes the color of all objects in a an existant selection set MySel to NewObjectsColor

Wich is the lisp code for that?

 

(defun fnChangeSelColor (MySel NewObjectsColor)

 

......

 

)

4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: GeryKnee

There are several ways that could be done, perhaps the simplest by way of a CHPROP command:

 

(defun fnChangeSelColor (MySel NewObjectsColor)

  (command "_.chprop" MySel "" "_color" NewObjectsColor "")

)

Kent Cooper, AIA
Message 3 of 5
GeryKnee
in reply to: Kent1Cooper

Hello Kent and Thanks

 

Writing the following

 


(defun fnChangeSelColor (MySel NewObjectsColor)
  (command "_.chprop" MySel "" "_color" NewObjectsColor "")
)

(defun c:ddd ()
  (fnChangeSelColor "PICKFIRST" 1)
)

 

I'm waiting all the users selection before calling command ddd to be set to Red.

Witch is the fault using that ?

 

 

Message 4 of 5
Kent1Cooper
in reply to: GeryKnee


@GeryKnee wrote:

....
(defun fnChangeSelColor (MySel NewObjectsColor)
  (command "_.chprop" MySel "" "_color" NewObjectsColor "")
)

(defun c:ddd ()
  (fnChangeSelColor "PICKFIRST" 1)
)

 

I'm waiting all the users selection before calling command ddd to be set to Red.

Witch is the fault using that ? 


PICKFIRST is a System Variable name, but won't do as a selection set in an AutoLISP function.  Try it this way, passing the implied selection set [if there is one]:

 

(defun c:ddd ()
  (fnChangeSelColor (ssget "_I") 1)
); defun

 

Read all about it in Help for the (ssget) function.

 

Depending on how you set up the User selection part, you might want to have it check whether there's a pre-selection:

 

(defun c:ddd ()

  (if (ssget "I")
    (fnChangeSelColor (ssget "I") 1)

  ); if
); defun

Kent Cooper, AIA
Message 5 of 5
GeryKnee
in reply to: Kent1Cooper

Thanks Kent

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

Post to forums  

Autodesk Design & Make Report

”Boost