Is it possible to create an empty scene programmatically?

I am going to download models and import them to Sketchup. Is it possible to get an empty scene for that with Ruby API?

There is no “empty” scene.
Very-very simplified: The scenes just a kind of other views of the current model with some additional useful properties.

For historical reason the Scene called as Page in Ruby.

Pages#add-instance_method is used to add a new Page object to the collection.

See also:


Thank you Dezmo. I tried Pages#add. Yes, it was creating a new scene. Actually I want to open an empty .skp file to draw models on it. Detailed steps:

  1. Close the current model. If there are modifications not yet saved, pop up a dialog to notify the user to save before.

  2. Open an empty model.

This will be done by SketchUp automatically.

FYI, you can test whether the model has been modified …

You can also create a new component definition, draw to it’s entities collection and save the definition out as an SKP file (so it can be imported into other models.)

Perfect! That’s exactly what I want.