""" Script written by Luis Quinones Script copyrighted by complicitMatter.com www.complicitMatter.com www.computationalmatter.com Script version Sat, 1 Sep 2012 20:18:46 """ import rhinoscriptsyntax as rs import math from System.Drawing import Color def lineHanzSolo(arrCrvs,strNewLayer): arrFirstSet = [] arrSecondSet = [] for i in range(len(arrCrvs)): rs.ObjectLayer(arrCrvs[i],strNewLayer) arrFirstSet.append(rs.CurveStartPoint(arrCrvs[i])) arrSecondSet.append(rs.CurveEndPoint(arrCrvs[i])) for j in range(len(arrCrvs)-1): if math.fmod(j,2) == 0: dot = rs.AddTextDot(j,arrFirstSet[j]) rs.ObjectLayer(dot,strNewLayer) newLine = rs.AddLine(arrFirstSet[j],arrFirstSet[j+1]) rs.ObjectLayer(newLine,strNewLayer) else: newLine2 = rs.AddLine(arrSecondSet[j],arrSecondSet[j+1]) rs.ObjectLayer(newLine2,strNewLayer) rs.ObjectsByLayer(strNewLayer,True) rs.Command("_Join") rs.UnselectAllObjects #rs.LayerVisible("BASE", False) def Main(): strNewLayer = rs.AddLayer("FTHATNOISE", Color.Red) strNewLayer2 = rs.AddLayer("TEMP", Color.Red) baseSrf = rs.GetObject("BASE SURFACE",rs.filter.surface) paintMesh = rs.GetObject("PAINTEDMESH",rs.filter.mesh) color = rs.MeshVertexColors(paintMesh) arrVerts = rs.MeshVertices(paintMesh) # intDiv = rs.RealBox("NUMBER OF ISOCURVES",20,"ISOACTION") intDiv2 = rs.RealBox("NUMBER OF ISOCURVE DIVISION",60,"ISOACTION") intHeight = rs.RealBox("Max Z Height in Inches for the mill Pattern",1,"HEIGHT") # intWidth = rs.RealBox("Shift in Inches for the mill Pattern",1,"WIDTH") intBitDia = rs.RealBox("Bit Diameter",1,"BIT SIZE") intStepOver = rs.RealBox("StepOver",0.25,"STEPOVER") intDivLen = intBitDia-intStepOver arrSrfPts = rs.SurfacePoints(baseSrf,True) arrSrfPts = rs.SurfacePoints(baseSrf,True) rs.AddPoint(arrSrfPts[1]) tempLine = rs.AddLine(arrSrfPts[0],arrSrfPts[1]) tempLine2 = rs.AddLine(arrSrfPts[2],arrSrfPts[3]) tempDiv = rs.DivideCurveLength(tempLine,intDivLen,False) rs.ObjectLayer(tempLine,strNewLayer2) tempDiv2 = rs.DivideCurveLength(tempLine2,intDivLen,False) rs.ObjectLayer(tempLine2,strNewLayer2) rs.EnableRedraw(False) newCalcLine = [] for i in range(len(tempDiv)): newLine = rs.AddLine(tempDiv[i],tempDiv2[i]) rs.ObjectLayer(newLine,strNewLayer2) newLineDiv = rs.DivideCurve(newLine,intDiv2,False) arrbuildPts = [] for j in range(len(newLineDiv)): closestPt = rs.PointArrayClosestPoint(arrVerts,newLineDiv[j]) #meshClosest = rs.MeshClosestPoint(paintMesh,newLineDiv[j]) arrHLS = rs.ColorRGBToHLS(color[closestPt]) value = arrHLS[2] valueZ = value * intHeight valueY = value * intDivLen arrNewPoint = [newLineDiv[j][0],newLineDiv[j][1]+valueY,newLineDiv[j][2]+valueZ] arrbuildPts.append(arrNewPoint) newCalcLine.append(rs.AddCurve(arrbuildPts,3)) lineHanzSolo(newCalcLine,strNewLayer) rs.LayerVisible(strNewLayer2,False) #rs.LayerVisible("PAINTMESH",False) rs.LayerVisible("BASE_SURFACE",False) rs.EnableRedraw(True) Main()