EunKyoung Kim_week2 Lamp

ek_week2-21

 

Call Delete()
Call Main()

  Sub Main()
  Dim arrLoc : arrLoc = Rhino.GetPoint (“Select your locator”)
  Dim dblWidth : dblWidth = Rhino.GetReal (“how wide Is your material”,.125)
  Dim arrPt, i, j, k, dblDist, arrNewPta, arrNewPtb, arrNewPtc, strCrva(), strCrvb(),strCrvc(), counter, arrFinalCrvsa, arrFinalCrvsb
  Dim strSrfa, arrSrfsa, strSrfb,  arrSrfsb, strUnrollSrf
  For i = 48 To 120 Step 24
  For j = 48 To 216  Step 24
  arrPt = Array(i,j,30)
  dblDist = Rhino.Distance (arrLoc, arrPt)
  dblDist = dblDist/48
  If dblDist > 8.5 Then dblDist = 8.5
  If dblDist < 2 Then dblDist = 2
  counter = 0
  For k = -225 To 45 Step 90
    ReDim Preserve strCrva(counter)
    ReDim Preserve strCrvb(counter)
    arrNewPta = Rhino.Polar (arrPt, k, dblDist)
    arrNewPtb = Array(arrNewPta(0),arrNewPta(1),arrNewPta(2)-(dblDist*4))
    arrNewPtc = Array(arrPt(0),arrPt(1),arrPt(2)-(dblDist*(i/8 )))
    strCrva(counter) = Rhino.AddLine (arrPt, arrNewPta)
    strCrvb(counter) = Rhino.AddCurve (Array(arrNewPta,arrNewPtb,arrNewPtc))
    counter = counter+1
    Next
        arrFinalCrvsa = Rhino.JoinCurves (Array(strCrva(0),strCrvb(0),strCrva(2),strCrvb(2)),True)
        arrFinalCrvsb = Rhino.JoinCurves (Array(strCrva(1),strCrvb(1),strCrva(3),strCrvb(3)),True)
        arrSrfsa = Rhino.AddPlanarSrf (arrFinalCrvsa)

    For Each strSrfa In arrSrfsa
    Call Rhino.SelectObject (strSrfa)
    Call Rhino.Command (“unrollsrf e=n enter”)
    Call Rhino.UnselectAllObjects
    strUnrollSrf = Rhino.FirstObject
    Call Unrolla(strUnrollSrf, Array(i*2,j*2),dblWidth)
    Next
        arrSrfsb = Rhino.AddPlanarSrf (arrFinalCrvsb)
        For Each strSrfb In arrSrfsb
        Call Rhino.SelectObject (strSrfb)
        Call Rhino.Command (“unrollsrf e=n enter”)
        Call Rhino.UnselectAllObjects
        strUnrollSrf = Rhino.FirstObject
        Call Unrollb(strUnrollSrf, Array(i*2,(j*2)-17),dblWidth)
        Next
Next
Next
End Sub

Sub Delete()
Call Rhino.Command (“selall “)
Call Rhino.Command (“delete “)
End Sub

Function Unrolla(strSrf,arrLoc,dblWidth)

(same as original unroll function)

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