Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 42 lines (33 sloc) 1.115 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' BorderLengthToClipboard.rvb -- September 2008
' If this code works, it was written by Mary Fugier.
' If not, I don't know who wrote it.
' Works with Rhino 4.0.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

Sub BorderLengthToClipboard()
  
  ' Declare local variables
  Dim obj, borders, crv, sum, length
  
  ' Pick object
  obj = Rhino.GetObject("Select surface or polysurface", 24)
  If IsNull(obj) Then Exit Sub

  ' Try to duplicate border
  borders = Rhino.DuplicateSurfaceBorder(obj)
  If IsNull(borders) Then
    Call Rhino.Print("Unable to duplicate surface border.")
    Exit Sub
  End If
  
  ' Sum up border curves
  sum = 0
  For Each crv In borders
    length = Rhino.CurveLength(crv)
    sum = sum + length
  Next
  
  ' Delete border curves
  Call Rhino.DeleteObjects(borders)
  
  ' Copy sum to clipboard
  Call Rhino.ClipboardText(CStr(sum))
  
  ' Optional - popup sum
  ' Call MsgBox("Sum = " & CStr(sum))
  ' Call Rhino.Print("Sum = " & CStr(sum))
  
End Sub
Something went wrong with that request. Please try again.