sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] MaterialConsolidator

    Scheduled Pinned Locked Moved Plugins
    57 Posts 31 Posters 39.4k Views 31 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      Staatsfeind
      last edited by

      hell you react fast ! ;D

      thx for your answer, will give it a try.

      http://www.frenchtouchstudio.com
      manager/modeler

      1 Reply Last reply Reply Quote 0
      • brodieB Offline
        brodie
        last edited by

        Great plugin, thanks TIG. Not one I'll likely use very often but I just had need of it and it worked perfectly.

        -Brodie

        steelblue http://www.steelbluellc.com

        1 Reply Last reply Reply Quote 0
        • D Offline
          DavidXJ98
          last edited by

          Thank you for this plugin... it's quite useful.

          1 Reply Last reply Reply Quote 0
          • M Offline
            MartinK
            last edited by

            Thanks TIG, I've got just the project for this.

            1 Reply Last reply Reply Quote 0
            • bagateloB Offline
              bagatelo
              last edited by

              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

              While the cat's away, the mice will play

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                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!

                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]

                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()'

                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

                return nil if UI.messagebox("Consolidate All Materials ?",MB_YESNO,"")==7
                

                🤓

                TIG

                1 Reply Last reply Reply Quote 0
                • irwanwrI Offline
                  irwanwr
                  last edited by

                  thank you for the plugin 😄

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gabbiano
                    last edited by

                    Really a great plugin!
                    Thank you TIG!

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      hegemonicoMX
                      last edited by

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

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Ecuadorian
                        last edited by

                        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.

                        -Miguel Lescano
                        Subscribe to my house plans YouTube channel! (30K+ subs)

                        1 Reply Last reply Reply Quote 0
                        • JClementsJ Offline
                          JClements
                          last edited by

                          A mighty handy plugin. Thanks!

                          John | Illustrator | Beaverton, Oregon

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            bsfranza
                            last edited by

                            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

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by

                              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 !
                              https://sketchucation.com/pluginstore?pln=materialconsolidator
                              Please read the updated usage notes in the first post: http://sketchucation.com/forums/viewtopic.php?p=295290#p295290

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                db11
                                last edited by

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

                                1 Reply Last reply Reply Quote 0
                                • pbacotP Offline
                                  pbacot
                                  last edited by

                                  Thank you!

                                  MacOSX MojaveSketchUp Pro v19 Twilight v2 Thea v3 PowerCADD

                                  1 Reply Last reply Reply Quote 0
                                  • TIGT Offline
                                    TIG Moderator
                                    last edited by

                                    Sorry, for any inconvenience !
                                    Here's v3.0
                                    https://sketchucation.com/pluginstore?pln=materialconsolidator
                                    It tweaks any options checking - to avoid unexpected results !

                                    TIG

                                    1 Reply Last reply Reply Quote 0
                                    • B Offline
                                      bsfranza
                                      last edited by

                                      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 😄

                                      1 Reply Last reply Reply Quote 0
                                      • 1 Offline
                                        1010 Gunner
                                        last edited by

                                        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?

                                        1 Reply Last reply Reply Quote 0
                                        • Dave RD Offline
                                          Dave R
                                          last edited by

                                          @1010 gunner said:

                                          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.

                                          Etaoin Shrdlu

                                          %

                                          (THERE'S NO PLACE LIKE)

                                          G28 X0.0 Y0.0 Z0.0

                                          M30

                                          %

                                          1 Reply Last reply Reply Quote 0
                                          • 1 Offline
                                            1010 Gunner
                                            last edited by

                                            That's it, thank you.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement