Arrows

This rhinoscript, developed for circulation diagrams, converts curves into variable styles of surfaced three-dimensional arrows. The arrows themselves can vary in scale, proportion, angle, and several other parameters.

Rhino Script

```Option Explicit
'Script written by <David Mans>
'Script version Sunday, June 08, 2008 1:19:49 AM

Call Main()
Sub Main()
Dim crv: crv = Rhino.GetObjects("Select Curves", 4)
If isNull(crv) Then Exit Sub
Dim i
Call Rhino.EnableRedraw(False)
For i = 0 To uBound(crv) Step 1
Call reparameterize(crv(i))
Call curveArrows(crv(i), 0.5, 0.95, 90, 1)
Next
Call Rhino.EnableRedraw(True)
End Sub
Function curveArrows(curve, dblScale, tip, headAngle, dblType)
curveArrows = Null
Dim i,j, crv, crvCpy, crvDom, parameter, dis,scale, count, strProfSet
count = 3
ReDim frame(count), pt(count*2+1),crvProfSet(count-1), swProfSet(count-2)
'establish dimensions
crvDom = Rhino.CurveDomain(curve)(1)
parameter = array(0, crvDom * tip, crvDom * tip, crvDom)
dis = Rhino.Distance(Rhino.EvaluateCurve(curve, crvDom * tip), Rhino.EvaluateCurve(curve, crvDom)) * dblScale
If dblType = 1 Then
scale = array(dis * 0.25, dis * 0.25, dis * 0.5, 0)
ElseIf dblType = 2 Then
scale = array(dis * 0.5, dis * 0.25, dis * 0.5, 0)
ElseIf dblType = 3 Then
scale = array(dis * 0.25, dis * 0.5, dis * 0.5, 0)
Else
scale = array(dis * 0.25, dis * 0.25, dis * 0.5, 0)
End If

j = 0
For i = 0 To count Step 1
frame(i) = Rhino.CurveFrame(curve, parameter(i))
j = j + 1

If dblType = 4 Then
pt(j) = frame(i)(0)
Else
End If
j = j + 1
If i < count Then
crvProfSet(i) = Rhino.AddPolyline(array(pt(j - 2), frame(i)(0), pt(j - 1)))
End If
Next

Dim ptB
If dblType = 4 Then
Call Rhino.AddSrfPt(array(frame(3)(0), pt(j - 4), frame(2)(0)))
Else
Call Rhino.AddSrfPt(array(frame(3)(0), pt(j - 4), frame(2)(0)))
Call Rhino.AddSrfPt(array(frame(3)(0), pt(j - 3), frame(2)(0)))
End If
'create surfaces
crvCpy = Rhino.CopyObject(curve)
crv = Rhino.SplitCurve(crvCpy, crvDom * tip, True)
For i = 0 To count - 2 Step 1
swProfSet(i) = ("_SelID " &amp; crvProfSet(i) &amp; " ")
Next
strProfSet = Join(swProfSet)
Call Rhino.Command("-_Sweep1 " &amp; "_SelID " &amp; crv(0) &amp; " " &amp; strProfSet &amp; " _Enter _Enter _Simplify=None Enter")
Call Rhino.DeleteObjects(crvProfSet)
Call Rhino.DeleteObjects(crv)

End Function
Function reparameterize(strCurveID)
If Rhino.IsCurve(strCurveID) = True Then
Call rhino.SelectObject(strCurveID)
Call rhino.Command("reparameterize 0 1")
Call rhino.UnselectAllObjects()
End If
If Rhino.IsSurface(strCurveID) = True Then
Call rhino.SelectObject(strCurveID)
Call rhino.Command("reparameterize 0 1 0 1")
Call rhino.UnselectAllObjects()
End If
End Function```