Sub Main()
Dim idsrf: idsrf = rhino.getobject ("select surface", 8, True, True)
Dim udomain: udomain = rhino.surfacedomain(idsrf, 0)
Dim vdomain: vdomain = rhino.SurfaceDomain(idsrf, 1)
Dim u0: u0 = udomain(0)
Dim u1: u1 = udomain(1)
Dim v0: v0 = vdomain(0)
Dim v1: v1 = vdomain(1)
Dim A: A = rhino.EvaluateSurface(idsrf, array(u0,v0))
Dim B: B = rhino.evaluatesurface(idsrf, array(u1,v0))
Dim C: C = rhino.evaluatesurface(idsrf, array(u1,v1))
Dim D: D = rhino.EvaluateSurface(idsrf, array(u0,v1))
Call recursivetriangle(idsrf, A, B, D)
Call recursivetriangle(idsrf, B, C, D)
End Sub
Function recursivetriangle(ByVal idsrf, ByVal A, ByVal B, ByVal D)
Dim distAB: distAB = rhino.distance(A, B)
Dim distBD: distBD = rhino.Distance(B, D)
Dim distAD: distAD = rhino.Distance(A, D)
Dim arrdist: arrdist = array(distAB, distBD, distAD)
arrdist = rhino.sortnumbers(arrdist,True)
Dim H,K,J
If distAB = arrdist(2) Then
H = A
K = B
J = D
End If
If distBD = arrdist(2) Then
H = B
K = D
J = A
End If
If distAD = arrdist(2) Then
H = A
K = D
J = B
End If
Dim Z(2)
Z(0) = (H(0)+K(0))/2
Z(1) = (H(1)+K(1))/2
Z(2) = (H(2)+K(2))/2
Dim Zuv: Zuv = rhino.surfaceclosestpoint(idsrf, Z)
Dim Zp: Zp = rhino.evaluatesurface (idsrf, Zuv)
Dim distcurv: distcurv = rhino.distance (Zp, Z)
Dim distang: distang = rhino.Distance (H, K)
If (distcurv < 0.9) And (distang< 30) Then
Dim crv0 : crv0 = rhino.addcurve(array(A,B,D,A), 2)
Call rhino.SelectObject(crv0)
Dim pipeRadius1
pipeRadius1=0.9
rhino.Command("_Pipe" & " " & pipeRadius1 & " _Enter _Enter")
Rhino.UnselectAllObjects()
Else
Call recursivetriangle (idsrf, H, J, Zp)
Call recursivetriangle (idsrf, K, J, Zp)
End If
End Function 作者: 流浪中的骑士 时间: 2013-2-22 23:41
顶楼主一个~~~~~~~~~~~~~作者: 夜第七章 时间: 2013-2-23 10:40