@piac yes, i’m trying to make a workflow for creating, editing, and applying the user text to text in a layout title block.
it’s very cumbersome working with it natively. i got pretty good with RhinoScript, but this Python is new territory for me so I’m hacking together other scripts hoping to get what I’m going for.
it would be nice if there was a one stop window for working with User and Document text, create key’s and value, delete key’s, edit values, and most of all get it in a text field.
thanks in advance.
here is another part that I’m working on to pick a User Text Key and assign it to text. I know I’ve got them mixed up with one working with User Text and the other Document text, I just wanted to post it up for more context on what I’m trying to do.
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import Rhino as rh
# get User Keys Listed in File
keys = 
objsId = rs.AllObjects()
for i in objsId:
keys_i = rs.GetUserText(i, None, False)
if len(keys_i) > 0:
for k in keys_i:
value = rs.GetUserText(i, k, False)
if k in keys:
index_k = keys.index(k)
if not (value in values[index_k]):
keyListResult = rs.ListBox(keys, "Keys to select:", "Select Objs by Key/Value")
# Pick the text to apply the User Text Key and value to display it in the selected text
objectId = rs.GetObject("Pick any object")
clip = rs.ClipboardText(objectId)
tokenPrefix = '%<usertext("'
tokenMid = '","'
tokenEnd = '")>%'
print "Copied Identifier: ", objectId
rs.TextObjectText(objectId, tokenPrefix + clip + tokenMid + keyListResult + tokenEnd)