SKM files and the API

SKM files and the API

Postby medeek » Tue Jul 03, 2018 7:28 pm

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:

Code: Select all
 @Lumberptmat_db = "#ffe5cc"
    @Lumberpt_mat = mats.add(mat_name)
    @Lumberpt_mat.color = @Lumberptmat_db

or something like this:

Code: Select all
 @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.
1
Nathaniel P. Wilkerson PE
Medeek Engineering Inc
design.medeek.com
User avatar
medeek 
PluginStore Author
PluginStore Author
 

Re: SKM files and the API

Postby TIG » Tue Jul 03, 2018 9:04 pm

See http://ruby.sketchup.com/Sketchup/Mater ... nce_method
This method lets you load a SKM material directly into your model's materials - but it's only useful for versions >= v2017
If your toolset needs earlier version support... then, if the named material doesn't exist you will need to make a new material, and then add a texture to it, with scaling etc...
1
TIG
User avatar
TIG 
Global Moderator
 

Re: SKM files and the API

Postby medeek » Tue Jul 03, 2018 9:19 pm

After a little further investigating I realized that it only works for 2017 and later. So basically this feature is fairly new.

I actually would like to make the switch to an SKM based system but with this feature being so new its stability concerns me. If it is running solid though I will probably switch.
0
Nathaniel P. Wilkerson PE
Medeek Engineering Inc
design.medeek.com
User avatar
medeek 
PluginStore Author
PluginStore Author
 

Re: SKM files and the API

Postby TIG » Wed Jul 04, 2018 12:18 pm

It works fine in >= v2017...
Try it...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: SKM files and the API

Postby medeek » Wed Jul 04, 2018 7:10 pm

Most users of the plugin are SU 2018 but I've received some kickback from others so I may have to put this plan on hold and go a different direction.
0
Nathaniel P. Wilkerson PE
Medeek Engineering Inc
design.medeek.com
User avatar
medeek 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 8 guests

Visit our sponsors: