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:
- Open the layout-template: doc = Layout::Document.new(path_template)
(now the layout model is yet not connected with the sketchup-model you want)
- 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 = Layout::SketchUpModel.new(path_SU_model, bounds)
2.4 Put that entity in the layout file doc.add_entity(layout_view, layer, page)
- If you actually want to see the layout file, then you still have to save it: doc.save(filename)
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)?