Layer naming using Rhino3dm

We are using the .NET Rhino3dm library to export files from our software. What we have noticed is that it appears layer names have to be unique using Rhino3dm or it will start adding “01”, “02”, etc. on the end of the layers.

In Rhino it is no issue to have layers or sublayers with the same name.

In Rhino we can do:

image

Trying the same using Rhino3dm it automatically renames the layers to:

It wouldn’t be so bad, if it at least then renamed the first instance to “Result 01” and not the 2nd instance. I know in programming we always start at 0, but these layer names are intended for humans, so in my opinion you should rename the first instance to “Result 01”, the second to “Result 02”, etc. Or rename the first instance to “Result 00” at least, so it follows the same pattern.

But the real question is why Rhino3dm here is different to Rhino and how we can prevent the automatic layer renaming.

Any ideas?

1 Like

Hi @seltzdesign,

I’ve logged the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-75120

The difference is what table you’re adding layer to.

– Dale

2 Likes

Hi @seltzdesign,

Can you share some Rhino3dm-based layer code that isn’t working for you?

Thanks,

– Dale

Hi @dale

Thanks for creating the issue. Yes, we are using AddLayer I believe, because CreateLayer was not working. It would not add a layer.

Now using AddLayer we noticed that it automatically renames layers by adding numbers. We also noticed that if a layer has say “_01” at the end of a layer and the layer exists twice, it actually replaces the “_01” with " 01". So the auto-renaming seems a bit aggressive and actually removes part of the original layer names.

I mean we kind of worked around it now and made all layer names unique, which has the advantage of better searchability.

It’s a bit hard to share code, since we are using Rhino3dm in vvvv Gamma, which is a visual coding language.

RH-75120 is fixed in Rhino 7 Service Release 30

That’s great news! Again, do you have any idea when the Nuget will be updated?

@will - Is this something you know about?

It was published with the release of 7.30! Sometimes it takes a moment for new packages to be indexed, but it’s definitely there now.

Whoops, I was referring to the RhinoCommon nuget package. @fraguada is the best person to ask about the Rhino3dm library!