SetUserText

Sets or removes user text stored on an object. For more details on User Text, see the discussion found in the User Data Methods summary.

Syntax

rhinoscriptsyntax.SetUserText (object_id, key, value=None, attach_to_geometry=False)

rhinoscript.userdata.SetUserText (object_id, key, value=None, attach_to_geometry=False)

Parameters

object_id

Required.  String or Guid.  The object's identifier.

key

Required.  String.  The key name to set.

value

Optional.  String.  The string value to set. If omitted the key/value pair specified by key will be deleted.

attach_to_geometry

Optional.  Boolean.  The location on the object to store the User Text.

Value

Description

True

Attaches text information to the object geometry. If the information is closely associated with the geometry, attach it to the geometry. For example, a circle's radius should be attached to the geometry because the information will be invalid if the circle is control-point edited and changed into a NURBS curve.

False (Default)

Attaches text information to the attributes of an object. If the information is higher-level attribute information, like color, then it should be attached to the object's attributes. Attribute information will persist when an object is control point edited, trimmed, copied, and so on.

Returns

Boolean

True or False indicating success or failure.

Example

import rhinoscriptsyntax as rs

obj = rs.GetObject("Select object")

if obj:

  rs.SetUserText( obj, "PartNo", "KM40-4960" )

  rs.SetUserText( obj, "Price", "1.25" )

Also See

GetUserText

IsUserText