2010年7月12日 星期一

HoneyComb_Wall x Michael Wazowski (Rhinoscript)


Video Inside



video
Start

video
End

利用Rhinoscript蜂巢狀之格狀系統
投影至Nurbs曲面上
再將投影後之線與風潮格狀做LOFT曲面
Use RhinoScript to make the HoneyComb Grid
and project the Grid onto the Nurbs
then loft the Grid on the Nurbs and the HoneyComb Grid
to have this waving honeycomb wall


程式中
polygonarray副程式利用For Loop繪製格狀
polygon副程式則繪製六角形並投射至NURBS面上
 並做LOFT動作
In the program
Sub polygonarray used "for loop" to draw the grid
and Sub polygon draw the hexagons and project them to the NURBS
then LOFT them

程式執行時會請你選擇要投影之面
選完即會執行程式
The program will ask you to choose the Surface
you want to project
after that, it will start to run the program 


程式如下:
Program:

Sub Polygon(x,y,r,strSurface)
Dim a,b,c,d,e,f,arrPts, arrPolyline, arrSrf
a= Array(x+(r*Sin((60/360)*pi)),y+(r*Cos((60/360)*pi)),0)
b= Array(x+r,y+0,0)
c= Array(x+(r*Sin((60/360)*pi)),y-(r*Cos((60/360)*pi)),0)
d= Array(x-(r*Sin((60/360)*pi)), y-(r*Cos((60/360)*pi)),0)
e= Array(x-r,y+0,0)
f= Array(x-(r*Sin((60/360)*pi)), y+(r*Cos((60/360)*pi)),0)
arrPts= Array(a,b,c,d,e,f,a)'six points of the hexagon

arrPolyline=Rhino.AddPolyline(arrPts) 'draw hexagon


Dim arrResults
arrResults = Rhino.ProjectCurveToSurface(arrPolyline, strSurface, Array(0,0,-1)) 'project


Dim strcmd1
strcmd1 = "-Loft " & "Selcrv Enter Enter type=uniform Enter"
Rhino.Command strcmd1 'Doing Lofting 


Dim strcmd2
strcmd2 = "selcrv delete"
Rhino.Command strcmd2 'Doing Deleting
 End Sub

Sub polygonarray
Dim strSurface
strSurface = Rhino.GetObject("Select surface to project onto")
'choose the surface you want to project

Dim r:r =10
For i=0 To 40 Step 1
For j=0 To 15 Step 1
If i Mod 2 =0 Then
Polygon i*r*((Sin((60/360)*pi))+1),j*r*2*(Cos((60/360)*pi)),r,strSurface
Else Polygon i*r*((Sin((60/360)*pi))+1),r*(Cos((60/360)*pi))+j*r*2*(Cos((60/360)*pi)),r,strSurface
End If
Next
Next 'draw the grid 
End Sub

polygonarray 






沒有留言:

張貼留言