Sorry I replay by here, it says I can't send private messages.
First thank you very much, I think what you send it is exactly what I am looking for but I can't make it work.
How shall I do? I selected the layer and the material in the model and hit the pluggin but nothing come out. I don't know what should be the order or the way to make it work, please if you can tell me...
Thank you very much!
Latest posts made by atcad108
-
RE: Apply Material to ALL Entities on a Layer.
-
RE: Apply Material to ALL Entities on a Layer.
Ooohh sorry, I was thinking it goes the other way around. And yes the material and the layer already exist and are exanctly as 'LAYER2' and 'MATERIAL2'.
But what I was trying to do is to apply a material to a layer, the material2 is in the model but not in this layer.
In this case I have a model that it is organitzed by layers and the layers are in different components and groups and subgroups, and I would like to apply a material to a layer and it applies to all the model. Hopefully I explain it well...
I thought this code was for that, sorry. Do you know if it is something like this already? It maybe but I couldn't find it.
Anyway thanks you very much! -
RE: Apply Material to ALL Entities on a Layer.
Hello,
First thanks to all since thanks of your kindness we have all this very usefull pluggins available.
Then for this code I found it very usefull but it doesn't work for me. I am using sketchup 2013 Pro and I paste the code to the ruby console and much the layer and material names but nothing happens. I do like this:ln='LAYER2';mn='MATERIAL2';m=Sketchup.active_model;ma=nil;m.materials.each{|e|ma=e if e.display_name==mn};la=m.layers[ln];m.start_operation('@');m.definitions.each{|d|next if d.image?;d.entities.grep(Sketchup;;Face).each{|e|if e.material==ma;d.instances.each{|i|i.layer=la};break;end}};m.commit_operation;
Please if someone can point out what I am doing wrong I really would appreciate very much.
Thanks,