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

    How do I find a problematic Sketchup Material?

    Scheduled Pinned Locked Moved Developers' Forum
    16 Posts 7 Posters 9.9k Views 7 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.
    • halroachH Offline
      halroach
      last edited by

      @thomthom said:

      Open the Ruby Console, type in

      
      > Sketchup.active_model.materials.each { |m| puts m.name + ' - ' m.texture.filename }
      > 
      

      I am not very familiar with Ruby Code. If I'm supposed to add something, substitue something let me know.
      Typing in the above code as is gives an error.

      
      Error; #<SyntaxError; (eval);131; compile error
      (eval);131; syntax error
      Sketchup.active_model.materials.each { |m| puts m.name + ' - ' m.texture.filename }
      

      What am I supposed to see after the code is executed?

      FlexTools - Super Quick Windows, Doors, Slats...

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

        Sorry, my bad. Didn't check the code first.
        This works:
        Sketchup.active_model.materials.each { |m| puts m.name + ' - ' + m.texture.filename if m.texture != nil }

        It will return a list of textured materials with their name and the filepath.

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

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

          Nice code snippet!

          But why are there material names in different format:
          <.....>
          [.....]
          .....

          And is this the only possibility to see filepath?
          In SU material editor I only see filename.
          But when I get a SKP from other users there is a embedded material where the path does not exist on my PC.

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

            < and [ are just some naming conventions. I think some of SU's default materials uses these characters.

            I don't know of any other means to find out the file path.

            Some times there isn't a filepath. It's just the name.

            SU always embed the texture into SU. But some times stores the location of the original texture. Not sure why though. But render engines some times uses that path to load the textures. Since SU downsamples the images the original might be a higher resolution. But, as I've noticed with V-Ray, if the file doesn't exists it'll return an error instead of falling back to extracting the embedded image.

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

            1 Reply Last reply Reply Quote 0
            • halroachH Offline
              halroach
              last edited by

              Thank you Thomthom!
              Your script worked very well and it helped me re diagnose my problem.
              Apparently Sketchup wasn't the problem maker, all textures were well defined and linked.

              For those who are interested, the problem was (and still is) as follows:
              I had a material in my model named '<white>' - which when exporting to Maxwell - using 'Auto MXM conversion' - was pointing to a problematic MXM - a material within my Maxwell material libraries (which is apparently called '<white>'!?!?).
              I went through a lot of trouble to find which material IN SKETCHUP was causing the problem, and I am currently in correspondence with the Maxwell Support Team to figure out a way to quickly find the problematic MXM in my libraries, since I don't have any MXM called white, but rather a bunch of MXMs that include white in their name.

              So, a temporary solution to get the render going is to delete the material called <white> in the sketchup model, and redefine parts of the model that were affected. How to find that <white> (or any other texture for that matter) was making the problem, we have yet to discover...

              FlexTools - Super Quick Windows, Doors, Slats...

              1 Reply Last reply Reply Quote 0
              • S Offline
                silver_shadow
                last edited by

                hi there...nice script...any way to make a button for this, then we dont have to copy and paste every time, thanx

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

                  @unknownuser said:

                  So, a temporary solution to get the render going is to delete the material called <white> in the sketchup model, and redefine parts of the model that were affected. How to find that <white> (or any other texture for that matter) was making the problem, we have yet to discover...

                  You could always go into the SUp material-browser, model-tab, pick the problem material's icon, edit and then rename <white> as <HALwhite> (or whatever) to avoid the glitch after export... That way the parts of the model aren't affected at all as their colour etc stays as it was - only that material's name has changed to protect the innocent/guilty...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • halroachH Offline
                    halroach
                    last edited by

                    @tig said:

                    You could always go into the SUp material-browser, model-tab, pick the problem material's icon, edit and then rename <white> as <HALwhite> (or whatever) to avoid the glitch after export... That way the parts of the model aren't affected at all as their colour etc stays as it was - only that material's name has changed to protect the innocent/guilty...

                    Yep, that works too - sometimes!
                    I have played around with changing the problematic material's name. Some times it works sometimes it doesn't. I tried renaming to other names which include the word white, like '<White>XXX', and it still failed intermitently. Either I did something wrong, or actually having the string 'White' in the material name calls the problematic material in Maxwell... haven't recreated the problem yet.

                    FlexTools - Super Quick Windows, Doors, Slats...

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      silver_shadow
                      last edited by

                      this happened to me too when i tried importing to maxwell part by part from sketchup, thought it was going to be easier. It was a nightmare. I couldnt bring it all at once into maxwell(preferable way to go) my model was too big. And it kept telling me this material is already there, ignore or replace it and i chose ignore it, because its alreday there.Kinda got the same error messages when i try to render and ends up rendering just checkerboards.So i dont know if your model may be the same result of importing just bits and pieces to make up a full model.

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

                        @silver_shadow said:

                        hi there...nice script...any way to make a button for this, then we dont have to copy and paste every time, thanx

                        Yea. I'll see when I can squeeze it in.

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

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          skateboardtshirt
                          last edited by

                          I had a similar problem where I are getting this message every time I tried to save: "*** Problems were found that could not be fixed! *** The name for CMaterial (290526) is not valid". It would still let me save the file though. I was able to solve the problem by opening the materials window and hovering over each material to look at the name. I found 3 materials that somehow had blank names. After renaming those materials the problem went away.

                          I don't know how those blank named materials got there in the first place though, I tried to recreate the problem but SketchUp won't let you name a material with a blank name.

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

                          Advertisement