Hi @Cumberland
Pretty sure there is a smarter way but here you go :
import Rhino
import scriptcontext as sc
# Get all selected objects (preselected in the document)
objects = sc.doc.Objects.GetSelectedObjects(False, False)
# If no objects are selected, you can ask the user to select one (optional)
if not objects:
obj = Rhino.Input.RhinoGet.GetObject("Select an object", False, Rhino.DocObjects.ObjectType.AnyObject)
if obj:
objects = [obj]
if objects:
for obj in objects:
obj.Attributes.SetUserString("Key1", "0")
obj.Attributes.SetUserString("Key2", "0")
obj.CommitChanges()
else:
print("No objects selected.")