> For the complete documentation index, see [llms.txt](https://docs.ladybug.tools/ladybug-primer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ladybug.tools/ladybug-primer/components/4_extra/sort_by_layers.md).

# Sort by Layers

![](https://894783789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPHXQ1I3gb93zpLrLZf%2Fuploads%2Fgit-blob-81c699d862059849708544a4c4f2ca1ee724a442%2FSort_by_Layers.png?alt=media)

![](https://894783789-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LPHXQ1I3gb93zpLrLZf%2Fuploads%2Fgit-blob-58bf6c88cc4cea2bbdc9e5a90f2db3b0365f91ca%2FSort_by_Layers.png?alt=media) - [\[source code\]](https://github.com/ladybug-tools/ladybug-grasshopper/blob/master/ladybug_grasshopper/src//LB%20Sort%20by%20Layers.py)

Sort and group Rhino objects by layers. Please find the source code from: <https://github.com/ladybug-tools/ladybug-grasshopper-dotnet>

### Inputs

* **K**

A list of Rhino objects that associated with sortable layers

* **A**

Optional object list to sort synchronously

### Outputs

* **K**

Sorted objects by layers

* **A**

Synchronously sorted objects

* **n**

Grouped layer names
