some of my material names have space in it for ex. “Blue Carpet” and rs.command would stop at the space after blue instead of putting in “Blue Carpet” as a single material name.
I couldn’t select geometries without name with this method
What do you think about these issues?
Thanks again!
Hi @yang, in this line i am just using pythons build in filter function, it is just a short for iterating over all objs and finding out which of these objects have a RenderMaterial assigned and if the RenderMaterial.Name equals the name we’re searching for. It then puts the found objects into a new list called rc
If you script the SelMaterialName command, you must enclose the name of the material into quotes so the command line does not interpret the space as an Enter. You can do this for example like this:
If you use the above example which scripts the _-SelMaterialName command, you can select all objects without material by calling it with an empty string:
MySelMaterialName("")
It also allows to to use wildcards for selection by material name, which means you could do:
MySelMaterialName("Blue*")
this would select objects with materials where the material name starts with “Blue”, eg. “Blue Carpet” or “Blue chair” etc.
btw. note that i call the command like this: “_-SelMaterialName”. The underscore _ makes the command usable on different languages and interprets it in english language. The minus - suppresses the dialog from popping up and routes the command options to the command prompt.