I’d like to export individual components in SketchUp to another file format. However the #export method is only defined on the Model class. The ComponentDefinition#save_as method on the other hand appears to only support the .skp format.
Is it possible to do this at all in the Ruby API, or would I need to use the C API to load an exported SketchUp file and export it to another format?
Start an operation.
Delete everything in the model.
Place an instance of the desired component definition at the ORIGIN.
Perhaps zoom extents.
Depending on the exported file format, you might also want to purge unused materials, layers, definitions - e.g. in DXF/DWG, but it’s perhaps not strictly necessary in some others ?
Now Export the model in the desired file format [using the definition’s name for the exported file].
Only the instance [with its materials and layers] get included in the new file.
Abort the operation.
The model is now unchanged, but the exported file stands.