Set_attribute corrupts 2014 files
-
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 -
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
-
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.
-
We've never heard of such issue. If you have a reproducible snippet we can look into it.
-
I think it might be due to a call to
set_attributewhere key and value isnil.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.
-
@tt_su said:
I think it might be due to a call to
set_attributewhere key and value isnil.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
-
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement