Grasshopper - Query Pages ordering

Using the Query Pages component from the Rhino toolbar to create tables of contents for drawings. It seems to order the results in the order they were created, not the order in which they’re displayed. Is there any way to change that?

For instance, if (by duplicating 0.01) I create layouts 0.01, 0.02, and 0.03; move on to 1.01, then realize that I need a 0.04 and add that between 0.01 and 1.01 - the Query Page tool returns a list with 0.01, 0.02, 0.03, 1.01, 0.04.

Desired behaviour would be 0.01, 0.02, 0.03, 0.04, 1.01,…(the order in which the layout tabs are arranged)

I can get around this with sorting, etc, I was just wondering if there was already something in place that I’m missing.

You should be able to use the Order Contents component. Just pass the output of the Query Pages component into the Order Content components. And then right-click on the Key input and select Model Page from the drop down list and then click on “Name” as the key. The output should now be sorted according to the page name.

1 Like

That will work, I suppose. There’s no way to sort based on the order of the layout tabs as shown in Rhino or the Layout tab?

Not really. All of the query components read data from the model manifest which stores things in the order of creation. We could add a toggle or something to the query pages component to sort them before outputting them… but it would essentially be doing the exact same thing as the order contents component.

1 Like