Bug? rs.IsLayer("name") returns True even if deleted

Hi all, I have some files where rs.IsLayer(“layerName”) returns True even if a layer is deleted. It does not do so in a new file.

(I check to see if a layer exists, if not create it, then move objects to it. But this last step now fails as Rhino thinks the layer exists, doesn’t create it, and can now not move the objects to that layer)

So I had to rewrite the tools to use this instead:
if rs.LayerId(“layerName”) == None:

Are there any changes maded to rs.IsLayer() lately?
I have not had this problem before the lastest two or three SR’s or something.

There definitely seems to be some kind of bug with rs.IsLayer(). I could not recreate your problem, but for me it returns “True” if there is any sublayer with the input string.

if not rs.IsLayer("TMP"): rs.AddLayer("TMP")

won’t work if there is a layer called “Standard::TMP” for example. So I basically can’t create any layers on the first level if there is a sublayer with the same name somewhere in my layer structure.

I’ve never had this behaviour occurr to me or any of my colleagues till today and I would have to adjust quite a few tools for a workaround. Had this in both Rhino 6 and 7.

1 Like

Hi @Holo,

Any chance you can show us a sample, that we can run here, that repeats this?

– Dale