[Plugin] MaterialConsolidator

percentage level

Postby bagatelo » Mon Sep 26, 2011 4:15 am

I set keyboard shortcuts for all the plugins I use.

Since this script takes a long time to complete their tasks in some files, I get confused sometimes I use the shortcuts, and inadvertently I press the shortcut for this plugin. You could insert an option to be given a warning to accept or not if we want to do cleaning?

Another interesting option is the possibility of inserting a percentage level where materials are not identical, but similar would be united into one.

It's possible to rename all the materials in words capitalized?
If we could make a clean sweep in the names would also help.
Why? Try it:
http://www.den4b.com/?x=products&product=renamer
0
While the cat's away, the mice will play
User avatar
bagatelo 
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby TIG » Mon Sep 26, 2011 9:31 am

First things last... ;)

You cannot 'rename' materials via the Ruby API unless you have Sketchup >= v8M1 [OR my SKMtools installed] because material.name=string doesn't exist as a method otherwise. If the method is available then this one-liner will rename ALL materials in the model using CAPITAL letters - otherwise you'll get an error message!
Code: Select all
Sketchup.active_model.materials.each{|m|m.name=m.name.upcase}

The accuracy idea would apply to what exactly ? I expect Red, Green, Blue, Alpha :?:
At the moment the code has several tests of equivalence like
next if mat.color.red != m0.color.red
You can edit the code [using a plain text editor like Notepad/Notepad++ etc] to apply an accuracy thus, where you'll define the accuracy as say per=0.01 [i.e. we'll accept it as a match if it's within 1%]. You can either hardcode the 'per' or you could get this from an added dialog as the tool runs... [see below]
So now tweak the test[s]
Code: Select all
next if mat.color.red > m0.color.red*(1+per) or mat.color.red < m0.color.red*(1-per)
Repeat this for RGB and A...

To get the accuracy from a dialog add this at the start of the code on a new line immediately after 'initialize()'
Code: Select all
results=inputbox(["0.NNN: "],[0.01],"Material Consolidator Accuracy")
return nil unless results
per=results[0]
you then enter the required accuracy in the format 0.01 =1%, 0.1 =10%, 0.5 =50% etc.
Obviously if you use the dialog to set the accuracy you do not need a line that says per=... elsewhere in the code!
If you cancel the dialog the material-consolidation is aborted.

This accuracy dialog could act as your startup prompt... BUT if you don't implement it then add this line at the start of the code instead
Code: Select all
return nil if UI.messagebox("Consolidate All Materials ?",MB_YESNO,"")==7


:ugeek:
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby irwanwr » Thu Dec 01, 2011 6:51 am

thank you for the plugin :)
0
User avatar
irwanwr 
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby Gabbiano » Sat Apr 07, 2012 3:42 pm

Really a great plugin! :berserk:
Thank you TIG!
0

Gabbiano 
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby hegemonicoMX » Thu Dec 05, 2013 8:30 pm

Came down in the best moment. I had a horrible mess in the materials of a collaborative model. ;) its a blessing
0

hegemonicoMX 
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby Ecuadorian » Sat Jan 11, 2014 10:17 pm

Hey, TIG. How about adding some "fuzzy" logic to this? I mean, sometimes you have very similar materials that have only slightly different properties. For example, half a dozen of glasses with only slightly different tints, or slightly different alpha values, and it would be useful to consolidate them.
0

Ecuadorian 
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby JClements » Sat Feb 14, 2015 9:14 pm

A mighty handy plugin. Thanks!
0
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] MaterialConsolidator v1.3 20110116

Postby bsfranza » Fri Jul 19, 2019 12:23 pm

is there somebody out there who can compile the above mentioned "accuracy" code addon into the plugin and share it with us :)?

would be awesome!!

thanks
0

bsfranza 
 

Re: [Plugin] MaterialConsolidator

Postby TIG » Mon Jul 22, 2019 1:56 pm

Here's v2.0 which includes optional 'tolerances' for RGBA values.
So you can now consolidate colors which are almost a match !
Use it with thought...
But it is one-step undo-able !

Download


Please read the updated usage notes in the first post: http://sketchucation.com/forums/viewtop ... 90#p295290
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] MaterialConsolidator

Postby db11 » Mon Jul 22, 2019 2:32 pm

Thanks TIG. This will be a very useful addition to an often-used plugin.
1

db11 
 

Re: [Plugin] MaterialConsolidator

Postby pbacot » Mon Jul 22, 2019 4:31 pm

Thank you!
0
MacOSX Mojave ShetchUp Pro v19 Twilight Pro v2 M2 Kerkythea PowerCADD
User avatar
pbacot 
Top SketchUcator
 

Re: [Plugin] MaterialConsolidator

Postby TIG » Mon Jul 22, 2019 4:54 pm

Sorry, for any inconvenience !
Here's v3.0

Download


It tweaks any options checking - to avoid unexpected results !
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] MaterialConsolidator

Postby bsfranza » Tue Jul 23, 2019 9:09 am

WOW super many muchas gracias :)
heavily appreciated!

edit:
of course one is never satisfied for long ...

plugin works as expected now, but its kind of slow on scenes with many many polygons and the report does not state the progress or if the plugin is still working or if the app is frozen and also there are some crucial options missing...

for example: work in only on entities in active context or vice versa, ignore entities and materials of active objects

dont know if anyone is aware of the age old plugin material maintance - this one is quite fast with what it does ..

maybe someone in the future can combine them and make a proper plugin, i personally would be happy to pay for something like that :)
0

bsfranza 
 

Re: [Plugin] MaterialConsolidator

Postby 1010 Gunner » Fri Nov 15, 2019 8:44 pm

Need help with installation or use of this plugin.
'materialconsolidator' shows in my extension manager although there is no version, author etc information.
It is not showing in the 'extensions' tab

What do I need to do to get it to work?
0

1010 Gunner 
 

Re: [Plugin] MaterialConsolidator

Postby Dave R » Sat Nov 16, 2019 12:20 am

1010 Gunner wrote:What do I need to do to get it to work?


First thing I'd do is look in the Tools Menu where the instructions say it will be located. See the first post.

Screenshot - 11_15_2019 , 5_17_48 PM.png


If it's not there, then we need to look at how you went about installing it.

What version of SketchUp are you using? Your profile indicates version 7 but it had no Extension Manager.
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] MaterialConsolidator

Postby 1010 Gunner » Sat Nov 16, 2019 12:22 am

That's it, thank you.
0

1010 Gunner 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Previous


 

Return to Plugins

Who is online

Users browsing this forum: ferhataktkn and 8 guests

Visit our sponsors: