How to know/ figure out what functions I need (Search & replace names)

Hi Peter,
I am not currently at home, so could not check it instantly. Will get back in a couple of days.
Could you post the names of your layers?
If it makes difficult for you to manually type all layer names then run this script, and copy the result:

import rhinoscriptsyntax as rs
lyrnames = rs.LayerNames()
print lyrnames

I’ve send you a PM with the layers, no rush, as long as I can’t figure out what to do exactly i’m working on it manually, and in the sparse time I have myself trying to get time to learn Python

Be wary, some have a prefix like AAA or, ------, just to remind me of their status : )

Hi Peter,

I copied a few layers from your layer list, and will take those to check whether I understood you.
Here is a list of a couple of layers:

		1;TD-10 5.5 2.0;Washer;\xd810x\xd85.5x2.0;Stainless steel;1;[BLOCK]
		1;TD-52 33.5 1.0;Washer;\xd852x\xd833.5x1.0;Stainless steel;1;[BLOCK]
		1;TE-62.5 44 4.0;Washer;\xd862.5x\xd844x4.0;TBA;1;[BLOCK]
		1;TLF-0512;Screw;M5x0.8-L12;Stainless steel;1;[BLOCK]```

What you want, is to get rid of that "[BLOCK]" at the end of each sub-sub layer? If that is so, then the "[" and "]" are causing all the confusion, as they are [metacharacters][1]. You need to backslash them:
Try this:





Please report back the result.

Oh, and sorry for the delay once again, I have just gotten back home (this evening).

Perfect!! That was the problem! :slight_smile: Very glad that I now know why this script suddenly stopped working : )

Thanks very much for your time once again!

[edit] no need to rush btw, just posting updates here on the status.

Mm so now targeting the *[BLOCK] with the *\[BLOCK] has worked, but while trying to search for another therm gave me the follwing:
While the search string was *Handle bar* the error comes up at a layer called “Wall plug”

Exception Occured
Message: 1;T-5.9 9.75 39.35;Wall plug;Ø9.75-L39.35;PE;1;2D does not exist in LayerTable


  line 16, in __getlayer, "C:\Users\peter\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\"

  line 436, in RenameLayer, "C:\Users\peter\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\"

  line 114, in renameLayers, "<string>"

  line 136, in <module>, "<string>"


Solution (sort of)

Above error was caused by some new layers a colleague made that were obsolete, I’ve just deleted the layers and the script worked again. No Idea why the other layers gave problems, but it works again.