Function SurfEvaluate Dim SurfObject: SurfObject = Rhino.GetObject("Select a surface",8) dim i dim UvalOne(1), UvalTwo dim SurfaceUone, SurfaceVone dim PointOne, PointTwo dim Pt1, Pt2, Pt3, Pt4 dim NumVarU: NumVarU = 7 dim NumVarV: NumVarV = 5 dim FourPtCluster: FourPtCluster=Array(Pt1,Pt2,Pt3,Pt4) redim Matrix (NumVarU, NumVarV) dim tempPt SurfaceUone = array (0,0) SurfaceVone = array (0,0) 'select a surface and test to be sure it is a surface 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 'rhino.print Matrix (i,j) 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 Drawbox2(Pt1,Pt2,Pt3,Pt4) next next end function Function Drawbox2(Pt1,Pt2,Pt3,Pt4) dim tempsrf, arrDomainU, arrDomainV, arrDirection dim arrParam(1),arrNormal,LineNormSmall, LineNormBig, Pt5 dim LineP1P4, LineP1P4extend, LineArray dim VertSurface tempsrf = rhino.addsrfpt (Array(pt1,pt2,pt3,pt4)) 'rhino.MoveObject tempsrf,pt1,pt3 arrDomainU = Rhino.SurfaceDomain(tempsrf, 0) arrDomainV = Rhino.SurfaceDomain(tempsrf, 1) arrParam(0) =(arrDomainU(1)-arrDomainU(0))/2 arrParam(1) =(arrDomainV(1)-arrDomainV(0))/2 Pt5 = Rhino.EvaluateSurface(tempsrf, arrParam) Rhino.AddPoint Pt5 arrNormal = Rhino.SurfaceNormal (tempSrf, arrParam) LineNormSmall = Rhino.AddLine (arrNormal(0), arrNormal(1)) LineNormBig = Rhino.ExtendCurveLength (LineNormSmall, 0,1,6*rnd) arrPtDomain = rhino.CurveDomain (LineNormBig) arrPtParam = arrPtDomain (1) Pt6 = Rhino.EvaluateCurve (LineNormBig,ArrPtParam) rhino.addpoint pt6 LineP1P4 = rhino.addline (pt1,pt4) LineP1P2 = rhino.addline (pt1,pt2) LineP1P4Norm = rhino.copyObject (LineP1P4,pt5,pt6) LineP1P4Extend = Rhino.ExtendCurveLength (LineP1P4, 0,1,1) LineP1P2Extend = Rhino.ExtendCurveLength (LineP1P2, 0,1,2) LineArray = (array(LineP1P4Extend,LineP1P4Norm)) VertSurface1 = Rhino.AddEdgeSrf (LineArray) 'creates surface between long line near surface and short line immediately above VertSurface2 = rhino.ExtrudeSurface (VertSurface1,LineP1P2Extend) 'creates a trapezoid using the surface just made, etruded along a long line LineNormHuge = Rhino.ExtendCurveLength (LineNormSmall, 0,1,40) Ellipse1 = rhino.addCurve (Array(Pt1,Pt2,Pt3,Pt4,Pt1)) 'draws a curve, like an elipse, using 4 points rhino.selectobject Ellipse1 rhino.command ("-patch " & "enter") Ellipse2 = rhino.LastObject 'grabs the previously constructed elipse that has just been made into a surface Ellipse3 = rhino.Extrudesurface (Ellipse2,LineNormHuge) 'creates an extruded elipse to be subtracted from VertSurface2 rhino.MoveObject Ellipse3,pt6,pt5 rhino.MoveObject Ellipse3,pt6,pt5 rhino.MoveObject Ellipse3,pt6,pt5 rhino.MoveObject Ellipse3,pt6,pt5 rhino.MoveObject Ellipse3,pt6,pt5 ArrEllipse = (array(Ellipse3)) ArrTrapezoid = (array(VertSurface2)) rhino.BooleanDifference ArrTrapezoid,ArrEllipse rhino.unSelectAllObjects End Function call SurfEvaluate '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'dim strCurve, StrPath 'strCurve = Rhino.AddCircle(Array(0,0,0), 5) 'strPath = Rhino.AddLine(Array(5,0,0), Array(10,0,10)) 'rhino.selectobject strCurve 'rhino.command ("-patch " & "enter")