标题: 在學習 rhino script 的中的一問題~ [打印本页] 作者: agpig 时间: 2010-9-21 20:30 标题: 在學習 rhino script 的中的一問題~ 我在讀 rhinoscript 的handout 他里面有一個script 是這樣的
Sub Main()
Dim blnResult
blnResult = DisplayCopyRightMessage("Reinier and Carl", vbTURE)
End Sub
Function DisplayCopyrightMessage(strNames, blnUseCommandLine)
Dim strMessage
strMessage = "This script was written and is copyrighted by " & _
strNames & "." & vbNewLine & _
"You are allowed to use and modify this code " & _
"provided you do not remove copyright."
If blnUseCommandLine Then
Rhino.Print strMessage
Else
Rhino.MessageBox strMessage, 64, "copyright notice"
End If
Function AddCirclesAroundCurve(strCurveID)
Dim i, crvDomain, divDomain
Dim vecTan 'Tangent vector
Dim dblRadius
crvDomain = Rhino.CurveDomain(strCurveID) 'The domain bounds
divDomain = crvDomain(1)-crvDomain(0) 'The domain size
For i = crvDomain(0) To crvDomain(1) Step divDomain/100
vecTan = Rhino.CurveTangent(strCurveID, i)
dblRadius = Sin(i*10) + 2
Rhino.AddCircle vecTan(0), dblRadius, vecTan(1)
Next
AddCirclesAroundCurve = vbTrue
End Function
我想請教一下 這句 在 Function AddCirclesAroundCurve(strCurveID) 里是沒有 BLN值的但為什麼 又會 給它一個 VBTRUE 的值呢~~作者: agpig 时间: 2010-9-27 16:36
1 Function PullCurveToSurface(strSurfaceID, strCurveID)
2 Dim arrCP, arrKnots, arrWeights
3 Dim intDegree, i
4 Dim arrNewPt, strNewID
56
arrCP = Rhino.CurvePoints(strCurveID)
7 arrKnots = Rhino.CurveKnots(strCurveID)
8 arrWeights = Rhino.CurveWeights(strCurveID)
9 intDegree = Rhino.CurveDegree(strCurveID)
10
11 For i = 0 To UBound(arrCP)
12 arrNewPt = Rhino.BrepClosestPoint(strSurfaceID, arrCP(i))
13 arrCP(i) = arrNewPt(0)
14 Next
15
16 strNewID = Rhino.AddNurbsCurve(arrCP, arrKnots, _
17 intDegree, arrWeights)
18 Rhino.DeleteObject strCurveID
19
20 PullCurveToSurface = strNewID
21 End Function
Line 6-9: Extract all required properties from the existing curve
Line 12: Find the closest point on the surface for every control point
Line 13: Replace the coordinates of the control point with the coordinates of the
closest point
Line 16: Create a new curve from the adjusted data
Line 20: Set the function return value to match the identifier of the new curve object