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

    [Plugin] GlobalMaterialChange v1.4 20110525

    Scheduled Pinned Locked Moved Plugins
    32 Posts 17 Posters 35.3k Views 17 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.
    • J Offline
      jster
      last edited by

      Thanks for the very useful tool!!

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

        Here's an update http://forums.sketchucation.com/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]...

        TIG

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

          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. 👍

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

            Also look for MaterialConsolidator and similar tools... 😉

            TIG

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

              @tig said:

              Also look for MaterialConsolidator and similar tools... 😉

              yes, of course. certainly. thank you 😄

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

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

                1 Reply Last reply Reply Quote 0
                • DDrockD Offline
                  DDrock
                  last edited by

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

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

                    @ric

                    Find and read the several tutorials on how to install various kinds of Plugins.
                    http://sketchucation.com/resources/tutorials/37-beginner/108-installing-sketchup-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... ☀
                    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!]

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • pilouP Offline
                      pilou
                      last edited by

                      A little Question 😄

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

                      http://sketchucation.com/forums/download/file.php?id=129376&t=1

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

                      http://sketchucation.com/forums/download/file.php?id=129377&t=1

                      How automate the process when you Pick the texture of the "external" face of the component for have the second result ?

                      Frenchy Pilou
                      Is beautiful that please without concept!
                      My Little site :)

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

                        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...

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

                          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?pln=materialconsolidator

                          # !!! 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...   
                          

                          TIG

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

                            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??

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

                              November 20,2022
                              It has been a while since the last posting and SU2022 is the current version.

                              Any reason this should not work or is there anything in the current ruby version that could improve the performance of the plugin?

                              I have found that it does not seem to work properly if the selection of objects contains copies of groups or components. This behavior occurred in tests with both SU2017 and SU2022.

                              Please see the attached example which I used for testing.


                              test (Su 2017).skp

                              John | Illustrator | Beaverton, Oregon

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

                                Copies of groups are pretty much like copies of component-instances, BUT if you edit [open] a copy of a group then SketchUp always automatically makes it unique [even if you do nothing in the edit-context] - this is unlike a component-edit operation... with components you must choose to 'make unique' which will then limit any changes you make to only that new definition's instances' entities.
                                Any materials edited inside an edit-context are shown in all of the instances of that component - so if you only want to change one of them you must choose 'make unique' from that instance's context-menu before choosing to edit it...
                                This is unlike if you add materials to the 'container' itself [i.e. group or component-instance] then these are only applied to just those specific 'containers', however, unlike textured materials on faces, you cannot 'adjust' textured materials on 'containers' using the native context-menu item. But solid colors work fine... This limits the usefulness of this approach as with roof tiles or sidings etc you probably want to adjust the textures location of orientation etc...

                                TIG

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

                                  So why do you think this characteristic of copied groups was implemented by SU in the 1st place? What is the benefit for modeling process? This behavior feels more like a bug rather than a benefit.

                                  Is there anything that can be done in ruby to simulate the process opening and editing groups so that the copies are “unique” … circumventing the manual process?

                                  John | Illustrator | Beaverton, Oregon

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

                                    'Make unique' is accessible through the API thus...

                                    This works on groups in each separate entities context...

                                    
                                    model = Sketchup.active_model
                                    model.start_operation('Uniquify Groups', true)
                                    model.active_entities.grep(Sketchup;;Group).each{|g| g.definition.instances.length > 1}.each{|g| g.make_unique }
                                    model.commit_operation
                                    
                                    

                                    To process all groups [inside every context or nested inside components or other groups]...

                                    
                                    model = Sketchup.active_model
                                    model.start_operation('Uniquify All Groups', true)
                                    model.definitions.each{|d| d.group? && d.instances.length > 1 }.each{|g| g.instances.each{|g| g.make_unique } }
                                    model.commit_operation
                                    
                                    

                                    Copy/paste code into the Ruby Console and press enter...
                                    It's one-step undo-able through the Edit menu.

                                    TIG

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

                                      Thank ,you TiG that worked!

                                      Any chance of incorporating the code into GlobalMaterialChange2.rbz ?

                                      And/or a separate Plugin for displaying an option (such as "GroupCopy UnInstanting") in the Context Menu that would appear if objects are selected?
                                      It come in handy for other issues that might happen with copied groups.


                                      P.S.
                                      Your previous post regarding editing a group, gave me an idea of how to make it easier to manually open multiple occurrences of groups containing materials.

                                      I gave all groups containing materials an Instant Name that included the text "....(with material)". Then, by opening the Outliner, and searching for "(with material)" and double-clicking on each find to open and close the group. It was a fairy quick process compared to opening each group in the modeling window.

                                      If a group's instant is properly named then all is good, BUT it takes discipline when creating groups in the first place.

                                      John | Illustrator | Beaverton, Oregon

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

                                      Advertisement