Option Explicit
‘Script written by mark.bearak
‘Script copyrighted by dtls.architecture
‘Script version Monday, October 22, 2007 3:16:51 PM
Call Main()
Sub Main()
Dim h, i, j, k, n, m, na, nb, nc, nd, ne
Dim dblRadius, dblConv, strPta, strPtb, strPtc, strPtd, strPte, dblRad, arrPtsa(), arrPtsb(), arrPtsc(), arrPtsd(), arrPtse(), arrFinPtsa(), arrFinPtsb(), arrFinPtsc(), arrFinPtsd(), arrFinPtse(), dblTol
Dim stlLinea, stlLineb, stlLinec, stlLined, stlLinee, stlLinePreva, stlLinePrevb, stlLinePrevc, stlLinePrevd, stlLinePreve, dblIntTol
Dim arrCCXab, arrCCXac, arrCCXad, arrCCXae, arrCCXbc, arrCCXbd, arrCCXbe, arrCCXcd, arrCCXce, arrCCXde
Dim arrCCXPab, arrCCXPac, arrCCXPad, arrCCXPae, arrCCXPbc, arrCCXPbd, arrCCXPbe, arrCCXPcd, arrCCXPce, arrCCXPde
Dim strCrva, strCrvb, strCrvc, strCrvd, strCrve
Dim dblAnglea : dblAnglea = 1
Dim dblAngleb : dblAngleb = 1
Dim dblAnglec : dblAnglec = 1
Dim dblAngled : dblAngled = 1
Dim dblAnglee : dblAnglee = 1
dblRad = 1
dblTol = 4
dblIntTol = 1
dblConv = 0.0174532925
For h = 0 To 3
For j = 0 To 20
Dim rnda : rnda = random(0,36)
Dim rndb : rndb = random(0,36)
Dim rndc : rndc = random(0,36)
Dim rndd : rndd = random(0,36)
Dim rnde : rnde = random(0,36)
Dim rndAnglea : rndAnglea = Random(-5,5)*4
Dim rndAngleb : rndAngleb = Random(-5,5)*4
Dim rndAnglec : rndAnglec = Random(-5,5)*4
Dim rndAngled : rndAngled = Random(-5,5)*4
Dim rndAnglee : rndAnglee = Random(-5,5)*4
na=0 : nb=0 : nc=0 : nd=0 : m = 0
For i = 0 To 60
dblRadius = (sin(i/5)*10) + 20
ReDim Preserve arrPtsa(i)
ReDim Preserve arrPtsb(i)
ReDim Preserve arrPtsc(i)
ReDim Preserve arrPtsd(i)
ReDim Preserve arrPtse(i)
ReDim Preserve arrFinPtsa(i)
ReDim Preserve arrFinPtsb(i)
ReDim Preserve arrFinPtsc(i)
ReDim Preserve arrFinPtsd(i)
ReDim Preserve arrFinPtse(i)
strPta = Rhino.AddPoint (array(cos((na+rnda)*rndAnglea*dblConv)*dblRadius, sin((na+rnda)*rndAnglea*dblConv)*dblRadius, i*6))
strPtb = Rhino.AddPoint (array(cos((nb+rndb)*rndAngleb*dblConv)*dblRadius, sin((nb+rndb)*rndAngleb*dblConv)*dblRadius, i*6))
strPtc = Rhino.AddPoint (array(cos((nc+rndc)*rndAnglec*dblConv)*dblRadius, sin((nc+rndc)*rndAnglec*dblConv)*dblRadius, i*6))
strPtd = Rhino.AddPoint (array(cos((nd+rndd)*rndAngled*dblConv)*dblRadius, sin((nd+rndd)*rndAngled*dblConv)*dblRadius, i*6))
strPte = Rhino.AddPoint (array(cos((ne+rnde)*rndAnglee*dblConv)*dblRadius, sin((ne+rnde)*rndAnglee*dblConv)*dblRadius, i*6))
arrPtsa(i) = Rhino.PointCoordinates (strPta)
arrPtsb(i) = Rhino.PointCoordinates (strPtb)
arrPtsc(i) = Rhino.PointCoordinates (strPtc)
arrPtsd(i) = Rhino.PointCoordinates (strPtd)
arrPtse(i) = Rhino.PointCoordinates (strPte)
arrFinPtsa(i) = Rhino.PointCoordinates (strPta)
arrFinPtsb(i) = Rhino.PointCoordinates (strPtb)
arrFinPtsc(i) = Rhino.PointCoordinates (strPtc)
arrFinPtsd(i) = Rhino.PointCoordinates (strPtd)
arrFinPtse(i) = Rhino.PointCoordinates (strPte)
Call Rhino.DeleteObject (strPta):Call Rhino.DeleteObject (strPtb):Call Rhino.DeleteObject (strPtc):Call Rhino.DeleteObject (strPtd):Call Rhino.DeleteObject (strPte)
If i>=2 Then
stlLinea = Rhino.AddInterpCurve (array(arrPtsa(i),arrPtsa(i-1)))
stlLineb = Rhino.AddInterpCurve (array(arrPtsb(i),arrPtsb(i-1)))
stlLinec = Rhino.AddInterpCurve (array(arrPtsc(i),arrPtsc(i-1)))
stlLined = Rhino.AddInterpCurve (array(arrPtsd(i),arrPtsd(i-1)))
stlLinee = Rhino.AddInterpCurve (array(arrPtse(i),arrPtse(i-1)))
stlLinePreva = Rhino.AddInterpCurve (array(arrPtsa(i-1),arrPtsa(i-2)))
stlLinePrevb = Rhino.AddInterpCurve (array(arrPtsb(i-1),arrPtsb(i-2)))
stlLinePrevc = Rhino.AddInterpCurve (array(arrPtsc(i-1),arrPtsc(i-2)))
stlLinePrevd = Rhino.AddInterpCurve (array(arrPtsd(i-1),arrPtsd(i-2)))
stlLinePreve = Rhino.AddInterpCurve (array(arrPtse(i-1),arrPtse(i-2)))
arrCCXab = Rhino.CurveCurveIntersection (stlLinea, stlLineb,dblIntTol)
arrCCXPab = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePrevb,dblIntTol)
If IsArray(arrCCXab) And Not isArray (arrCCXPab) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXab(n,1)), rgb(0,0,255))
dblAnglea = dblAnglea * -1
dblAngleb = dblAngleb * -1
arrFinPtsa(i) = arrCCXab(n,1)
arrFinPtsb(i) = arrCCXab(n,1)
m = m + 1
End If
arrCCXac = Rhino.CurveCurveIntersection (stlLinea, stlLinec,dblIntTol)
arrCCXPac = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePrevc,dblIntTol)
If IsArray(arrCCXac) And Not isArray (arrCCXPac) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXac(n,1)), rgb(0,0,255))
dblAnglea = dblAnglea * -1
dblAnglec = dblAnglec * -1
arrFinPtsa(i) = arrCCXac(n,1)
arrFinPtsc(i) = arrCCXac(n,1)
m = m + 1
End If
arrCCXad = Rhino.CurveCurveIntersection (stlLinea, stlLined,dblIntTol)
arrCCXPad = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePrevd,dblIntTol)
If IsArray(arrCCXad) And Not isArray (arrCCXPad) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXad(n,1)), rgb(0,0,255))
dblAnglea = dblAnglea * -1
dblAngled = dblAngled * -1
arrFinPtsa(i) = arrCCXad(n,1)
arrFinPtsd(i) = arrCCXad(n,1)
m = m + 1
End If
arrCCXae = Rhino.CurveCurveIntersection (stlLinea, stlLinee,dblIntTol)
arrCCXPae = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePreve,dblIntTol)
If IsArray(arrCCXae) And Not isArray (arrCCXPae) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXae(n,1)), rgb(0,0,255))
dblAnglea = dblAnglea * -1
dblAnglee = dblAnglee * -1
arrFinPtsa(i) = arrCCXae(n,1)
arrFinPtse(i) = arrCCXae(n,1)
m = m + 1
End If
arrCCXbc = Rhino.CurveCurveIntersection (stlLineb, stlLinec,dblIntTol)
arrCCXPbc = Rhino.CurveCurveIntersection (stlLinePrevb, stlLinePrevc,dblIntTol)
If IsArray(arrCCXbc) And Not isArray (arrCCXPbc) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXbc(n,1)), rgb(0,0,255))
dblAngleb = dblAngleb * -1
dblAnglec = dblAnglec * -1
arrFinPtsb(i) = arrCCXbc(n,1)
arrFinPtsc(i) = arrCCXbc(n,1)
m = m + 1
End If
arrCCXbd = Rhino.CurveCurveIntersection (stlLineb, stlLined,dblIntTol)
arrCCXPbd = Rhino.CurveCurveIntersection (stlLinePrevb, stlLinePrevd,dblIntTol)
If IsArray(arrCCXbd) And Not isArray (arrCCXPbd) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXbd(n,1)), rgb(0,0,255))
dblAngleb = dblAngleb * -1
dblAngled = dblAngled * -1
arrFinPtsb(i) = arrCCXbd(n,1)
arrFinPtsd(i) = arrCCXbd(n,1)
m = m + 1
End If
arrCCXbe = Rhino.CurveCurveIntersection (stlLineb, stlLinee,dblIntTol)
arrCCXPbe = Rhino.CurveCurveIntersection (stlLinePrevb, stlLinePreve,dblIntTol)
If IsArray(arrCCXbe) And Not isArray (arrCCXPbe) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXbe(n,1)), rgb(0,0,255))
dblAngleb = dblAngleb * -1
dblAnglee = dblAnglee * -1
arrFinPtsb(i) = arrCCXbe(n,1)
arrFinPtse(i) = arrCCXbe(n,1)
m = m + 1
End If
arrCCXcd = Rhino.CurveCurveIntersection (stlLinec, stlLined,dblIntTol)
arrCCXPcd = Rhino.CurveCurveIntersection (stlLinePrevc, stlLinePrevd,dblIntTol)
If IsArray(arrCCXcd) And Not isArray (arrCCXPcd) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXcd(n,1)), rgb(0,0,255))
dblAnglec = dblAnglec * -1
dblAngled = dblAngled * -1
arrFinPtsc(i) = arrCCXcd(n,1)
arrFinPtsd(i) = arrCCXcd(n,1)
m = m + 1
End If
arrCCXce = Rhino.CurveCurveIntersection (stlLinec, stlLinee,dblIntTol)
arrCCXPce = Rhino.CurveCurveIntersection (stlLinePrevc, stlLinePreve,dblIntTol)
If IsArray(arrCCXce) And Not isArray (arrCCXPce) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXce(n,1)), rgb(0,0,255))
dblAnglec = dblAnglec * -1
dblAnglee = dblAnglee * -1
arrFinPtsc(i) = arrCCXce(n,1)
arrFinPtse(i) = arrCCXce(n,1)
m = m + 1
End If
arrCCXde = Rhino.CurveCurveIntersection (stlLined, stlLinee,dblIntTol)
arrCCXPde = Rhino.CurveCurveIntersection (stlLinePrevd, stlLinePreve,dblIntTol)
If IsArray(arrCCXde) And Not isArray (arrCCXPde) Then
Call Rhino.ObjectColor (Rhino.AddPoint (arrCCXde(n,1)), rgb(0,0,255))
dblAngled = dblAngled * -1
dblAnglee = dblAnglee * -1
arrFinPtsd(i) = arrCCXde(n,1)
arrFinPtse(i) = arrCCXde(n,1)
m = m + 1
End If
Call Rhino.DeleteObject (stlLinea):Call Rhino.DeleteObject (stlLineb):Call Rhino.DeleteObject (stlLinec):Call Rhino.DeleteObject (stlLined):Call Rhino.DeleteObject (stlLinee)
Call Rhino.DeleteObject (stlLinePreva):Call Rhino.DeleteObject (stlLinePrevb):Call Rhino.DeleteObject (stlLinePrevc):Call Rhino.DeleteObject (stlLinePrevd):Call Rhino.DeleteObject (stlLinePreve)
End If
na=na+dblAnglea
nb=nb+dblAngleb
nc=nc+dblAnglec
nd=nd+dblAngled
ne=ne+dblAnglee
Next
k = (m-10)*25.5
If k <0 Then
k=0
End If
strCrva = Rhino.ObjectColor(Rhino.AddInterpCurve (arrFinPtsa),rgb(0,0,k)):strCrvb = Rhino.ObjectColor(Rhino.AddInterpCurve (arrFinPtsb),rgb(0,0,k)):strCrvc = Rhino.ObjectColor(Rhino.AddInterpCurve (arrFinPtsc),rgb(0,0,k)): strCrvd = Rhino.ObjectColor(Rhino.AddInterpCurve (arrFinPtsd),rgb(0,0,k)): strCrve = Rhino.ObjectColor(Rhino.AddInterpCurve (arrFinPtse),rgb(0,0,k))
‘Call AddPipe(arrFinPtsa,dblRad,k):Call AddPipe(arrFinPtsb,dblRad,k):Call AddPipe(arrFinPtsc,dblRad,k):Call AddPipe(arrFinPtsd,dblRad,k):Call AddPipe(arrFinPtse,dblRad,k)
‘Call Rhino.Command (“-text -20,-50 h 15 Intersections:_”&m&” “)
Call Rhino.Command (“selall “)
Call Rhino.Command (“move 0,0,0 0,200,0 “)
Call Rhino.Command (“selnone “)
Next
Call Rhino.Command (“show “)
Call Rhino.Command (“selall “)
Call Rhino.Command (“move 0,0,0 200,0,0 “)
Call Rhino.Command (“hide “)
Next
Call Rhino.Command (“Show “)
Call Rhino.Command (“selall “)
Call Rhino.Command (“move 0,0,0 -200,-200,0 “)
Call Rhino.Command (“selnone “)
Call Rhino.Command (“selpt “)
Call Rhino.Command (“hide “)
End Sub
Function AddPipe(arrMovPta,dblRad,k)
Dim strLine, strPipe
strLine = Rhino.AddCurve (arrMovPta)
Call Rhino.SelectObject (strLine)
Call Rhino.Command (“Pipe “&dblRad&” “&dblRad&” enter”)
strPipe = Rhino.LastObject
Call Rhino.ObjectColor (strPipe, rgb(0,0,k))
Call Rhino.Command (“Selnone “)
Call Rhino.DeleteObject (strLine)
End Function
Function random(intLow,intUp)
Randomize
random = (intUp-intLow) * rnd() + intLow
End Function
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.