top of page
  • Writer's pictureDavid Mans

Blend Tool 3d

💻 Rhino 5

🔼 Rhino Script

🛠️ Visual Basic


Similar to Adobe Illustrators 2d curve blend, this tool takes a series of curves and creates interpolated steps between them.

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) 
        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 
        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)) 
    '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)) 
    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) 
        arrCtrlCrv(i) = Rhino.AddInterpCurve(arrPts, dblSmoothness) 
        arrCrvDom(i) = Rhino.CurveDomain(arrCtrlCrv(i)) 
        arrCrvStep(i) = (arrCrvDom(i)(1) - arrCrvDom(i)(0)) / (count * dblDensity) 
    '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)) 
        arrBlendCurve(i) = Rhino.addcurve(arrBlndCrvPt, dMax) 
    'delete control curves 
    Call Rhino.DeleteObjects(arrCtrlCrv) 
    Call Rhino.DeleteObjects(arrCurves) BlendCurves = array(arrBlendCurve, arrCtrlCrv) 
End Function


Recent Posts

See All


bottom of page