File3dmObjectTable.FindByLayer Method - Documentation

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_FileIO_File3dmObjectTable_FindByLayer.htm

As fare as i could evaluate - this function will return an empty array, if there are no objects are found on a layer.

the Documetation should be:

layer
Type: System.String
Full Path of Layer to search.

Return Value
Type:File3dmObject[]
Array of objects that belong to the specified group or (—no null --) empty array if no objects could be found.

or a description of when null / when empty array

I’m pretty sure the function does not use the full layer path, as this is only a feature of the document Layer table.

I do agree with this. Looks like the comments have already been updated for the Rhino WIP…

– Dale

Thanks Dale.
Something is wrong:
Is it possible - that lay.FullPath and lay.Name are the same, when a file is loaded via Rhino.FileIO ?
Seams like “FullPath” is only returning “Name” in the following example.
Or is there something like an additional layer-Nesting-Table i have to read before I get a correct “Fullpath-Info” ?

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
       
        OpenFileDialog openFileDialog1 = new OpenFileDialog();

        openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        openFileDialog1.Filter = "3dm Files (*.3dm)|*.3dm";
        openFileDialog1.FilterIndex = 2;
        openFileDialog1.RestoreDirectory = true;
        if (openFileDialog1.ShowDialog() != DialogResult.OK)
            return Result.Cancel;

        File3dm doc3dm = File3dm.Read(openFileDialog1.FileName, File3dm.TableTypeFilter.Layer, File3dm.ObjectTypeFilter.Any);
        if (null == doc3dm)
            return Result.Failure;


        foreach (Layer lay in doc3dm.Layers)
        {
            RhinoApp.WriteLine("full path is {0}",lay.FullPath);
            RhinoApp.WriteLine("name is {0}", lay.Name);
        }
        doc3dm = null;

        return Result.Success;
    }

Hi Tom,

Here is the magic:

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsLayerPathName.cs

Let me know if you have any questions.

– Dale

Dear Dale - thanks again for your fast reply - i appreciate.