Layout Ruby and use of a template

I want to program something in the layout ruby (i don’t know how to use C)
I want to make from my sketchup model a layout-file with the use of a template layout-file. (And then also do a few other steps.)

I probably have found a way, but it seems a bit a long side road:

  1. Open the layout-template: doc =
    (now the layout model is yet not connected with the sketchup-model you want)
  2. Iterate over all Layout::SketchUpModel entities with each and do:
    2.1 Get all the information (bounds, scenes, …) of the current Layout::SketchUpModel and put it in tmp parameters
    2.2 Remove the current entity(Layout::SketchUpModel) doc.remove_entity()
    (still have to try if this works when iterating over them)
    2.3 Make a new entity with layout_view =, bounds)
    2.4 Put that entity in the layout file doc.add_entity(layout_view, layer, page)
  3. If you actually want to see the layout file, then you still have to save it:

You can probably also do first 2.3 and 2.4 when the ‘old’ layout view is still in the doc and do remove 2.2 after that.

When you manually do that, you just have to send it to layout and select a template and your done. So, it seems like a bit a complicated solution to do something simple. Also i have doubts if i will be able to get the views in layout exactly the same as they where.
Does anyone knows a better way?

Also, is there a web page like ‘coming soon in SU-2020’ ?
Will Sketchup make more possibilities with that Layout Ruby API?

So, before i program all this, i would like to know if there is an easier way (or coming soon)?

Yes I opened an issue on this in the public issue tracker last August.
I’ve just added that there is no #path= setter method and inserted a link to this topic thread …

Your workaround code will be something like …

def send_to_layout(model_path,template_path)
  doc =
  this_page = doc.pages.first
  entities  = this_page.nonshared_entities
  old_model = entities.grep(Layout::SketchUpModel).first
  vp_bounds = old_model.bounds
  new_model =, vp_bounds)
  layer = old_model.layer_instance
  doc.add_entity( new_model, layer, this_page )
  model.render if model.render_needed?

Trimble employees are not allowed to make “forward looking statements” (as Trimble is a publicly traded company and/or it’s just policy because the software market is very competitive.)
So no there is no such website and you’ll know when the next version is released and the API release notes are published.

You set up scenes in the SketchUp model for use as viewports in the LayOut document. This means you’ll usually also create some scenes that are only used for modeling (so you don’t mess up your LO viewports when modeling and moving the camera around.)
Just keep in mind that the index order for the current_scene= method is 1 more than the scene index in SketchUp (because 0 is used for the “Last Saved SketchUp View” in LO. Avoid using this and setup scenes inside SketchUp.)

It is also common to setup scenes and styles just for printing and making presentation images in the model.

Thank you very much for your answers!

1 Like

Use the GitHub issue tracker to log missing functionality:

We tend to prioritize such type of functionality parity issues.