This script make a drill along the curve you select:
You can also see the 3D model (but first install the viewer)
[link to 3Dmodel dont work. copy this address to your browser address line:
http://laliva.altervista.org/abc/trivela.wrl]
Option Explicit
'written by Luca Nazzari
'Script copyrighted by ©VitrartiV
'Date sabato 7 febbraio 2009 15.37.50
Sub Main()
Dim arrstart, arrend, arrlines, strsrf
Dim i
Dim dblj
Dim intNum
Dim strelica
Dim strline
Call rhino.enableredraw(False)
'input number of points
intNum=Rhino.GetInteger("n. of points?",50,10,200)
if isnull(intnum) then exit sub
ReDim arrstart(intNum-1)
ReDim arrend(intNum-1)
ReDim arrlines(intNum-1)
dblj=0
'start cycle
'it'll make the spiral's suface
For i=0 To UBOUND (arrstart)
arrstart(i)= array(dblj*cos(i),dblj*sin(i),i)
arrend(i)=array(dblj*(-cos(i)),dblj*(-sin(i)),i)
dblj=dblj+((i/(ubound(arrstart)))/4)
Next
'now i'll ask a curve to flow my surface
Dim strl1,strl2
Dim arrl12
Dim strsrfe, strbase, strtarget
Dim arrpi,arrpf
Dim cmd
strl1= rhino.addinterpcurve(arrstart)
strl2= rhino.AddInterpCurve(arrend)
arrl12=array(strl1,strl2)
strsrfe= rhino.AddLoftSrf(arrl12)
strbase=rhino.addline(array(0,0,0),array(0,0,intnum-1))
strtarget=Rhino.GetObject("Target ?")
If isnull (strtarget) Then Exit Sub
Dim dblleng
dblleng=rhino.curvelength(strtarget)
If dblleng
Exit Sub
End If
Rhino.selectobjects strsrfe
cmd="flow selid "&strbase&" selid "&strtarget
Rhino.command cmd
Call rhino.Deleteobject(strl1)
Call rhino.Deleteobject(strl2)
Call rhino.Deleteobject(strbase)
Call rhino.Deleteobjects(strsrfe)
Call rhino.enableredraw(True)
End Sub
Call Main()
Luca,
ReplyDeleteI think you posted just a part of the script. Please edit your post to include all the lines.
Coming to the script, try to improve it by doing it directly on the curve, without first generating the trivela along a straight line.
A.
PS: watch out for the Enableredraw position at the beginning (remember to put it after all input operations or you might experience some screen psychedelic side-effects)
Yes, there was an error in posting images.
ReplyDeleteFixed.
uhm, ok i'll try it.
>>PS:yes, i'll remember it next time