Cracking

Option Explicit
‘Script written by <Marina Cisneros and Olivera Grk>

‘Script version Friday, 16 October 2009 14:11:31

Call Main()
Sub Main()
 
 Dim polygons
 Dim crack
 Dim i, j
 
 polygons = rhino.GetObjects (“get polygons”,4)
 crack = rhino.getobjects (“sel pts”,1)
 
 crack = rhino.PointCoordinates (crack)
 
 
 For i=0 To ubound(polygons)
  
  Dim vertex
  
  vertex = Rhino.CurvePoints (polygons(i))
  
 
  Dim vector()
  ReDim vector(ubound(crack))
  Dim length
  Dim scale
  Dim totvector
  
  For j=0 To ubound(vertex)
   
   For h=0 To ubound(crack)
 
    vector(h) = rhino.VectorCreate (vertex(j),crack(h))
    totvector = Rhino.VectorAdd (totvector, vector(h))
    length = Rhino.VectorLength (totvector)
    totvector = Rhino.VectorUnitize (totvector)
    scale= 100/length
    totvector= Rhino.VectorScale (totvector, scale)
   
   Next
   vertex(j) = rhino.pointadd (vertex(j), totvector)
   
   
  Next
  
  Rhino.Addpolyline vertex
  
 Next

End Sub

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s