How to tell when a material is not really a material (Image)
-
When you load a raster file into SketchUp as a SketchUp "Image", SketchUp secretly creates a material for it but does not show it in the list of materials you can place on faces.
The material (e.g. Image1) is in the list of "Sketchup.active_model.materials.each", but SketchUp does not show it in the "Materials in Model" window.
Does anyone know how you can determine if a particular material gotten from "Sketchup.active_model.materials.each" is a real material or not?
-
hm... that's odd. I wonder if something changed in SU7.1...
I was messing with this earlier, before SU7.1
Sketchup.active_model.materials.length
would return the count of all materials and image-materials.Sketchup.active_model.materials.each
would not return image-materials0.upto(Sketchup.active_model.materials-1) { |i| Sketchup.active_model.materials[i] }
would return a full lits of materials and image-materials....but maybe I'm not remembering correctly... Will have a look at SU6 tomorrow.
-
One possible method:
Iterate
Sketchup.definitions
and look for Image definitions. Then investigate the material of the face contained in each Image definition. -
@thomthom said:
Sketchup.active_model.materials.length would return the count of all materials and image-materials.
Sketchup.active_model.materials.each would not return image-materials
That was it. Thanks.
I put "materials.each" in my original post, but we were really using "materials.length: and "materials.at"
@thomthom said:
One possible method:
Iterate
Sketchup.definitions
and look for Image definitions. Then investigate the material of the face contained in each Image definition.using materials.each will give us just what we wanted.
Again, thanks thomthom
-
This is something that the manual should mention. I'll add it to the list.
Advertisement