import rhinoscriptsyntax as rs from System.Drawing import Color """Script Written By Luis Quinones Script Copywritten by [n]igma + computationalMatter www.luisquinonesdesign.com www.computationalmatter.com Script Version Wednesday, July 30, 2011""" import rhinoscriptsyntax as rs from System.Drawing import Color def makeMeshyMesh(pts,mainValue,faceCount,layer): faceCounter = [] faceVerts = [0] pt1 = rs.AddPoint(pts[0]) coord1 = rs.PointCoordinates(pt1) pt2 = rs.AddPoint(pts[1]) coord2 = rs.PointCoordinates(pt2) pt3 = rs.AddPoint(pts[2]) coord3 = rs.PointCoordinates(pt3) if len(pts) == 4: pts4 = rs.AddPoint(pts[3]) coord4 = rs.PointCoordinates(pts4) testVerts = [coord1,coord2,coord3,coord4] for i in range (faceCount): faceCounter.append(i) faceVerts[0] = faceCounter testVerts = [coord1,coord2,coord3] newMesh = rs.AddMesh(testVerts,faceVerts) vertexcount = rs.MeshVertexCount(newMesh) if not vertexcount: print "did not make mesh" else: colors = [] for n in range(rs.MeshVertexCount(newMesh)): mainColor = mainValue[n] #print mainColor r = mainColor if r > 255: r = 255 #print r g = mainColor if g > 255: g = 255 #print g b = mainColor if b > 255: b = 255 #print b intMainValue = float(r),float(g),float(b) #print intMainValue colors.append(intMainValue) print colors rs.MeshVertexColors( newMesh, colors ) return newMesh def Main(): strLayer = rs.AddLayer("MeshLayer") strLayer2 = rs.AddLayer("DOTACTION") f = open('C:UserskingLuiDesktopzingbanger2.txt','r') #C:UserskingLuiDesktop mainValue = [] tempLOC = [] ElementList = [] count = 1 counter = [] for line in f: trim = line.split(",") TestNodes = trim[1:] #print TestNodes TestNodesSplit = TestNodes[0] TestNodesSplit2 = TestNodesSplit.split(" ") NodeList = TestNodesSplit2[2] ElementList.append(NodeList) XYZValue = trim[4:7] #print 'this'+ ' = ' + str(XYZValue) xValue = XYZValue[0] temp = xValue.split(" ") newXValue = len(temp)-1 FinalX = temp[newXValue] yValue = XYZValue[1] temp2 = yValue.split(" ") newYValue = len(temp2)-1 FinalY = temp2[newYValue] zValue = XYZValue[2] temp3 = zValue.split(" ") newZValue = len(temp3)-1 FinalZ = temp3[newZValue] tempLOC.append([FinalX,FinalY,FinalZ]) lastItem = len(trim)-1 value = trim[lastItem] test = value.split(" ") lastItem2 = len(test)-1 printest = test[lastItem2] mainValue.append(test[lastItem2]) count += 1 counter.append(count) indexPass = [] count4 = 0 lastValueTrans = len(ElementList)-1 lastValue = int(ElementList[lastValueTrans]) #len = 44 items which means there are 43 and 0 #index numbers in ElementList go from 1 - 13 count5 = 1 for z in range(lastValue): #print "Element List - " + ElementList[count5] + " XYZ = " + str(tempLOC[count5]) #print ElementList[count4] transferB = ElementList.index(str(count5)) indexPass.append(transferB) count5 += 1 for m in range(len(indexPass)): if m != len(indexPass)-1: tempArray = indexPass[m],indexPass[m+1] tempValueArray = indexPass[m],indexPass[m+1] listTrans = tempLOC[tempArray[0]:tempArray[1]] print listTrans listColorTrans = mainValue[tempValueArray[0]:tempArray[1]] print listColorTrans newcount2 = len(listTrans) ColorTrans = mainValue[0:newcount2] faceCount = len(listTrans) mesh = makeMeshyMesh(listTrans,listColorTrans,faceCount,strLayer2) Main() Update