SKM Files and the API

Currently with the Wall Plugin (that is in active development) I have a few hard coded materials that the user/designer can select from. Once the user chooses one of these materials I then create the material on the fly either by assigning a color or a texture:

@Lumberptmat_db = "#ffe5cc"
@Lumberpt_mat = mats.add(mat_name)
@Lumberpt_mat.color = @Lumberptmat_db

or something like this:

@Lsl_mat = mats.add(mat_name)
@Lsl_mat.texture = File.join(this_dir,'materials/WOOD_OSB.jpg')
@Lsl_mat.texture.size = [36.0, 4.0]

However, I would like to make it possible so that the user can create their own library of files (using .SKM files) and then just have the plugin load the applicable .SKM file into the model.

Somewhere I was reading that SKM files were creating issues for certain previous SU releases but this may be outdated information.

I’m just wondering if there are any known problems or issues with using SKM files and the API before I get too far down this road, that I should be aware of.

Yes it is true. Reading and writing SKM files is relatively new. It was implemented in v2017.

And the best place to look for “issues” is the official public issue tracker at GitHub.
(You should be compiling your own nifty set of programming bookmarks by now.)

We just recently discussed finding the user resource folder paths in the forum.
I’ll give you a hint,… they are module methods of the Sketchup module.

1 Like

I was not aware of the issue tracker on GitHub, thank-you for that, added to my DEV bookmark folder.

I will test out the SKM library concept and probably post a few bits of my code, this should be interesting.

This is the topic I was thinking of, although it is about template files, it’s examples are relevant.

1 Like