_SelColor Issues

_SelColor is inconsistent with all the other _SelXXX commands. You can chain sel commands to add different things like the left macro that gives me all the open poly/srfs.

But the right macro will not give me all the curves and all the red things. You can see the command complete before the RBG option can be specified. Instead, it defaults to returning anything whose color matches the output of _SelCrv.

And there’s no way around it. This macro won’t work because _SelColor is clearing the previous selection set.

image

SelColor would feel more consistent if it didn’t clear previous and had 4 options:

  • MatchSelection (default -> new option to match anything in the current selection set)
  • MatchObject (-> new option allows you to sel one obj and get all objs of matching color)
  • Color (current option -> now accessible with prev selection)
  • RGB (current option -> now accessible with prev selection)

No, not exactly - it’s allowing a previous selection. If you have one or more objects preselected and you run SelColor, all the other selectable objects of the same color(s) as the preselected objects get selected. (i.e. it already does what your #1 and #2 “Match object/selection” requests are about, if I understood correctly)

Being built that way, you can imagine that running the command with preselected objects will not work the way you want by leaving the previously selected objects selected and then asking you to select more objects by color to add to the selection. That procedure should be scriptable though. For example:

import rhinoscriptsyntax as rs

prev_sel=rs.SelectedObjects()
if prev_sel: rs.UnselectAllObjects()
rs.Command("-_SelColor")
if prev_sel: rs.SelectObjects(prev_sel)

It is accepting a current selection and clearing the previous selection. That is why the macro (_SelNone _SelPrev) won’t work. Previous selection is getting cleared.

#1 changes it from a default behavior -> default option. Running the command with a current selection would no longer immediately return. You would have the ability to change to MatchObject, Color, RGB, or hit enter again for MatchSelection.

I gave up on using SelPrev after V2 because it was completely unreliable. Unless something has radically changed, you never really know what it is going to select, depending on what command has been used previously and how the previous selection set was made.

And, having learned some scripting starting with V4, personally I no longer need it at all, I no longer use macros much because of their limitations - it’s easier and often faster to hack together a quickie script.

That being said, even though I’m not sure the problem is with SelColor as much as with SelPrev, in any case, I have no problem with it being “fixed”. However, if you are proposing that

people will need to hit Enter twice to have the current SelColor behavior for multiple targets, I think that may encounter some opposition as it will affect some people’s workflows and perhaps require that existing scripts/macros be modified.

SelPrev has come along way and is pretty reliable. I use it a lot now and am surprised when it doesn’t work.

But I see your point about scripts.