How can I get the default material of a sketchup model?


#1

Hi there,
I’m trying to import a simple model in my program. All the faces are attached with the default mateiral. When i used SUFaceGetFrontMateial, it returned null. Then i used SUModelGetMaterials to get all the materials, and i found all the materials’ colors were different from the colors i got from sketchup 2014 pro. So, is there any ways to get the default material and its color?


#2

The colors for the default material is defined by the current style. To obtain that you need to inspect the current rendering options: SURenderingOptionsGetValue.
The docs for the C API doesn’t seem to make it easy to figure out the keys for this. (@paul, correct me if I’m wrong here.)
But via the Ruby API you can query the different keys: Sketchup.active_model.rendering_options.keys We even have a list in the Ruby API docs: http://www.sketchup.com/intl/en/developer/docs/ourdoc/renderingoptions


#3

Thank you! It’s very helpful!