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

    [Plugin] MaterialConsolidator

    已排程 已置頂 已鎖定 已移動 Plugins
    57 貼文 31 Posters 39.4k 瀏覽 31 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • R 離線
      rocorona
      最後由 編輯

      TIG, "thanks" for your reply, and "thanks" for your great and valuable work!

      1 條回覆 最後回覆 回覆 引用 0
      • E 離線
        Ecuadorian
        最後由 編輯

        I was thinking about this yesterday, as using FormFonts objects bloats my files with duplicate materials.

        Thanks, TIG! 👍

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

        1 條回覆 最後回覆 回覆 引用 0
        • TIGT 離線
          TIG Moderator
          最後由 編輯

          Here's v1.3 http://forums.sketchucation.com/viewtopic.php?p=295290#p295290
          It is now wrapped into its own class 'MaterialConsolidator'.

          TIG

          1 條回覆 最後回覆 回覆 引用 0
          • H 離線
            headshot
            最後由 編輯

            GR8 !!!
            TY.

            1 條回覆 最後回覆 回覆 引用 0
            • S 離線
              Staatsfeind
              最後由 編輯

              thank you for this useful tool !

              but one question:

              how do i delete unused materials that result from objects imported by
              the warehouse and which i dont use anymore?

              to be more exactly, i tried out several warehouse objects to fit my needs
              and mixed some of them. at the end i got 50+ textures loaded but maybe only
              15 are in use. deleting all by hand would take some time.

              did i get something wrong ?

              cheers

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

              1 條回覆 最後回覆 回覆 引用 0
              • TIGT 離線
                TIG Moderator
                最後由 編輯

                @staatsfeind said:

                thank you for this useful tool !
                but one question:
                how do i delete unused materials that result from objects imported by
                the warehouse and which i dont use anymore?
                to be more exactly, i tried out several warehouse objects to fit my needs
                and mixed some of them. at the end i got 50+ textures loaded but maybe only
                15 are in use. deleting all by hand would take some time.
                did i get something wrong ?
                cheers
                'Used' Materials are not 'purged'...
                Erase all unwanted Component Instances OR go to the Component Browser and find the unwanted component, right-click its icon and pick 'Delete' - this removes it from the model/browser/data-base.
                OR if there are no Instances left use Component Browser > Purge... pop-out to remove any unused Components
                It's recommended that you also use Layer Browser > Purge... pop-out to remove any unused Layers [that might have been associated with Components that you have just purged]
                NOW use Material Browser > Purge... pop-out to remove any unused Materials [that might have been associated with Components that you have just purged]

                OR simply use Model Info > Statistics > Purge Unused... to purge them all in one go - this also includes a purge of unused Styles.

                OR try my 'Purge' script which is similar but it lets you choose which kinds of thing to purge, and makes a 'report' of what's gone too...

                TIG

                1 條回覆 最後回覆 回覆 引用 0
                • S 離線
                  Staatsfeind
                  最後由 編輯

                  hell you react fast ! ;D

                  thx for your answer, will give it a try.

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

                  1 條回覆 最後回覆 回覆 引用 0
                  • brodieB 離線
                    brodie
                    最後由 編輯

                    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 條回覆 最後回覆 回覆 引用 0
                    • D 離線
                      DavidXJ98
                      最後由 編輯

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

                      1 條回覆 最後回覆 回覆 引用 0
                      • M 離線
                        MartinK
                        最後由 編輯

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

                        1 條回覆 最後回覆 回覆 引用 0
                        • bagateloB 離線
                          bagatelo
                          最後由 編輯

                          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 條回覆 最後回覆 回覆 引用 0
                          • TIGT 離線
                            TIG Moderator
                            最後由 編輯

                            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 條回覆 最後回覆 回覆 引用 0
                            • irwanwrI 離線
                              irwanwr
                              最後由 編輯

                              thank you for the plugin 😄

                              1 條回覆 最後回覆 回覆 引用 0
                              • G 離線
                                Gabbiano
                                最後由 編輯

                                Really a great plugin!
                                Thank you TIG!

                                1 條回覆 最後回覆 回覆 引用 0
                                • H 離線
                                  hegemonicoMX
                                  最後由 編輯

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

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • E 離線
                                    Ecuadorian
                                    最後由 編輯

                                    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 條回覆 最後回覆 回覆 引用 0
                                    • JClementsJ 離線
                                      JClements
                                      最後由 編輯

                                      A mighty handy plugin. Thanks!

                                      John | Illustrator | Beaverton, Oregon

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • B 離線
                                        bsfranza
                                        最後由 編輯

                                        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 條回覆 最後回覆 回覆 引用 0
                                        • TIGT 離線
                                          TIG Moderator
                                          最後由 編輯

                                          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 條回覆 最後回覆 回覆 引用 0
                                          • D 離線
                                            db11
                                            最後由 編輯

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

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement