[Plugin] GlobalMaterialChange v1.4 20110525

[Plugin] GlobalMaterialChange v1.4 20110525

Postby TIG » Sun Oct 05, 2008 8:51 pm

This script globally changes materials in model or a selection.
Global_Material_Change.rb


Get the latest version from the PluginStore

Download

3
Last edited by TIG on Mon Oct 06, 2008 6:52 pm, edited 2 times in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby free agent » Sun Oct 05, 2008 9:37 pm

hi TIG very handy ruby thank you, in testing i noticed it wont change a material that has been applied to a back face to another material, however changing "ALL" materials does.
0
User avatar
free agent 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby TIG » Mon Oct 06, 2008 2:50 pm

Free Agent wrote:hi TIG very handy ruby thank you, in testing i noticed it wont change a material that has been applied to a back face to another material, however changing "ALL" materials does.

There are so many permutations - I missed one. I fixed it... See the original post at the start to get the updated version...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby free agent » Mon Oct 06, 2008 7:19 pm

hey TIG me again i can see myself using this tool ALOT i like that u can change the front and backs and what not of materials from the outside of groups however it seems its too strong on the "global" side as i select one group and all groups change. the selection part of the script only seems to work on open geometry.
0
User avatar
free agent 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby TIG » Mon Oct 06, 2008 8:23 pm

Free Agent wrote:hey TIG me again i can see myself using this tool ALOT i like that u can change the front and backs and what not of materials from the outside of groups however it seems its too strong on the "global" side as i select one group and all groups change. the selection part of the script only seems to work on open geometry.

Are you sure you mean 'Groups'. It will change all selected (similar) Components as it applies to the definition rather than the instance. It should only change selected Groups as they are all 'unique'...


.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby caddict » Thu Apr 09, 2009 2:12 am

very useful plugin, tig, many thanks man!!
0

caddict 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby kevsterman » Tue Apr 14, 2009 2:58 pm

This ruby is exactly what I was after.

Many thanks Tig :thumb:
0
"Avoid keeping more than 3 items on your desk that you can't fit into your mouth."

kevsterman 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby J40 » Mon Sep 28, 2009 5:53 pm

Thanks TIG. Very handy plugin.
0

J40 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby numerobis » Sun Oct 04, 2009 3:24 pm

Very useful tool!!! thank You! 8-)
0

numerobis 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby JClements » Sun Oct 04, 2009 3:49 pm

Excellent!

Something like this has been on my wishlist for quite a while. I have tons of nested groups in my models and I initially color code geometry by their structure or mechanical function as I develop a model. The colors are bright and contrasting to make identification and discussion of the model with colleagues or clients (especially those in remote locations) easier; however, for final rendering the colors are usually changed; that is drudgery.

This script will allow me to use colors in a manor more like styles. If I prefix a functional discription to the color name at the start of making a model, then that will make the script even easier to use.
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby AcesHigh » Thu Dec 10, 2009 2:15 pm

TIG, very nice plugin... I was just needing it.

Some suggestions... I have a LOT of materials. When the list of materials appear (when selecting one with your plugin) the list doesnt fit on the screen... and there is no option to scroll up or down... nor to see the materials.

I wonder if you could make it just like the materials screen... where you can SEE the materials, and also scroll up and down the list.

If thats not possible, would it be possible to be able to use the eyedropper tool while in your plugin? So I can just select the materials (the one replaced and the one that will replace) instead of having to remember the name of each material.

thanks
0

AcesHigh 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby TIG » Thu Dec 10, 2009 3:51 pm

This tools uses the standard input-box. It would need to be rewritten with a web-dialog - which is at the end of a v_e_r_y long list... as is any 'eye-dropper' solution...
Foe any standard input-box, to get at things not shown on screen, type the first letter of the material, e.g. w and the list will jump to the first item starting with w, e.g. 'Wheat', then use the up/down arrows to move to the required material e.g. 'WhiteStuff'... best fix currently available, sorry - but it is 'free'...
:geek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby ledisnomad » Tue Jun 01, 2010 8:39 pm

I know this is an old thread, but I wanted to bring it back... I work on a team and our models get messy. We work on individual pieces, then reload the component in a base model. Even if materials are named the same thing, we get duplicates. After awhile, nobody knows what is what.

The GlobalMaterialChange script works well to a certain point, but with our heavy model, doing a single swap can take 5 minutes. With over 70 materials, that's half a day's work. Anybody have a way to do this in batches? We could just delete all the materials and start again, but that's not a viable, reusable solution.

Any thoughts?
0

ledisnomad 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby bagatelo » Tue Jun 01, 2010 10:27 pm

ledisnomad wrote:I know this is an old thread, but I wanted to bring it back... I work on a team and our models get messy. We work on individual pieces, then reload the component in a base model. Even if materials are named the same thing, we get duplicates. After awhile, nobody knows what is what.

The GlobalMaterialChange script works well to a certain point, but with our heavy model, doing a single swap can take 5 minutes. With over 70 materials, that's half a day's work. Anybody have a way to do this in batches? We could just delete all the materials and start again, but that's not a viable, reusable solution.

Any thoughts?



I think this is very useful:
viewtopic.php?f=323&t=26013
If someone can consider my suggestion in last thread can be very better.
0
While the cat's away, the mice will play
User avatar
bagatelo 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby dlong » Wed Feb 09, 2011 9:56 pm

I can't tell who impresses me more: Google for letting the free Sketchup use these Ruby scripts, or TIG for coming up with EXACTLY what I needed for today. Thank you a million for a script that works exactly as advertised.

I'm on a Mac and running the just-released 8.0.4810 and this script made it a snap to swap out a material. Thanks again.
0

dlong 
 

Re: [Plugin] GlobalMaterialChange v1.3

Postby jster » Wed Apr 06, 2011 5:03 pm

Thanks for the very useful tool!!
0

jster 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby TIG » Fri May 27, 2011 5:12 pm

Here's an update viewtopic.php?p=96863#p96863
If you run it without anything selected it will now change the materials of everything in the model, including inside ALL groups or definitions - even if they are unused [i.e no instances placed]...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby irwanwr » Wed Nov 30, 2011 9:33 pm

i just downloaded this plugin. i hope i know how to use it.
thank you very much for this one. i've been looking for something like this quite a while.
it might help me reduce file size significantly to save. :thumb:
0
User avatar
irwanwr 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby TIG » Thu Dec 01, 2011 12:17 am

Also look for MaterialConsolidator and similar tools... ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby irwanwr » Thu Dec 01, 2011 8:18 pm

TIG wrote:Also look for MaterialConsolidator and similar tools... ;)

yes, of course. certainly. thank you :)
0
User avatar
irwanwr 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby Dimethil » Fri Jun 08, 2012 4:47 pm

I love this plugin, thanks.
(it saved my life ^^)
0

Dimethil 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby DDrock » Sat Aug 17, 2013 11:05 am

Sir let me know how to install it.. do i simply paste it sketchup folder?? dont have exact idea.. thank you
0
User avatar
DDrock 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby TIG » Sun Aug 18, 2013 10:38 am

@ric

Find and read the several tutorials on how to install various kinds of Plugins.
http://sketchucation.com/resources/tuto ... up-plugins
There are other useful guides in that section too...

In synopsis...
A simple .rb [like this one] just needs to be put into the Plugins folder and SketchUp restarted.
Then you use it as instructed...
You will need to set your Plugins folder's security permissions to FULL [Properties>Security>Edit>FULL>Apply/OK] - by default Windows sets restricted permissions [for everyone, including admins] for all such folders with the Program Files folder.

FYI...
ZIPs need the files/subfolders extracting and moving into the folder keeping them in the same relative relationships...
RBZs need installing using >=v8 Preferences>Extensions>Install... button - if you don't have that button update your v8 to the newest release, OR get v2013?
You can rename a RBZ with a final .ZIP and treat it like a ZIP archive - IF you are a masochist !

OR even easier... :enlight:
Nearly all of the Plugins with threads on SketchUcation are available in the SketchUcation PluginStore - open its page through the Resources menu above... Get the RBZ and manually install it...
You can even install the SketchUcation Plugin Store Toolset from there [or from its own dedicated link] - this displays all of the available Plugins in a dialog within SketchUp and AutoInstalls them for you without you ever having to worry about where the Plugins folder is etc... [provided of course that you have set permissions to FULL!]
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby pilou » Thu Mar 19, 2015 1:59 pm

A little Question :)

When you apply a Texture to the "external" faces of a component the instances are not changed!


When you apply a Texture "inside" a component (or an instance) all faces of Components are changed!


How automate the process when you Pick the texture of the "external" face of the component for have the second result ?
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby mprose7 » Thu Sep 29, 2016 1:04 pm

Is there chance to add auto function which would change all 'mat1', 'mat2', 'mat3' to 'mat', since sketchup automaticly add number to 'mat' if i import models with identical named mats but changed color. example: i copy window from other model, it has material named glass, but it is a bit more blue than glass from scene and now i have material glass and glass1 in scene...
2

mprose7 
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby TIG » Mon Jan 16, 2017 2:19 pm

If you run this code snippet in the Ruby Console, then all matching materials are equalized 'by name'.
So in the example patt='glass' - it then resets the RGBA/texture of 'glass1', 'glass2' etc.
Then you can use my MaterialConsolidator plugin to compact all of the model's materials which have exact matching RGBA/texture into just one material...
http://sketchucation.com/pluginstore?pl ... nsolidator
Code: Select all
# !!! Use with care - all materials starting with 'patt' take its color/transparency/texture/size etc.
patt='glass' #change as desired
model=Sketchup.active_model
mats=model.materials
mat=mats[patt]
unless mat; puts "NO material named '#{patt}'"; return nil; end
col=mat.color
r=col.red
g=col.green
b=col.blue
c=Sketchup::Color.new(r,g,b)
a=mat.alpha
t=mat.texture
model.start_operation('mat_equalizer',true)
if t; f=File.join(Sketchup.temp_dir,File.basename(t.filename)); t.write(f); h=t.height;w=t.width ;end
mats.each{|m|p m.name; next unless m.name=~/^#{patt}/; m.color=c;m.alpha=a; if t; m.texture=f; m.texture.size=[w,h]; end }
model.commit_operation
#use material consolidator to get just one material after this...   
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] GlobalMaterialChange v1.4 20110525

Postby mprose7 » Fri Dec 22, 2017 2:20 pm

Is there any option to automate this process - can script automaticaly search materials like glass, glass1, glass2; chrome, chrome1, plastic, plastic1, etc
And then consolidate with consolidate plugin??
0

mprose7 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 26 guests

Visit our sponsors: