[M]iller Time

Gallery details

miller.time [2.Sep.2012] – Python & Grasshopper
“”” Creates a custom mill pattern based from an ice cream paint job. Input is a flat surface and a painted mesh. Process will create variation in x,y,z as well as take into account bit depth and diameter. The output will be ONE closed curve w. stepover and a surface created based on the NEW paths.”””
[GHop Version]
[PDT]Paint Drive Toolpaths Python Version

CODE

```"""
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:
rs.ObjectLayer(dot,strNewLayer)
rs.ObjectLayer(newLine,strNewLayer)
else:
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)
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)):
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)
lineHanzSolo(newCalcLine,strNewLayer)
rs.LayerVisible(strNewLayer2,False)
#rs.LayerVisible("PAINTMESH",False)
rs.LayerVisible("BASE_SURFACE",False)
rs.EnableRedraw(True)
Main()           ```

• Share