自己也刚开始学
好多地方,慢慢才弄明白,加了些注释,希望大家能更理解作者: 张大千 时间: 2010-8-15 16:39
Call Main()
Sub Main()
Rhino.AddLayer "black",RGB(0,0,0) 'define a New layer
Dim headPt,endPt : endPt = Array (0,0,0)
'define begining point and terminal point
'pre-define the coordinate of the endPoint as the Looping beginning Point
Dim StrLine
Dim r,g,b : r=0 : g=0 : b=0 'define the RGB colour Value
Dim count : count = 0 'define the looping counter
Const EDGELEN = 500 'Define the Length of Line
Do
headPt = endPt 'evaluate the coordinate to headpoint
endPt = getPt (EDGELEN) 'call the subroutine,get a random point
strLine = Rhino.AddLine(headPt,endPt) 'create a line
Rhino.ObjectLayer strLine ,"black" 'set the Layer of Line
Rhino.ObjectColor strLine ,RGB(r,g,b) 'set the color of Line, 1st is whight
r = r + 1 'shift the R color ,step-Len is 1
If r >= 255 Then
r = 0
End If
b = b + 2 'shift the B color ,step-Len is 2
If b >= 255 Then
b = 0
End If
g = g + 3 'shift the G color ,step-Len is 3
If g >= 255 Then
g = 0
End If
'此处将RGB的步长调整为不同,这样就可以生成彩色的线了
count = count + 1 'The looping step
If count > 5000 Then Exit Do ' The looping Judge term
Loop
End Sub
Function getPt (EDGELEN) 'subroutine
Dim randomNum : randomNum = Int(Rnd()*6) 'generate a random number 0~6
Select Case randomNum 'condition Judgement
Case 0
getPt = Array(Int(Rnd() * EDGELEN), Int(Rnd() * EDGELEN), 0)
' get a point on x-y plane
Case 1
getPt = Array(0, Int(Rnd() * EDGELEN), Int(Rnd() * EDGELEN))
' get a point on y-z plane
Case 2
getPt = Array(Int(Rnd() * EDGELEN), 0, Int(Rnd() * EDGELEN))
' get a point on x-z plane
Case 3
getPt = Array(Int(Rnd() * EDGELEN), Int(Rnd() * EDGELEN), EDGELEN)
' get a point on plane which parallel to x-y plane with 500 distance
Case 4
getPt = Array(Int(Rnd() * EDGELEN), EDGELEN, Int(Rnd() * EDGELEN))
' get a point on plane which parallel to x-z plane with 500 distance
Case 5
getPt = Array(EDGELEN, Int(Rnd() * EDGELEN), Int(Rnd()* EDGELEN))
' get a point on plane which parallel to y-z plane with 500 distance
Case Else
rhino.Print "else"
End Select
End Function作者: 张大千 时间: 2010-8-15 16:40
非常希望高人能指出注释中的不妥! 万分感谢!作者: wangxudong 时间: 2010-9-7 14:28
dfghdfghdfghgfh作者: shackman 时间: 2010-9-11 12:20
支持一下!!!作者: 点点唇绛 时间: 2010-9-12 04:42
学习 。作者: 点点唇绛 时间: 2010-9-12 04:43
学习 。作者: mengcheng41 时间: 2010-9-13 21:54
好东西!!作者: dumingf 时间: 2010-9-15 21:13
太有意思了~~~作者: PARADAN 时间: 2010-9-28 09:54
菜鸟学习了。。。作者: opiaoyi 时间: 2010-10-2 16:23
看看看看看看看看看看看看看看看看看看作者: Pisces 时间: 2010-10-7 00:29
现在还看不懂,马上学习啊 谢谢分享作者: 顾顾 时间: 2010-10-18 19:17
再次赞叹下·~~~~~{:3_46:}作者: agpig 时间: 2010-10-22 14:09
支持實例 教學~~~
狂頂~~作者: 岁月静好 时间: 2010-11-20 20:15
谢谢指导 学习了作者: Pinturicchio 时间: 2010-11-23 02:34
very good.it's ok作者: uekiii 时间: 2010-11-27 18:04
很好,支持楼主作者: huangchang0528 时间: 2010-12-11 14:16
教程不错~~作者: 05310130 时间: 2010-12-21 00:09
不错不错!!作者: yuerxian 时间: 2010-12-28 12:02
楼主这个和grasshopper那个更适合入门的小学生学习呢。。。谢谢啊作者: liguorui 时间: 2011-1-1 23:03
第一接触Rhino,好有吸引力啊作者: 关典为 时间: 2011-1-4 16:21
这个script 很清晰,很好作者: 110573845 时间: 2011-1-18 19:42
是这段代码让我第一次看懂了犀牛里的代码作者: LAVAHA 时间: 2011-1-28 23:21
很有意思的盒子。。。作者: 1127463392 时间: 2011-2-24 19:42
{:3_62:}牛作者: bxsqrym 时间: 2011-4-2 11:44
非常感謝你的教學