Custom Object Property

Hi all!
I started research concerning abbility setting custom properties to objects. For example I need to select object and mark that its type is “door” or “window”.
Is there any ways to do this?

Hi Zombik,

you have several options. I recommend trying them in the following order:

  • UserText on either the geometry or the attributes. You can assign all sorts of key-value string pairs to objects and these pairs are (de)serialized and copied. Have a look at SetUserString, GetUserString and GetUserStrings. Everyone can access UserText.
  • UserDictionary, works very similar to UserText, but allows for more types of data, not just strings. Everyone can access the UserDictionary.
  • UserData. You can assign your own types to geometry and/or attributes. Only you can access your UserData and that can be both a good and a bad thing depending on what you want. The main benefit of using UserData is that you can keep track of how often it is copied and you get informed when the object which contains your user data gets transformed. You can choose whether or not you want to include the user data in the 3dm file.
  • Object Name. This is probably the most obvious place to put some information about the object, but it’s also quite limited and not very secure.
  • Maintain a separate database which ties object IDs to properties. You can store this database either separately or as part of the 3dm file. This is a very complicated solution though, I suspect that the UserData approach will give you all the functionality you need.

Thanks a lot for such informative answer!