Materials collection

I have made some skm files and saved them in catalogue. How can I add those (defined materials in skm files) to model.materials and use them in model?

You will need to introduce them all into a model then either save the entire In Model collection as a library, or drag individual materials to the relevant library opened in a second pane. This video explains a little more about creating new materials and libraries.
If you already have the skms you could just copy them into the relevant material library folder.

Alan, thanks for answer. But I have to add defined materials using ruby. I’m looking for some method…

Doh! Sorry about that. I missed the API tag and thought it was a newbie question. :blush:

The Ruby API currently (SU2016) doesn’t have any support for SKM files. One workaround is to open the SKM files yourself (they are zip files) and parse the content and recreate them yourself.
I wrote this ages ago - it really needs an update.
However, it does offer many of the sorely missing Image, Material and SKM methods - like SKM import/export…

Please note it needs to execute some .JAR files to process images and zip files, which need to be assigned to execute in Java - NOT some 3rd party decompression software, which might hijack that file type…

Many of these functions could now be done in the newer Ruby available in SketchUp > v2015…

Since this is an API query, perhaps you can write these improvements…:wink:

Loading and exporting SKM material archive files was added to the Ruby API with release 2017.

Currently 2019.2 there are not yet equivalents for the C API.