Sub surfstars(strsurf,upar,vpar)
upar = upar*5
vpar = vpar*5
Dim dblheight : dblheight = rhino.getreal("extrusion height?" ,.05)
If isnull (dblheight) Then Exit Sub
Dim attrpoint : attrpoint = rhino.getobject("point attractor",1)
Dim arrpoint : arrpoint = rhino.PointCoordinates(attrpoint)
Call rhino.enableredraw(False)
Dim i, j
Dim uvalone(1), uvaltwo
Dim arrUone, arrVone
Dim arrpttemp, pointtwo
Dim pt1, pt2, pt3, pt4, pt5, pt6, PT7, Pt8, pt5b, pt6b, pt7b, pt8b, ptc1, ptc2
ReDim matrix (upar, vpar)
Dim tempt
arruone = array (0,0)
arrVone = array (0,0)
Dim strcell, arrct, arrptsurf, arrnorm, arrnormend,arrnormenddown, arrline, strcell2
If rhino.IsSurface(strsurf) Then
arruone = rhino.surfacedomain(strsurf,0)
arrVone = rhino.surfacedomain(strsurf,1)
End If
For i=0 To upar
For j=0 To vpar
uvalone(0)= ((arruone(1)-arruone(0))/upar)*i
uvalone(1) = ((arrVone(1)-arrVone(0))/vpar)*j
arrpttemp = rhino.EvaluateSurface(strsurf,uvalone)
matrix(i,j) = arrpttemp
Next
Next
Dim oct1, oct2, oct3, oct4, arrlinehuge, arrel1, arrel2
Dim rn, crvtemp, dbldist
For i = 1 To upar-1
For J=0 To vpar-1
pt1 = matrix(i,j)
pt2 = matrix(i+1,j)
pt3 = matrix(i,j+1)
pt4 = matrix(i+1,j+1)
pt5 = array( (pt1(0)+pt2(0))/2,(pt1(1)+pt2(1))/2,(pt1(2)+pt2(2))/2)
pt6 = array( (pt2(0)+pt4(0))/2,(pt2(1)+pt4(1))/2,(pt2(2)+pt4(2))/2)
pt7 = array( (pt3(0)+pt4(0))/2,(pt3(1)+pt4(1))/2,(pt3(2)+pt4(2))/2)
pt8 = array( (pt1(0)+pt3(0))/2,(pt1(1)+pt3(1))/2,(pt1(2)+pt3(2))/2)
ptc1 = array( (pt5(0)+pt7(0))/2,(pt5(1)+pt7(1))/2,(pt5(2)+pt7(2))/2)
ptc2 = array( (pt6(0)+pt8(0))/2,(pt6(1)+pt8(1))/2,(pt6(2)+pt8(2))/2)
dbldist = rhino.Distance(ptc1,arrpoint)
dbldist = Rhino.Log10 (dbldist*7)
If dbldist<1.1 dbldist="">
pt5b = array( pt5(0)+(ptc1(0)-pt5(0))/(dbldist),pt5(1)+(ptc1(1)-pt5(1))/(dbldist),pt5(2)+(ptc1(2)-pt5(2))/(dbldist))
pt6b = array( pt6(0)+(ptc2(0)-pt6(0))/(dbldist),pt6(1)+(ptc2(1)-pt6(1))/(dbldist),pt6(2)+(ptc2(2)-pt6(2))/(dbldist))
pt7b = array( pt7(0)+(ptc1(0)-pt7(0))/(dbldist),pt7(1)+(ptc1(1)-pt7(1))/(dbldist),pt7(2)+(ptc1(2)-pt7(2))/(dbldist))
pt8b = array( pt8(0)+(ptc2(0)-pt8(0))/(dbldist),pt8(1)+(ptc2(1)-pt8(1))/(dbldist),pt8(2)+(ptc2(2)-pt8(2))/(dbldist))
Call rhino.AddCurve(array(pt1,pt2,pt4,pt3,pt1),1)
strcell = rhino.addcurve(array(pt1,,pt5b, pt2,pt6b, pt4, pt7b,pt3,pt8b,pt1),1)
arrct = array( (pt4(0)+pt1(0))/2,(pt4(1)+pt1(1))/2,(pt4(2)+pt1(2))/2)
arrptsurf = rhino.SurfaceClosestPoint(strsurf,arrct)
arrnorm = rhino.SurfaceNormal(strsurf,arrptsurf)
arrnorm = rhino.VectorScale(arrnorm, dblheight)
arrnormend = rhino.PointAdd(arrct,arrnorm)
arrnormenddown = rhino.Pointsubtract(arrct,arrnorm)
crvtemp = rhino.AddSrfPt(array(pt1,arrnormend,pt5b))
crvtemp = rhino.AddSrfPt(array(pt5b,arrnormend,pt2))
crvtemp = rhino.AddSrfPt(array(pt2,arrnormend,pt6b))
crvtemp = rhino.AddSrfPt(array(pt6b,arrnormend,pt4))
crvtemp = rhino.AddSrfPt(array(pt4,arrnormend,pt7b))
crvtemp = rhino.AddSrfPt(array(pt7b,arrnormend,pt3))
crvtemp = rhino.AddSrfPt(array(pt3,arrnormend,pt8b))
crvtemp = rhino.AddSrfPt(array(pt8b,arrnormend,pt1))
crvtemp = rhino.AddSrfPt(array(pt1,arrnormenddown,pt5b))
crvtemp = rhino.AddSrfPt(array(pt5b,arrnormenddown,pt2))
crvtemp = rhino.AddSrfPt(array(pt2,arrnormenddown,pt6b))
crvtemp = rhino.AddSrfPt(array(pt6b,arrnormenddown,pt4))
crvtemp = rhino.AddSrfPt(array(pt4,arrnormenddown,pt7b))
crvtemp = rhino.AddSrfPt(array(pt7b,arrnormenddown,pt3))
crvtemp = rhino.AddSrfPt(array(pt3,arrnormenddown,pt8b))
crvtemp = rhino.AddSrfPt(array(pt8b,arrnormenddown,pt1))
arrline = rhino.AddLine(pt1,pt2)
Call rhino.selectobject (arrline)
rhino.Command "_pipe " & ".02 " & ".02 " & " _enter " & " _enter "
rhino.UnselectAllObjects
arrline = rhino.AddLine(pt3,pt4)
Call rhino.selectobject (arrline)
rhino.Command "_pipe " & ".02 " & ".02 " & " _enter " & " _enter "
rhino.UnselectAllObjects
Next
Next
Call rhino.deleteobject(strsurf)
Call rhino.EnableRedraw(True)
End Sub