MS-Parabola_V1.0

Option Explicit
‘Script written by <mathew staudt>
‘Script copyrighted by <no>
‘Script version Friday, September 26, 2008 11:55:25 AM

Call Main()
Sub Main()
 Dim objPt1, ObjPt2, arrpt1, arrpt2, d, i, origLine, arrptmid
 Dim xyVect1, xyVect2
 Dim MovinPt1, MovinPt2, ObjDepoPt1, ObjDepoPt2, MovinD1, MovinD2, limit
 Dim ObjDepSphere1, ObjDepSphere2
 
 objpt1= Rhino.GetObject (“Selectpoint 1”, 1)
 objpt2= Rhino.GetObject (“Selectpoint 2”, 1)
 
 arrpt1= Rhino.PointCoordinates (objPt1)
 arrpt2= Rhino.PointCoordinates (objPt2)
 origLine = Rhino.AddLine (arrpt1,arrpt2)
 arrptmid = Rhino.CurveMidPoint (origLine)
 
 
 d= Rhino.Distance (arrpt1, arrpt2)
 ‘d= d/2
 
 MovinPt1 = arrpt1
 MovinPt2 = arrpt2
 
 xyVect1 = Rhino.VectorCreate (arrpt1, arrpt2)
 xyVect1 = Rhino.VectorUnitize (xyVect1)
 xyVect1 = Rhino.VectorScale (xyVect1, .25)
 xyVect2 = Rhino.VectorCreate (arrpt2, arrpt1)
 xyVect2 = Rhino.VectorUnitize (xyVect2)
 xyVect2 = Rhino.VectorScale (xyVect2, .25)
 limit = d*2\1

 For i=0 To limit
  MovinPt1 = Rhino.PointSubtract(MovinPt1, xyVect1)
  MovinPt2 = Rhino.PointSubtract(MovinPt2, xyVect2)
  MovinD1 = Rhino.Distance (MovinPt1, arrptmid)
  MovinD2 = Rhino.Distance (MovinPt2, arrptmid)
  ObjDepoPt1 = Rhino.AddPoint (MovinPt1)
  ObjDepoPt1 = Rhino.MoveObject (ObjDepoPt1, array(0,0,0), array(0,0,-.5*MovinD1*MovinD1+d*d/8))
  ObjDepoPt2 = Rhino.AddPoint (MovinPt2)
  ObjDepoPt2 = Rhino.MoveObject (ObjDepoPt2, array(0,0,0), array(0,0,-.5*MovinD2*MovinD2+d*d/8))
  ObjDepSphere1= Rhino.AddSphere (Rhino.PointCoordinates (ObjDepoPt1), .5)
  ObjDepSphere2= Rhino.AddSphere (Rhino.PointCoordinates (ObjDepoPt2), .5)
 Next
 
End Sub

Advertisements

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