• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Materials Bugs?

Scheduled Pinned Locked Moved Developers' Forum
16 Posts 4 Posters 685 Views
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
    MartinRinehart
    last edited by MartinRinehart 8 Nov 2009, 12:16

    I add '[WOOD_CHERRY_ORIGINAL]' to model.materials. This seems to work but more often than not, I get a nice shade of black. It seems to work if '[WOOD_CHERRY_ORIGINAL]' is already in the model, but is flaky otherwise.

    Bug? Workaround?

    Edit: Make that '[Wood_Cherry_Original]'

    Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 8 Nov 2009, 12:32

      If you already have "[WOOD_CHERRY_ORIGINAL]" in the model then model.materials.add "[WOOD_CHERRY_ORIGINAL]" will add a new unique material "[WOOD_CHERRY_ORIGINAL]1".

      model.materials.add always seems to return a black material though. You have to set up the returned Material object.

      m=model.materials.add "[WOOD_CHERRY_ORIGINAL]" m.color='red'

      I'm not seeing anything unexpected.

      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
        MartinRinehart
        last edited by 8 Nov 2009, 13:07

        Model with 5 materials:

        Select All
        Delete

        in RC model.materials.purge_unused

        Model still has five materials.

        Model Info/Statistics/Purge Unused

        Model down to one material.

        In Materials window, delete.

        At last! No more materials.

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 8 Nov 2009, 13:10

          @martinrinehart said:

          Model with 5 materials:

          Select All
          Delete

          in RC model.materials.purge_unused

          Model still has five materials.

          This is strange - got a sample model? Never noticed problems with model.materials.purge_unused.

          @martinrinehart said:

          Model Info/Statistics/Purge Unused

          Model down to one material.

          In Materials window, delete.

          That last material, was that by any chance the current material? Sketchup won't purge the current material - you have to select an in-use material or the Default.

          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
            MartinRinehart
            last edited by 8 Nov 2009, 13:49

            Trivial model attached.

            @thomthom said:

            That last material, was that by any chance the current material? Sketchup won't purge the current material

            Good to know. Thx.


            t.skp

            Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 8 Nov 2009, 13:56

              Ah! Martin - I realised why the materials remained.
              The geometry with the materials was contained inside a Component. While the ComponentInstance was deleted - the ComponentDefinition remained. So the materials where still in the model.
              Which is why the Model Window -> Purge Unused worked, because it purged the definitions before purging the materials.
              I ran into the same thing with my Cleanup script. I had to purge in a particular order. Had to purge Definitions before purging Materials and Layers.

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

              1 Reply Last reply Reply Quote 0
              • C Offline
                cgndc
                last edited by 25 Nov 2009, 17:45

                I'm having trouble purging materials as well. Got a fairly large model consisting of many components. Originally used photos to mass/build the components; now I can't get purge the images. I'm allowed to purge, delete etc. but when I reopen the model, the images reappear in the materials list, even tho they are not on the components. I've got a gazillion components and don't even remember where the images are - grabbed from multiple older projects, so individually going through and moving the original image to a different folder to break the path isn't a sensible option. How do I do a definition purge? is there another option? Thanks!! C

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Chris Fullmer
                  last edited by 25 Nov 2009, 18:02

                  Its a little unclear what is happening. But probably you need to purge unused components also.

                  definitions = Sketchup.active_model.definitions definitions.purge_unused

                  http://code.google.com/apis/sketchup/docs/ourdoc/definitionlist.html

                  Then once you have removed the components that are not being used, then you should be able to purge images and it will remove all unused images.

                  Unless of course your questions were not ruby based? If you want to do it manually, there is a purge option in Window > Model Info > Statistics > Purge Unused

                  And that will clear all unused components, materials, and layers.

                  Hope that helps,

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    cgndc
                    last edited by 25 Nov 2009, 18:13

                    Thanks for responding, Chris. I didn't realize I was in a ruby question forum -- ran into the problem and accessed the forum through my model/help portion,which brought me here. I must admit, rubies are beyond my comprehension/skill level.

                    If its okay to continue, tho, I'm still using the components, just no longer need the photoshop image/texture that I used to make the components. Didn't realize the problem until my main model started becoming really sluggish. Upon investigation I found that, despite purging materials in the main model and purging in individual components, the image texture material doesn't actually purge. It appears to purge but when model is purged, saved and reopened, they are back in the materials-in-model list. Really slowing my work down. I'm happy to download and try a ruby if there's one to help this (along with instructions). Or should I move to another part of the forum. Help!

                    Thanks -- C

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      Chris Fullmer
                      last edited by 25 Nov 2009, 18:18

                      its ok, we can split this out into a new tpoic later if we need.

                      It sounds like posibly you still have some of the photoshop material inside the component perhaps. You would need to make sure that all faces that have the material aplied to it (front, back, hidden) have the material completely removed.

                      Do you have a model or compoennt that shows this issues that you could upload?

                      Chris

                      Lately you've been tan, suspicious for the winter.
                      All my Plugins I've written

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        cgndc
                        last edited by 25 Nov 2009, 18:37

                        Great - thanks! Here's a component from the larger model, which is composed of some smaller components. Apologies for the messiness and large size -- its always a work in progress!

                        Thanks again -- CCore bldgs4-render.skp

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          thomthom
                          last edited by 25 Nov 2009, 18:43

                          hmm... I'm not sure what the problemis.
                          I found four materials in the model. One was the active material, and when I selected the default material instead it was purged. Now it's three materials left. One Red and two green.
                          ❓

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

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            cgndc
                            last edited by 25 Nov 2009, 18:51

                            Thanks for looking at this, Thom Thom. I think what happens has something to do with a link to the original file. On my computer it still shows up as having 36 materials, 8 of those materials are image based textures. I work on a network and have grabbed these textures from throughout the network. I've been able to clean up some of the components by moving the original image file location.

                            I didn't have this situation before (earlier versions of SU) and think it must have something to do with dynamic components?? I could be way off base -- and please pardon my ignorance - I'm hopeless when it comes to technical things.

                            Thanks -- C

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              cgndc
                              last edited by 25 Nov 2009, 18:54

                              Here's my screen shot of the materials that appear on my model (same one I uploaded).

                              Thx -- Ccapture1.jpg

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 25 Nov 2009, 18:58

                                hm... maybe it's a V-Ray bug. After purging all materials. Open the V-Ray option window and close it before you save your file.

                                Optionally, open the V-Ray material editor and purge materials from there as well.

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

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  cgndc
                                  last edited by 25 Nov 2009, 19:06

                                  ThomThom, you rock! That took care of the issue on this model. Thank you so much and have a Happy Thanksgiving! C

                                  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