Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5793

GetUserText

$
0
0

@asbeastos wrote:

Having an issue with either GetUserText, or SetUserText, but not sure which.

If i try to print the usertext by Key, i get nothing, but if leave the key out, my user-text prints just fine. what am i doing wrong here?

import rhinoscriptsyntax as rs
   
def getset_material(object):
   if object:
       mat_label = rs.IsUserText(object)
       if mat_label != 1: 
            material = rs.GetString (message="Please set a material for this \ 
            object (i.e. hardwood, oak, etc.)", defaultString=None, strings=None)

            rs.SetUserText(object, "Material", material, attach_to_geometry=False)
   else:
        print rs.GetUserText (object, "Material")  #returns nothing
        print rs.GetUserText (object) #returns ['oak']


base_geo = rs.GetObjects ( message=None, filter=1073741840, group=False, \ 
preselect=True, select=True, objects=None, minimum_count=1, \ 
maximum_count=1, custom_filter=None )


getset_material(base_geo)

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5793

Trending Articles