Option Explicit 'declare variables Dim i,j,k,size,d,n,m 'define unit length=d (edgelength= 6*d) d = Rhino.Getreal("Enter the edge length") d=d/6 'declare array for point grid, n is the number of units n = Rhino.Getinteger("Enter number of units in x direction") n=n+1 m = Rhino.Getinteger("Enter number of units in y direction") 'm=6 ReDim points (6*n,3*m) Dim p1,p2,p3,p4,p5,p6,p7,p8,p9,p10 'Create points For i=0 To 6*n For j=0 To 3*m points(i,j) =Array(i*d,j*d*Sqr(3)) 'Rhino.addpoint(Array(i*d,j*d*Sqr(3))) Next Next 'create triangles For i=0 To n-1 For j=0 To m-1 If j Mod 2 = 0 Then p1=points((6*i),3*j) p2=points((6*i)+2,3*j) p3=points((6*i)+6,3*j) p4=points((6*i)+5,(3*j)+1) p5=points((6*i)+2,(3*j)+2) p6=points((6*i)+4,(3*j)+2) p7=points((6*i)+3,(3*j)+3) p8=points((6*i)+8,(3*j)+2) p9=points((6*i)+5,(3*j)+3) p10=points((6*i)+9,(3*j)+3) Else p1=points((6*i)+3,3*j) p2=points((6*i)+5,3*j) p3=points((6*i)+9,3*j) p4=points((6*i)+8,(3*j)+1) p5=points((6*i)+5,(3*j)+2) p6=points((6*i)+7,(3*j)+2) p7=points((6*i)+6,(3*j)+3) p8=points((6*i)+11,(3*j)+2) p9=points((6*i)+8,(3*j)+3) p10=points((6*i)+12,(3*j)+3) End If Rhino.CurrentLayer("Layer 01") Call Rhino.AddSrfPt (Array(p1,p2,p5)) 'Call Rhino.addline(p1,p2) 'Call Rhino.addline(p2,p5) 'Call Rhino.addline(p5,p1) Call Rhino.AddSrfPt (Array(p2,p3,p4)) 'Call Rhino.addline(p2,p3) 'Call Rhino.addline(p3,p4) 'Call Rhino.addline(p4,p2) Call Rhino.AddSrfPt (Array(p4,p7,p5)) 'Call Rhino.addline(p4,p7) 'Call Rhino.addline(p7,p5) 'Call Rhino.addline(p5,p4) Call Rhino.AddSrfPt (Array(p3,p4,p8)) Call Rhino.AddSrfPt (Array(p8,p9,p10)) Call Rhino.AddSrfPt (Array(p4,p7,p9)) Rhino.CurrentLayer("Layer 04") Call Rhino.AddSrfPt (Array(p4,p2,p5)) Call Rhino.AddSrfPt (Array(p4,p8,p9)) 'Call Rhino.addline(p2,p4) 'Call Rhino.addline(p4,p5) 'Call Rhino.addline(p5,p2) Next Next 'Call unittriangle(p1,p2,p3,p4,p5,p6,p7) 'Function unittriangle(p1,p2,p3,p4,p5,p6,p7) 'trianglepoints=(p1,p2,p3,p4,p5,p6,p7) 'End Function