sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Set_attribute corrupts 2014 files

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 507 Views 3 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.
    • C Offline
      c65m3zxt
      last edited by

      Hi all.

      I have just completed a script to animate SketchUp scenes that uses attributes to store sequence information. When I use the script on a scene it attaches attributes (strings, integers and a Vector3d object to groups. After saving the file it can't be reopened in SketchUp 2014. Windows reports "Unexpected file format", on Mac it's a similar message that the file is corrupt.

      Has anyone encountered this issue before? I used attributes successfully a few years ago, although I only stored strings back then. I can't remember if this was due to issues I encountered with SU 7 or if I just didn't have to use any more complex objects.

      Thanks,
      Thomas

      1 Reply Last reply Reply Quote 0
      • K Offline
        kaas
        last edited by

        Hello Thomas,

        I'm using attributes to store strings and [arrays with integers] in groups and I don't experience any problems in SU2014. Maybe the Vector3d objects are causing the problem? Best way to find out is trying out 1 type of attribute at a time and see if the file goes corrupt or not.

        greetings, Max

        1 Reply Last reply Reply Quote 0
        • C Offline
          c65m3zxt
          last edited by

          Thanks for the confirmation, Max.

          As a quick test I removed the Vector3d object from the attributes but it didn't help. I need to get some work done so I have changed everything to use hashes and a hard coded configuration in the script file. I'll do some more testing when I have more time.

          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            We've never heard of such issue. If you have a reproducible snippet we can look into it.

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              I think it might be due to a call to set_attribute where key and value is nil.

              Sketchup.active_model.set_attribute("bug", nil, nil)

              I noticed your extension did a call like this. Try to filter out calls where key and value is nil and see if that helps. I'll try to hunt down the bug on our side.

              1 Reply Last reply Reply Quote 0
              • C Offline
                c65m3zxt
                last edited by

                @tt_su said:

                I think it might be due to a call to set_attribute where key and value is nil.

                Yes, I noticed there was this call to set_attributes without key and value but couldn't immediately see where it came from. I found the problem now. Thanks for checking.

                Thomas

                1 Reply Last reply Reply Quote 0
                • tt_suT Offline
                  tt_su
                  last edited by

                  I have looked further and I can confirm that zero length strings as keys will cause this. Nil values will convert to empty strings. So as a workaround until we fix this bug please validate the key provided to set_attribute.

                  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