Difference between Attribute user text and Geometry user text?

Could anyone explain to me what is the difference?

taken from here:

Attribute User Text is stored on the attributes of an rhinoObject

Geometry user text is stored on the geometry of an rhinoObject

It is generally advised to store user data on the attributes as geometry is more fragile meaning certain commands can destroy or create new geometry for an object effectively deleting your user data stored on it.

when I use rhinoscriptsyntax.SetUserText which one is used? Attribute or Geometry?

This is weird / confusing. Can I have different user texts in Attributes and Geometry?

Nevermind, I see it’s the attributues:

def SetUserText(object_id, key, value=None, attach_to_geometry=False):
    """Sets or removes user text stored on an object.
      object_id (str): the object's identifier
      key (str): the key name to set
      value (str, optional) the string value to set. If omitted, the key/value pair
          specified by key will be deleted
      attach_to_geometry (bool, optional): location on the object to store the user text
      bool: True or False indicating success or failure
      import rhinoscriptsyntax as rs
      obj = rs.GetObject("Select object")
      if obj:
          rs.SetUserText( obj, "PartNo", "KM40-4960" )
          rs.SetUserText( obj, "Price", "1.25" )
    See Also:
    obj = rhutil.coercerhinoobject(object_id, True, True)
    if type(key) is not str: key = str(key)
    if value and type(value) is not str: value = str(value)
    if attach_to_geometry: return obj.Geometry.SetUserString(key, value)
    return obj.Attributes.SetUserString(key, value)

I wonder, though, when is using the Geometry user text applicable, useful, advisable?

Hi @ivelin.peychev,

Geometry user text is useful if you do not intend to add geometry to Rhino’s document.
But not all types support it.
Those that do, have the “SetUserString” method.

1 Like

It is attributes, and optionally on geometry too.