Warning message on LayerTable.Find

Hello,

I don’t understand this new message (since last Rhino update?) :slight_smile:

Warning (BC40000): ‘Public Function Find(layerName As String, ignoreDeletedLayers As Boolean) As Integer’ est obsolète : ‘ignoreDeletedLayers is no longer supported for research by name. Use the overload with notFoundReturnValue (-1 was the previous default).’. (line 87)

This method is not obsolete according to the API documentation :
https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_DocObjects_Tables_LayerTable_Find.htm

JL

I imagine the docs are lagging behind the release cycle a bit. @will any ideas?

OK thank you.

So, this is a strange one. The methods are not marked as being obsolete because they’re not obsolete in the Rhino 5 for Mac API, only in Rhino 6 for Windows. However, if you scroll down to “Version Information” you can see in which versions the methods are available. I’ll look into how we can make this clearer (WWW-771).

@will, @DavidRutten,

I know this is an old thread but I’m updating some old code and have noticed what appears to be the same problem. How should we address this?

Here is an example of a line that produces the warning.

Int32 id = doc.Layers.Find(name, true);

The a similar warning is also generated for this.

Brep[] b = Brep.CreatePlanarBreps(curve);

Here is the doc for layers [ here ]

Have I missed something?

The method is obsolete. If you keep using it will stop working at some point in the future. Use a different method instead.

Usually methods are marked obsolete because there’s a better one available. In this case, probably FindName or FindByFullPath.

As for the brep method, use the overload which takes a tolerance argument.

1 Like

To add to David’s comments above, I’ve also removed Rhino 5 for Mac from the Rhino 6 RhinoCommon API docs. LayerTable.Find() is now hidden entirely, as intended by the developer, and Brep.CreatePlanarBreps(Curve) is correctly marked as deprecated. Hopefully this will reduce confusion!

@tree, the compiler warning for Brep.CreatePlanarBreps(Curve) is “Use version that takes tolerance as input”, so I’d suggest using Brep.CreatePlanarBreps(Curve, Double) instead.

1 Like

Thank you - all up to date now - appreciate the help!