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

    Material Attributes

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 7 Posters 2.3k 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.
    • Al HartA Offline
      Al Hart
      last edited by

      Thanks for the response.

      I go to the SketchUp Material Window and use Save As, and then view the XML after loading the .SKM file with WinZip.

      The .XML is not part of the process, I was just using it to see if SketchUp had saved the attributes materials properly.

      Note: This is not a problem creating materials and saving them into the.SKP file. I wanted to be able to put Attributes on a material, save it in a library, use the material in a different drawing and have the attributes still be valid.

      Here is the process:

      1. Select a SketchUp Material and place it on a face.
      2. Place more than 1 attribute directly on the material.
      3. Use the SketchUp materials window to save the material as a .SKM file.
      4. Start a new SketchUp session and a new drawing.
      5. Select the .SKM material with the SketchUp materials window
      6. Query the material to see if the attributes are still set.

      If you can do all this, I would love to have the .SKM file for the material, and also a new model with a single face in which you have placed the material.

      This would be a great help for me if we could get it to work.

      Al

      Al Hart

      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

      1 Reply Last reply Reply Quote 0
      • A Offline
        avariant
        last edited by

        Sorry for digging up an old post, but I can't find anywhere the answer to the question posed here, the question I need answered as well.

        When you apply attributes to a material, and save that material as an SKM, the attributes are saved correctly. If you rename the SKM as a zip and examine the document.xml, the attribute dictionaries are all listed, all correct.

        But when you load that material into a new scene and apply it to a face, the attribute dictionaries are not restored correctly. What I've observed is that the number of dictionaries is reported correctly, but each dictionary reports it's name and keys/values as those stored only in the first dictionary. That you get multiple dictionaries with the same name seems a bug straight off the bat. Shouldn't all attributes with the same dictionary name be stored in a single dictionary? I suspect this is a Sketchup bug in loading the attributes from the SKM. Does anyone have any info about this?

        1 Reply Last reply Reply Quote 0
        • Al HartA Offline
          Al Hart
          last edited by

          Yes. This appears to be a SketchUp bug. Attributes and Attribute Dictionaries stored on materials are not saved properly in the SKM file and/or not reloaded properly.

          Al Hart

          http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
          IRender nXt from Render Plus

          1 Reply Last reply Reply Quote 0
          • A Offline
            avariant
            last edited by

            Ok. Has this been reported to SU as an official "bug"? It would be very nice to get it fixed some day.

            1 Reply Last reply Reply Quote 0
            • Al HartA Offline
              Al Hart
              last edited by

              @avariant said:

              Ok. Has this been reported to SU as an official "bug"? It would be very nice to get it fixed some day.

              I didn't report it.

              I suppose I hoped hey might read these threads.

              Also, has anyone ever reported a bug and felt that the report had anything to do with the final resolution. Especially a bug like this which does not effect almost anyone? (Except we Ruby programmers who want to store attributes on materials and be able to save and reload them).

              Al Hart

              http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
              IRender nXt from Render Plus

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

                The problem/bug of saving multiple material attributes with a material is still there but I found a workaround. It seems that the saved .skm material file when loaded will only retain a single attribute parameter. So I packed all the material params into a single string using a single parameter and then saved the material. If I need to do anything with the material attributes, I unpack them into Sketchup attributes at run-time. Kind of a kludge, but it works.

                1 Reply Last reply Reply Quote 0
                • Al HartA Offline
                  Al Hart
                  last edited by

                  That will work in some cases, and is a clever solution.

                  One of the things we are trying to do is save multiple images with a material - e.g. a bump map and specular map - in addition to the diffuse map. First we have to convert the binary to ASCII because SketchUp does not handle binary attributes properly, then we run into the problem that SketchUp can only handle about one megabyte (I don't remember the exact limit) per attribute, so we split large images up into several attributes.

                  Al Hart

                  http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                  IRender nXt from Render Plus

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

                    @al hart said:

                    That will work in some cases, and is a clever solution.

                    One of the things we are trying to do is save multiple images with a material - e.g. a bump map and specular map - in addition to the diffuse map. First we have to convert the binary to ASCII because SketchUp does not handle binary attributes properly, then we run into the problem that SketchUp can only handle about one megabyte (I don't remember the exact limit) per attribute, so we split large images up into several attributes.

                    there's a attribute size limit? hm... that would have been useful info to have seen in the manual.

                    binary to ASCII? you mean base64?

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

                    1 Reply Last reply Reply Quote 0
                    • Al HartA Offline
                      Al Hart
                      last edited by

                      @thomthom said:

                      there's a attribute size limit? hm... that would have been useful info to have seen in the manual.

                      binary to ASCII? you mean base64?

                      We use HEX sometimes and Base64 sometimes.

                      Try this little example:

                      
                      def test_att(size)
                      	test_string = "A"*size
                      	printf("size; %s test_string.length; %s\n",
                      		size, test_string.length)
                      	model = Sketchup.active_model
                      	model.set_attribute("test_string","test_string", test_string)
                      	test_string2 = model.get_attribute("test_string","test_string")
                      	printf("size; %s test_string.length; %s test_string2.length; %s\n",
                      		size, test_string.length, test_string2.length)
                      end#def
                      
                      

                      If you load it and type in:
                      test_att(100) - works
                      test_att(100000) - works
                      test_att(1000000) - works
                      test_att(2000000) - dumps core

                      Al Hart

                      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                      IRender nXt from Render Plus

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

                        @al hart said:

                        That will work in some cases, and is a clever solution.

                        One of the things we are trying to do is save multiple images with a material - e.g. a bump map and specular map - in addition to the diffuse map. First we have to convert the binary to ASCII because SketchUp does not handle binary attributes properly, then we run into the problem that SketchUp can only handle about one megabyte (I don't remember the exact limit) per attribute, so we split large images up into several attributes.

                        Al, are you implying that you've found a way for Sketchup materials to load with multiple attributes attached? If so, can you share the magic of this invention.

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @avariant said:

                          Ok. Has this been reported to SU as an official "bug"? It would be very nice to get it fixed some day.

                          for SketchUp 2017

                          @unknownuser said:

                          (https://help.sketchup.com/en/article/141303)":2kct16r6]
                          Fixes/Improvements General

                          SketchUp API Release Notes

                          • (Mac) Fixed issue where SKM files lost attribute dictionaries when saved from ‘In Model’ to local library.

                          I'm not here much anymore.

                          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