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.lengthwould return the count of all materials and image-materials.Sketchup.active_model.materials.eachwould 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.definitionsand 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.definitionsand 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement