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

    [Plugin] Remove group materials, leave geometry material

    Scheduled Pinned Locked Moved Plugins
    88 Posts 27 Posters 60.5k Views 27 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.
    • M Offline
      Matt666
      last edited by

      Hi Didier!
      This update works with both versions.

      if Sketchup.version[0,1].to_i >= 7
        model.start_operation("Remove comp & group materials",true)
      else
        model.start_operation("Remove comp & group materials")
      end
      

      Thank you for the remark πŸ˜‰

      Frenglish at its best !
      My scripts

      1 Reply Last reply Reply Quote 0
      • Didier BurD Offline
        Didier Bur
        last edited by

        Merci,
        C'Γ©tait pour savoir comment l'indexer sur mon site.

        DB

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          I have a suggestion for an improvement. An option to make components painted with different materials into unique components.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

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

            Hi thomthom!
            Sorry for the delay! Great idea! O've updated the code.
            I've tested it veeery quickly....
            The plugin post is up-to-date.

            Frenglish at its best !
            My scripts

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

              Thank you Jackson πŸ˜„

              Frenglish at its best !
              My scripts

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jackson
                last edited by

                Amazing work Matthieu! πŸ‘ πŸ‘

                Jackson

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jackson
                  last edited by

                  Sorry Matthieu, I just ran a test and this isn't working, or at least it's not working at all as I would like. It doesn't create distinct components according to colour as ThomThom suggested- after running it on 3 identical car components which I'd painted different colours it just turned them all blue and they are still intances of the same component. I don't understand the logic behind the new colour choice for default either (personally I don't like ruby scripts to use their own material libraries, as I keep very strict control over my materials libraries, but that's another story). Surely this feature overrides the whole point of the original script i.e. that it replaces the default material applied to geometry within groups and components with the material which has been applied to the groups or component. Now all the geometry with default material applied turns a new global colour, which make the script useless for V-Ray users.

                  Sorry for the criticism, hopefully you understand it is intended strictly constructively! I am still your number one fan! πŸ˜†

                  Jackson

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

                    @unknownuser said:

                    Sorry for the criticism, hopefully you understand it is intended strictly constructively! I am still your number one fan!
                    🀣
                    Sorry for the incovenience...

                    @unknownuser said:

                    Surely this feature overrides the whole point of the original script i.e. that it replaces the default material applied to geometry within groups and components with the material which has been applied to the groups or component. Now all the geometry with default material applied turns a new global colour, which make the script useless for V-Ray users.
                    You can use this new script as the old... Just select Yes, and default. And it will do the same thing! Or I'm completely wrong πŸ˜•

                    In fact I didn't understand Thomthom's request 😳 😳
                    Here, the update can replace parent material to desired colour. Or replace the default material when you choose No... If you don't understand, tell me... I have a poor english... 😳

                    Thomthom's request is agood idea... I will see what I can do!

                    Frenglish at its best !
                    My scripts

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jackson
                      last edited by

                      Matthieu,

                      Still not working properly I'm afraid. Despite selecting "Yes" and "Default" 3 differently painted cars all turned red. Can you reattach the original (i.e. pre 17th March) ruby script while you're fixing the new one please? I stupidly overwrote it when I installed your new version and I'll need the old fully-functioning one for work tomorrow!

                      Thanks again for all your hard work!

                      Jackson

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

                        This is normal your 3 differently painted cars all turned red. I didn't understand thomthom's request (my poor english 😒 )... The last one works like the precedent: It puts comp material on geometry, but it doesn't make different color component unique! No need to re-attach the original.
                        And I also lost this one 😲 !! However I'm sure this last update can do what precedent version was able to!
                        A future version will be able to do what thomthom want...

                        Frenglish at its best !
                        My scripts

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jackson
                          last edited by

                          Ahh, I see... so I can continue using the current ruby script, just as long as I don't have identical components with different materials applied to them.

                          One further suggestion for the next version though (I bet you wish you'd never started now!)- the Yes/No selection should be set to "Yes" as default or just set up as an "OK?" warning message as it was before, as it's rather irritating to have to change it every time you run the script (which in my case is many times daily). If the end user didn't want to apply the C-G materials to the geometry they wouldn't have chosen to run the script! πŸ˜„ I think the warning is sensible though so people know they are applying a permanent change to their entire skp file.

                          Jackson

                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            Did I cause all this? ooops....

                            p.s. Matt
                            Inregards to if Sketchup.version[0,1].to_i >= 7. This will break when SU hits version 10. (A bit far of, I know) But instead you can do if Sketchup.version.split('.')[0].to_i >= 7 which is future safe. πŸ˜‰

                            Thomas Thomassen β€” SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

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

                              My poor english is the culprit... πŸ˜„

                              Ok, I see... But If you do this : Sketchup.version.to_i, it works great! πŸ˜‰

                              Frenglish at its best !
                              My scripts

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                @matt666 said:

                                Ok, I see... But If you do this : Sketchup.version.to_i, it works great! πŸ˜‰

                                Ah! Cool! Even cleaner! πŸ˜„

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • X Offline
                                  xrok1
                                  last edited by

                                  what would be really cool is if you could get this script to work on projected materials. πŸ˜„

                                  β€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

                                  http://www.Twilightrender.com try it!

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    Jackson
                                    last edited by

                                    @xrok1 said:

                                    at would be really cool is if you could get this script to work on projected materials.

                                    As projected materials can only be applied to geometry directly (as opposed to groups or comps) they aren't taken into account in Remove C-G.rb's calculations. If you're referring to the fact that VfSU can't read the UV mapping for perspective-skewed materials (i.e. photomatched or manually distorted) that's a whole different problem from what this little ruby was meant to solve. Nevertheless that would be one great VfSU super ruby!

                                    Jackson

                                    1 Reply Last reply Reply Quote 0
                                    • X Offline
                                      xrok1
                                      last edited by

                                      i was thinking something more like this>cap.jpg

                                      if i could get the texture to project in these cobblestones components, i could have 36 unique cobbles. πŸ˜›

                                      β€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

                                      http://www.Twilightrender.com try it!

                                      1 Reply Last reply Reply Quote 0
                                      • thomthomT Offline
                                        thomthom
                                        last edited by

                                        I think that would be a different plugin all together.

                                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                        List of my plugins and link to the CookieWare fund

                                        1 Reply Last reply Reply Quote 0
                                        • J Offline
                                          Jackson
                                          last edited by

                                          xrok1,

                                          Maybe I'm not understanding your question, but you can easily make 36 unique textured cobbles in SU now. The repeated texture has only been created because you only made one textured cobble group/component and then copied it. If you copy the shape of the cobble first, apply the texture and then make each one into a group or component they will keep their UV mapping relatively rather than locally. If you make sure that this set of groups/components has the same repeat/tile dimensions as your tiled texture you can make a cobbled area as big as you want with a perfect tiling texture and tiling geometry.

                                          Following the logic of applying an updated "Remove C-G" type script to what you're asking for, you would end up with thousands of components, one for every single cobble in your model.

                                          Cobbles.jpg

                                          Jackson

                                          1 Reply Last reply Reply Quote 0
                                          • J Offline
                                            Jackson
                                            last edited by

                                            I just quickly made a better example, attached, where the cobble geometry actually follows the texture and each set of cobbles (and the moss joints between) is a component which tiles like a jigsaw puzzle. Come to think of it, it would actually be more useful for the sets to be groups rather than components as you can then delete extra cobbles without affecting all the other sets.

                                            Cobbles Rough.jpg

                                            Cobbles Rough.skp

                                            Jackson

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

                                            Advertisement