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)
......
)
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
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 "")
)
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 ?
@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