AN_Skin modifier

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archiologics
‘Script version Thursday, November 20, 2008 1:10:35 AM

Call Main()
Sub Main()
 Dim line
 Dim strtPt
 Dim endPt
 Dim arrEditPts
 
 Dim arrLines : arrLines = Rhino.GetObjects (“lines”,4)
 Dim scalefactor
 Rhino.EnableRedraw False
 For Each line In arrLines
  strtPt = Rhino.CurveStartPoint(line)
  endPt = Rhino.CurveEndPoint(line)
  scalefactor = -0.35*ArbitraryValue(1,1.3)
  
  Dim h : h = Rhino.CurveLength (line)
  ‘Rhino.Print h
  ‘strtPt(0) = strtPt(0)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  ‘strtPt(1) = strtPt(1)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  strtPt(2) = strtPt(2) + h*scalefactor
  ‘endPt(0) = endPt(0)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  ‘endPt(1) = endPt(1)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  endPt(2) = endPt(2) + h*scalefactor
  
  arrEditPts = Rhino.CurveEditPoints(line)
  arrEditPts(0) = strtPt
  arrEditPts(Ubound(arrEditPts)) = endPt

  Rhino.DeleteObject(line)
  Rhino.AddInterpCurve(arrEditPts)
 Next
 Rhino.EnableRedraw True
End Sub
Function arbitraryValue(min, max)
 Randomize
 arbitraryValue = min + (max – min) * Rnd
End Function

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s