2009年2月14日 星期六

Rhino Script Excise07



Call Main()
Sub Main()
Dim strSurfaceID
strSurfaceID = Rhino.GetObject("Select a surface to sample", 8, True)
If IsNull(strSurfaceID) Then Exit Sub

Dim strCurveID
strCurveID = Rhino.GetObject("Select a curve to measure", 4, True, True)
If IsNull(strCurveID) Then Exit Sub

Dim arrPts : arrPts = Rhino.DivideCurve(strCurveID, 500)
Dim i

Call Rhino.EnableRedraw(False)
For i = 0 To UBound(arrPts)
Call EvaluateDeviation(strSurfaceID, 5.0, arrPts(i))
Next
Call Rhino.EnableRedraw(True)
End Sub

Function EvaluateDeviation(strSurfaceID, dblThreshold, arrSample)
EvaluateDeviation = Null

Dim arrR2Point
arrR2Point = Rhino.SurfaceClosestPoint(strSurfaceID, arrSample)
If IsNull(arrR2Point) Then Exit Function

Dim arrR3Point : arrR3Point =Rhino.EvaluateSurface(strSurfaceID, arrR2Point)
If IsNull(arrR3Point) Then Exit Function

Dim dblDeviation : dblDeviation = Rhino.Distance(arrR3Point, arrSample)
If dblDeviation <= dblThreshold Then
EvaluateDeviation = True
Exit Function
End If

Call Rhino.AddPoint(arrSample)
Call Rhino.AddLine(arrSample, arrR3Point)
EvaluateDeviation = False
End Function

1 則留言:

vdiegm@gmail.com 提到...

您好 本搜尋著rhino sript無意間發現這邊
我已畢業於建築系兩三年了
日前對於已scipt或說programming這樣的操作方式很感興趣 想多方了解一下

粗略瀏覽過您的blog 冒昧請問您是這本活潑建築的作者嗎?
當初在誠品看到此書以為又是打著"數位建築"旗幟的書籍
(這樣講實在有點失禮 但敝以為數位建築這詞在台灣實在被過度浮濫使用了
甚至連定義都曖昧不明 也許那些作者根本也不清楚)
於是也無意留意了
但最近幾天讀了此blog 發現原來此書想講的事情跟我當初以為的是完全不同的
於是匆匆又跑去誠品 結果服務員說此書在全省分店都沒有了 已經絕版
各網路書店也都沒庫存了
只能用悔不當初來形容啊!
簡直跟當初想找後設空間時一樣的窘境

所以冒昧的向您請教一下關於programming
方面甚至於script本身的操作概念
除了這本絕版書之外 有什麼另外的管道或平台可以獲得更多的資訊呢?

因為一直找不到e-mail這樣的聯絡方式
所以在此直接留言 打擾您