Hi all,
I’ve got a fairly large Layout plan now. But I hide sections and pages of the plan to send to various trades. One of my pet peeves is that the autotext for pageCount calculates “all” pages as opposed to “all visible pages”.
This has forced me to develop a workflow whereby I have a big working layout doc and then I save it out as a copy/issue, then purge any unneeded pages out of that document to then export the document to PDF.
I mean it’s great for revision history, but holy moly, does it bloat the old hard drive with each copy.
Does anyone know of a way to get the PageCount AutoText to reflect only the visible pages, either natively or through a plugin?
There’s no native switch for this that I’ve been able to find. The PageCount auto-text counts every page in the document, including ones you’ve taken out of the presentation. But you don’t have to keep saving purged copies just to get the number right.
Two things the LayOut Ruby API exposes make this solvable. Layout::Page#in_presentation? tells you whether a page is included in presentations, which is the same toggle you’re already using to hold pages back from a trade set. And Layout::AutoTextDefinition#custom_text= lets you write a value into a Custom Text auto-text tag.
So instead of the built-in PageCount, put your own tag in the title block and let a script fill it in. Create a Custom Text auto-text called something like SheetCount, place it in the title block, then run this from SketchUp’s Ruby Console:
path = "C:/path/to/your.layout"
doc = Layout::Document.open(path)
count = doc.pages.count { |page| page.in_presentation? }
tag = doc.auto_text_definitions.find { |d| d.name == "SheetCount" }
tag.custom_text = count.to_s
doc.save(path)
Worth knowing before you build a workflow on it: Layout::Document.open works on a saved .layout file from SketchUp’s Ruby Console, and it doesn’t talk to the LayOut session you have open. So the loop is save, run, reopen, and you’d re-run it any time you change which pages are in the set. Not elegant, but it’s a few seconds against a duplicated document every issue.
One limitation to save you the experiment: this won’t fix the page number the same way. A Custom Text definition holds a single value for the whole document, so it can’t count differently on each sheet. That one would mean a separate text entity per page, which is worse than what you’re doing now.