overview
1 pick a .csv file with Browse in GUI
2 pymel code loops through .csv file and creates a text curve for each city
3 if you want to follow along here is the simple csv data file
pymel
pastebin code
def textIn(): import EasyDialogs input_file = EasyDialogs.AskFileForOpen() wanted=unicode import os input_text = os.path.basename(input_file) input2_text = os.path.dirname(os.path.abspath(input_text)) output_text = os.path.splitext(input2_text)[0]+ '\\' + os.path.splitext(input_text)[0] + ".csv" fileLocation = pm.text('File_Location_Label', e=True, l=output_text)
def readFile(): import pymel.core as pm import re dataFile = pm.text('File_Location_Label', q=True, l=True) dataPath = dataFile f = open (dataPath) line = f.readline() while line: parts = line.split(",") cityObject = parts[2].strip() pm.textCurves( f='Times-Roman', t=cityObject,n=cityObject) line = f.readline() f.close()
Maya – Create GUI – run from script editor/shelf
import pymel.core as pm import Text_Output reload (Text_Output) dialog2 = pm.loadUI(f="C:/QTDESIGNER/Input_Text.ui") allowedAreas = ['right', 'left'] pm.showWindow() pm.dockControl(area='left',content=dialog2,allowedArea=allowedAreas,l='File_Browser_Creator')