Sort text by Layout

Hello,

I would like to sort text object on a layout (Title Block text like client info, title of page, page number, date…) by their specific layout name.
So for all the page layout in the document (Page 1, Page 2, Page 3…) I have a list of all the text objects by page layout:
Page 1: text A1, text A2, text A3…
Page 2: text B1, text B2, text B3…
Page 3: text C1, text C2, text C3…

I have look at this,Get Objects by Layout and at https://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-ObjectLayout but I don’t know how to get thins working in a Python script
I can use Grasshopper but I don’t know how to use Python scripting.

Python-Layout-Name.gh (7.0 KB) textbylayout.3dm (65.2 KB)

Thanks !

I prefer to use the antiquated but fairly functional FabTools components.

See attached.
If a text has a name in the layout (Client Info, Title, whatever) you can control it by page via a Title= for example.re_Python-Layout-Name.gh (109.5 KB) RE_textbylayout.3dm (59.9 KB)

Thanks Rickson for the quick answer.
But…I have looked trought FatTools and I could not make what I am looking for, maybe I should have put more context.
I want to retreive the information from the texts in the layout to build a file naming to output all the layouts of the file as single pdf files. So for the three pages I would get a file named:
text A1-text A2-text A3.pdf for Page 1
text B1-text B2-text Bpdf for Page 2
text C1-text C2-text C3.pdf for Page 3

I haved test with this script for the pdf print and I think it will work, just need to retreive information from each layout…


And putting the date at the end.

Thanks

Python-Layout-Name-2.gh (9.9 KB)

How do you know what text goes first? Assuming that you have gathered all the text and sorted by view, you would need to know which one goes in what order.

The field I want to use are limited, so I was thinking this way:
text2 is the page number, so I can filter that if it start with a number
text3 is the state, either Wip, or Issued, I would filter in retrieving Wip or Issued
text 1 would be the Title of the page, this would be what is left, not filtered in text2 or text3

Does that make sense ?

Have a look at this.
as @Rickson points, out you’ll need a system for sorting the text.
I haven’t done this but you could for example use Attributes or position to determine this.


Example file also shows how to extract some other interesting information from layout elements.
Can you find where i used a DocumentText variable?

Layout-Name.3dm (74.9 KB) Python-Layout-Name-3.gh (9.2 KB)

1 Like

Wow this is truly amazing and powerfull, just what I need !
Thanks !
I will take time and try to understand the code…
I thought about using user attributes, but this is simplier, since I only have to write in the title block
Documenttext variable is for MyPretend Company, found it !
I will have a go on my project file which has 40+ pages and tell you how it performs.

1 Like

Ok now I get that it needs to be filtered. It is a bit slow.
By layer ?
I can put all the text needed on layer text_
I also undestand that I need to have allways the same munber of text on each page, since it is for a Title Block, it is ok.
Sorting I can do after in Grasshopper.
Thanks again

Solution found here