January 30, 2009

just finished - Dubai Competition_#02

1

1

after half a year's running
finally we finished the Dubai Competition
from design, scripting, modeling, to rendering and layout
here's some shot of the layout
i've no idea if there will come any result for the competition it's self
opposite with more than 4000 competitor
but really
i got a lot in the progress

January 5, 2009

happY neW yeaR ! - a basic rhino script tutorial - with code & files

hey every body
happy new year to all


it's a script with fuction :
"isPointInSurfaces(arrStrObject, arrPoint)"
"randRange(min, max)"
the aim is generate random position points in a certain cage made of several closed polysurfaces

here's the video tutorial:



here's the code:

Option Explicit
'Script written by popabczhang
'Script copyrighted by popabczhang
'Script version 2008-12-31 17:34:50

Dim i,j
Dim xx:xx=0
Dim yy:yy=1
Dim zz:zz=2

Call happYneWyeaR()

Sub happYneWyeaR()
Dim i
Dim arrTmpPt(2)

Dim arrPts()
i=0
Do While i <= 2999

Randomize
arrTmpPt(xx) = randRange(0,700*100)/100
arrTmpPt(yy) = randRange(0,90*100)/100
arrTmpPt(zz) = randRange(0,1*100)/100
If isPointInSurfaces(Rhino.ObjectsByName("cage"),arrTmpPt) Then
ReDim Preserve arrPts(i)
arrPts(i) = arrTmpPt
rhino.AddPoint arrTmpPt
rhino.Print "point(" & i & ")"

i = i+1
End If
Loop
End Sub

Function isPointInSurfaces(arrStrObject, arrPoint)
Dim blnTemp:blnTemp = False
For i = 0 To UBound(arrStrObject)
If Rhino.IsPointInSurface(arrStrObject(i), arrPoint) Then
blnTemp = True
End If
Next
isPointInSurfaces = blnTemp
End Function

Function randRange(min, max)
Randomize
randRange = min+rhino.Floor(Rnd*(max-min))
End Function

here's the files ( 3dm & rvb ) :
http://popabczhang.googlepages.com/happY_neW_yeaR.zip