Hello!
I’m trying to create a plugin where users can define the dimensions and the material of a new component.
I used the following Ruby code to get the material list:
model = Sketchup.active_model
materials = model.materials
count = materials.count
puts "Value of count is #{count}"
szoveg = "<option selected>"+materials[0].display_name+"</option>"
for i in 1..count-1
puts materials[i].display_name
szoveg = szoveg+"<option>"+materials[i].display_name+"</option>"
thumbnail_file = File.dirname(__FILE__) +"/materials/#{materials[i].display_name}.png"
materials[i].write_thumbnail(thumbnail_file, 280)
end
It creates the png files, but the problem is that they are not the same as those in the software.
E.g. I can see these materials in SketchUp:
But in the list what I get using the previous code, I have only the 7 colors that are in the “In Model” list:
How should I modify the code to get all possible materials?
Thank you!