def getSourceKeys(source, bakename=False): if rs.IsUserText(source) == 0: print 'no keys' return if bakename == False: return [x for x in rs.GetUserText(source) if "BakeName" not in x] else: return [x for x in rs.GetUserText(source)]
def getWindowUserText(_in): with idf2ph_rhDoc(): windowDataFromRhino = {} if rs.IsUserText(_in): print 'Pulling data from Rhino model for Window: {}'.format( rs.ObjectName(_in)) # Get the User-Text data from the Rhino Scene for eachKey in rs.GetUserText(_in): windowDataFromRhino[eachKey] = rs.GetUserText(_in, eachKey) return windowDataFromRhino else: return None
def getAttrs(_in, _key): results = [] for each in _in: if _key == 'Object Name': results.append(rs.ObjectName(each)) else: if rs.IsUserText(each): for eachKey in rs.GetUserText(each): if _key in eachKey: results.append(rs.GetUserText(each, _key)) break if len(set(results)) > 1: return '<varies>'
def getAttrs(_in, _key, _defaultVal): # Takes in a list of Objects (_in) and the key to search for in # User-Text. Returns '<varies>' if more than one value is found for the key results = [] for each in _in: if _key == 'Object Name': results.append(rs.ObjectName(each)) # Get the objects Name else: # Get the User text info if rs.IsUserText(each): for eachKey in rs.GetUserText(each): if _key in eachKey: results.append(rs.GetUserText(each, _key)) break if len(set(results)) > 1: return '<varies>' else: try: return results[0] except: return _defaultVal
def copySourceData(obj, source): if rs.IsUserText(source) == 0: return keyValue = sourceKeyValue(source) # print keyValue map(lambda x, y: rs.SetUserText(obj, x, y), keyValue[0], keyValue[1])
def getSourceKeys(source): if rs.IsUserText(source) == 0: print 'no keys' return return [ x for x in rs.GetUserText(source) if "BakeName" not in x ]