How to save a component definition
-
How to create and save a component in an active SketchUp model.
I would like to create a component with a Ruby file, (which I am able to do), and then save just the component definition to disk (which I don't know how to do).
I'm sure I have asked this before, but I can't find a record of it on the SUC Forum.
Any ideas? (And I don't want the user to have to save it by hand)
-
There are a couple methods to leverage here.
Sketchup.active_model.save() will save a model to disk.
Now, if you are on a Mac, Skechup.file_new() with create another instance of Sketchup. You'll get a second window, then you can switch around your high level qualifier to switch between views, build your component there, save it, whatever.
Is this the type of info you were looking for?
-
No Todd,
I want to create a SketchUp Component (say a furniture item), while the user is working on a larger layout, and then save the new component if a library so the next time the user needs it I don't have to create it again.
We did find the SDK code which lets you write a .SKP file directly, and then load it as a component, so we will try that route.
-
On a similar note, I thought there was a way to create an SKP file, using the SDK from
outside of SketchUp. I even thought we had tried it once.But today I can't find it.
Does anyone know if it is possible to create an SKP file in a stand
alone program using the SDK.(We regularly do this by creating a .rb file and then reading it, but
we would like to create a .SKP file directly.) -
Or put another way - you want a method something like:
ComponentDefinition.export
or
ComponentDefinition.save_as
...
-
Yes.
@tig said:
Or put another way - you want a method something like:
ComponentDefinition.export
or
ComponentDefinition.save_as
...
Advertisement