Help Me Create a Custom Sketchup Plugin to Auto-Populate My Layout Sheets

I am looking to create a plugin that will allow me to automatically populate my Layout template with all the scenes that I’ve created in my relevant 3D model.
Link to video walkthru of what I’d like to accomplish with my plugin: Layout AutoScene Plugin Request - YouTube

If you can help me write the Ruby code for this function, please respond back to me. It may take me a couple of days to check back, I’m new to this forum, but I’m very committed to making this work for myself as a big timesaver.
Thank you!

Please be aware that there are currently some limitations to the LayOut APIs.
These limitations make it difficult to easily update the viewports for a document created from a template.
(It is actually easier to replace viewports with new viewports of the same size and bounds.)

Hi thank you Dan. Perhaps it has to be a SketchUp only plugin in the Ruby API? Leave no code work to be done in Layout?

Would you prefer to chat over the phone or via zoom?

LayOut does not have a live API, so if it’s Ruby then it must run from within SketchUp’s application process.

I am not sure what the solution is for this. I’ve participated in discussions about the issue, but not yet tried to solve it.

Obviously, one brute force solution would be to recreate the LayOut file 100% with code rather than try to use a template with any existing viewports.
The template can have the title block and the viewport labels but the 2D locations of viewports would need to be known (somehow) to the extension.

LayOut API objects can not yet have attribute dictionaries attached to them, which would otherwise be a good way to “mark” rectangles with the name of a scene to be replaced with a model viewport.

Thinking … perhaps groups with a rectangle and a text object inside naming the scene with a “Viewport:” prefix?
The code could search for these groups and replace them with a viewport using the child rectangles bounds and set the scene per the given text.

Issues arise later if needing to update the viewports and you’ve manually added stuff to the LayOut document such as notes, dimensions, etc.

There is an open issue, where removing a model viewport does not seem to work.

This is a fascinating read Dan.

Was this explanation just a whimsical thought experiment or is it something that has taken on some life for you since you wrote it?

Coding always begins with a “thought experiment”. Writing it down is called pseudocode.

No life as yet because the limitations in the LayOut Ruby API are still present.

ping @adam (hint hint)

1 Like

Continuing the discussion from Help Me Create a Custom Sketchup Plugin to Auto-Populate My Layout Sheets:

Hi Dan, thank you for putting thought into this. I am OK with the idea of having to have a template layout file that uses prefixes to assign certain scene types or categories onto the right sheets in layout. For example, E.Front and E.Rear for elevation views, and P.FrontLeft and P.FrontRight for perspective views.

As for adding new views later, it’d be great to be able to add new sheets to Layout as the sketchup model evolves. Would be great not to delete annotation already added to existing sheets. But if needed, copying and pasting-in-place from the old layout file to the new one with added sheets would still be faster than laying out 6 new IP.Kitchen1, 2, 3… interior perspective views to the sheet as that takes too long to do manually.