다음 스크립트는 GDI bitmap extension인 RhPicture를 사용하기에 설치되어있어야 사용가능하다. http://wiki.mcneel.com/developer/rhinoscriptimageextension 그리고 LineCurveIntersection method를 사용하기에 라이노 V5에서 사용할 수 있다. V4용으로는 일부 수정이 필요하다.Option explicit
Call Main()
Sub Main()
Dim strCrv
strCrv = Rhino.GetObject("Select a gradient curve", 4, True)
If isNull(strCrv) Then Exit Sub
Dim arrFace(0), arrVertices(3)
Dim i, x, arrLine, arrCX, arrP, lngColor, H, arrC, j
Dim RhPicture
Set RhPicture = Rhino.GetPluginObject("RhPicture")
Call RhPicture.CreateImage(200, 255, vbWhite)
For i=0 To 255
x = i / 25.5
arrLine = array(array(x, 0, 0), array(x, 10, 0))
arrCX = Rhino.LineCurveIntersection(arrLine, strCrv)
If isArray(arrCX) Then
arrP = arrCX(0, 1)
H = round(arrP(1) * 25.5)
lngColor = RGB(H, H, H)
For j=0 To 200
Call RhPicture.SetPixel(j, 255 - i, lngColor)
Next
End If
Next
Call RhPicture.ShowImage("Black&White Gradient")
Set RhPicture = Nothing
End Sub
No comments:
Post a Comment