Ever wanted to use the Illustrator blend tool in Rhino, but just too lazy to do all the leg work to simulate it. After all extracting wireframes is so tedious. Well now you may not have to… if it works?
| platform: Rhino Script |
| function: Modeling Aid |
Option Explicit
'Script written by <David Mans>
'Script copyrighted by <NeoArchaic Design>
'Script version Sunday, May 03, 2009 1:54:38 PM
Call Main()
Sub Main()
Dim Curves, SM, DN
Curves= Rhino.GetObjects("Select Curves",4)
If isNull(Curves) Then Exit Sub
SM = Rhino.GetBoolean("Blend Type",array("Type","Straight","Smooth"),array(False))
If isNull(SM) Then Exit Sub
DN = Rhino.GetReal("Blend Density",5,1)
If isNull(SM) Then Exit Sub
Call Rhino.EnableRedraw(False)
If uBound(Curves) > 0 Then
Call BlendCurves(Curves,SM(0),DN)
Else
Call Rhino.Print("2 or more curves required")
End If
Call Rhino.EnableRedraw(True)
End Sub
Function BlendCurves(arrCurves,blnSmooth,dblDensity)
BlendCurves = Null
Dim i,j,p
Dim count, max, dMax
Dim arrptCount(), arrCrvDeg(), arrPointSet(),arrPts(), arrCrvDom(),arrCrvStep(),arrBlndCrvPt()
Dim arrBlendCurve(), arrCtrlCrv()
Dim dblSmoothness
If blnSmooth = False Then
dblSmoothness = 1
Else
dblSmoothness = 3
End If
count = Ubound(arrCurves)
ReDim arrptCount(count), arrCrvDeg(count), arrCrvDom(count), arrPointSet(count), arrPts(count)
'get control point count
For i = 0 To count Step 1
arrptCount(i) = Rhino.CurvePointCount(arrCurves(i))
arrCrvDeg(i) = Rhino.CurveDegree(arrCurves(i))
Next
'determine max point count
max = Rhino.Max(arrptCount)
dMax= Rhino.Max(arrCrvDeg)
'rebuild curves with max control point count
For i = 0 To count Step 1
Call Rhino.RebuildCurve(arrCurves(i),dMax, max)
arrPointSet(i) = Rhino.CurvePoints(arrCurves(i))
Next
max = max-1
ReDim arrCtrlCrv(max), arrCrvDom(max), arrCrvStep(max), arrBlndCrvPt(max)
'create control curves
For i = 0 To max Step 1
For j = 0 To count Step 1
arrPts(j) = arrPointSet(j)(i)
Next
arrCtrlCrv(i)= Rhino.AddInterpCurve(arrPts,dblSmoothness)
arrCrvDom(i) = Rhino.CurveDomain(arrCtrlCrv(i))
arrCrvStep(i)= (arrCrvDom(i)(1)-arrCrvDom(i)(0))/(count*dblDensity)
Next
'create blended curves
ReDim arrBlendCurve(count*dblDensity)
For i = 0 To count*dblDensity Step 1
For j = 0 To max Step 1
arrBlndCrvPt(j) = Rhino.EvaluateCurve(arrCtrlCrv(j),arrCrvDom(j)(0)+i*arrCrvStep(j))
Next
arrBlendCurve(i) = Rhino.addcurve(arrBlndCrvPt,dMax)
Next
'delete control curves
Call Rhino.DeleteObjects(arrCtrlCrv)
Call Rhino.DeleteObjects(arrCurves)
BlendCurves = array(arrBlendCurve,arrCtrlCrv)
End Function




The Penrose (Danah + Steph) « Fabulously Fabricated
[...] Then visit http://neoarchaic.net/2010/03/blend-tool-3d/ [...]
May 31, 2010 @ 2:10 am
The Penrose. Heath Canobie and Sarah Rowley | Fabulously Fabricated
[...] -Download the Blending script – http://neoarchaic.net/2010/03/blend-tool-3d/ [...]
Jul 10, 2010 @ 10:49 pm
Leo
Thanks,
This tool is great! Thanks so much.
Nov 01, 2010 @ 10:16 pm