本帖最后由 metall 于 2012-4-23 17:56 编辑
有点意思,做做玩玩
Option Explicit
Call main()
Sub main()
Dim origin_line:origin_line=Rhino.GetObject("select a line",4)
Dim arrayLines(10)
Dim lines(0)
lines(0)=origin_line
arrayLines(0)=lines
Dim m
Dim j
For j=0 To 9
m=2^j-1
arraylines(j+1)=explode(arrayLines(j),m)
Next
End Sub
Function explode(lines,i)
Dim startpt
Dim endpt
Dim line
Dim m:m=2*i+1
ReDim k(m)
Dim vec
Dim j:j=-1
For Each line In lines
startpt=Rhino.curvestartpoint(line)
endpt=Rhino.curveendpoint(line)
vec=Rhino.VectorCreate(endpt, startpt)
j=j+1
k(j)= Rhino.AddLine(endpt,Rhino.VectorAdd(endpt, Rhino.vectorscale(Rhino.VectorRotate(vec, -45, Array(0,0,1)), 0.6)))
j=j+1
k(j)= Rhino.AddLine(endpt,Rhino.VectorAdd(endpt, Rhino.vectorscale(Rhino.VectorRotate(vec, 45, Array(0,0,1)), 0.6)))
Next
explode=k
End Function |