Function SurfEvaluate Dim SurfObject: SurfObject = Rhino.GetObject("Select a surface",8) 'prompt the user to select a surface for the function dim i dim UvalOne(1), UvalTwo dim SurfaceUone, SurfaceVone dim PointOne, PointTwo dim Pt1, Pt2, Pt3, Pt4 dim NumVarU: NumVarU = 5 dim NumVarV: NumVarV = 7 dim FourPtCluster: FourPtCluster=Array(Pt1,Pt2,Pt3,Pt4) redim Matrix (NumVarU, NumVarV) dim tempPt SurfaceUone = array (0,0) SurfaceVone = array (0,0) 'test to be sure it is a surface, then find the domain in U and V If Rhino.IsSurface(SurfObject) Then SurfaceUone = Rhino.SurfaceDomain(SurfObject, 0) SurfaceVone = Rhino.SurfaceDomain(SurfObject, 1) 'Rhino.Print "Domain in U direction: " & CStr(SurfaceUone(0)) & " to " & CStr(SurfaceUone(1)) 'Rhino.Print "Domain in V direction: " & CStr(SurfaceVOne(0)) & " to " & CStr(SurfaceVOne(1)) End If 'create a 2-D array called Matrix to hold all the points along the surface 'the variables NumVarU and NumVarV determine the number of segments the 'surface will be divided into in each direction for i=0 to NumVarU for j=0 to NumVarV UvalOne(0)=((SurfaceUone(1)-SurfaceUone(0))/NumVarU)*(i) UvalOne(1)=((SurfaceVone(1)-SurfaceVone(0))/NumVarV)*(j) PointOne=Rhino.EvaluateSurface(SurfObject,UvalOne) tempPt = Rhino.addpoint(PointOne) 'creates points to mark the divisions Matrix(i,j) = PointOne 'creates a "master" array which will pass points to another function next next for i=0 to NumVarU-1 for j=0 to NumVarV-1 Pt1 = matrix(i,j) Pt2 = matrix(i+1,j) Pt3 = matrix(i+1,j+1) Pt4 = matrix(i,j+1) call XGrid(Pt1,Pt2,Pt3,Pt4) next next end function function XGrid(Pt1,Pt2,Pt3,Pt4) 'this function uses the pipe comand to connect four points with a solid 'perimeter and cross bracing dim linonetwo, lintwothre, linthrefour, linfourone, linonethre, lintwofour 'draw lines connecting all the points linonetwo = Rhino.AddLine (Pt1, Pt2) lintwothre = Rhino.AddLine (Pt2, Pt3) linthrefour = Rhino.AddLine (Pt3, Pt4) linfourone = Rhino.AddLine (Pt4, Pt1) linonethre = Rhino.AddLine (Pt1, Pt3) lintwofour = Rhino.AddLine (Pt2, Pt4) 'create pipes running along each of the lines Rhino.SelectObject (linonetwo) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects Rhino.SelectObject (lintwothre) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects Rhino.SelectObject (linthrefour) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects Rhino.SelectObject (linfourone) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects Rhino.SelectObject (linonethre) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects Rhino.SelectObject (lintwofour) Rhino.Command "pipe "&".1 "&".1 "&" " Rhino.UnselectAllObjects End function call SurfEvaluate