'' http://www.pdwiki.net/index.php?title=Point_grid_on_surface_by_U.V. Option Explicit Main Sub Main() Dim surface surface = Rhino.GetObject( "Select a surface" ) If IsNull(surface) Then Exit Sub dblTall = Rhino.GetReal("Input a value for the average height of buildings ", 1) If (VarType(dblTall) = vbNull Or (dblTall <= 0.0)) Then Exit Sub Dim U U = Rhino.getinteger( "How Many Points in U Direction?", 30 ) If IsNull(U) Then Exit Sub Dim V V = Rhino.getinteger( "How Many Points in V Direction?", 30 ) If IsNull(V) Then Exit Sub Rhino.EnableRedraw vbFalse Call Rhino.unselectallobjects( ) Call Rhino.selectobject( surface ) Call Rhino.command( "-_reparameterize 0 1 0 1" ) Dim i, j, m, pointArr, uArr, vArr, dblheight, dblTall Dim arrDomV, arrPoint, arrCorn(7), arrParam Dim strCurrent Rhino.Print ("Calculating Points - Please Be Patient . . .") For m = 0 To U - 1 uArr = (m / ( U - 1 )) For j = 0 To V vArr = (j / V) dblHeight = (dblTall *rnd(1)) 'Rhino.print dblHeight arrCorn(0) = Array(-1,-1,0) arrCorn(1) = Array(1,-1,0) arrCorn(2) = Array(1,1,0) arrCorn(3) = Array(-1,1,0) arrCorn(4) = Array(-1,-1,dblHeight) arrCorn(5) = Array(1,-1,dblHeight) arrCorn(6) = Array(1,1,dblHeight) arrCorn(7) = Array(-1,1,dblHeight) arrPoint = Rhino.EvaluateSurface(surface, Array (uArr, vArr)) If IsArray(arrPoint) Then strCurrent = Rhino.AddBox (arrCorn) Rhino.MoveObject strCurrent, (Array(0,0,0)), arrPoint End If Next Next Rhino.EnableRedraw vbTrue Rhino.Print ("Finished with " & CStr(U * V + U) & " Points") End Sub