For 1)
I could provide nothing else, aside from the console observations:
_$ (setq oCol1 (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar 'acadver) 1 2))))
#<VLA-OBJECT IAcadAcCmColor 000000013204b9d0>
_$ (setq oCol2 (vla-get-TrueColor (vlax-ename->vla-object (car (entsel)))))
#<VLA-OBJECT IAcadAcCmColor 000000013204aef0>
_$ (equal oCol1 oCol2) ; Looks like both color objects are different
nil
_$ (vla-put-ColorMethod oCol2 acColorMethodByACI)
nil
_$ (vla-put-ColorIndex oCol2 4) ; After this the Color of the originally picked object was NOT CHANGED
nil
_$ (vla-put-TrueColor (vlax-ename->vla-object (car (entsel))) oCol2) ; After this the color of the selected object(here) is changed to 4 (cyan)
nil
_$ (vla-put-TrueColor (vlax-ename->vla-object (car (entsel))) oCol1) ; After this the color of the selected object(here) is changed to the color property of the other color object.
nil
But my thinking is: obtain just once the color object and avoid any additional checks within the iteration.
If you intend just to assign index colors, then just use Ron's suggestion with
vla-put-color, since I was just making sure for the RGB ones.
For 2)
If you intend to assign the same color for all objects in the selection, (Foo_al4) should be more effective.
(Foo_al2) should be used [within a conditional] if you want to assign color for certain objects from the selection.
For 3)
Only Index colors? = Ron's suggestion.
Now.. something curious, which one is faster?:
(setq oCol (vla-GetInterfaceObject (vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar 'acadver) 1 2))))
(vla-put-ColorMethod oCol acColorMethodByACI) (vla-put-ColorIndex oCol 4)
(foreach o (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))))
(vla-put-TrueColor o oCol)
)
or:
(foreach o (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))))
(vla-put-Color o 4)
)