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, nf, counterab, counterbc, countercd, counterde, counteref, counterfa
Dim dblRadius, dblRadii, dblConv, dblRad, arrPtsa(), arrPtsb(), arrPtsc(), arrPtsd(), arrPtse(), arrPtsf(), dblTol, strLine
Dim stlLinea, stlLineb, stlLinec, stlLined, stlLinee, stlLinef, stlLinePreva, stlLinePrevb, stlLinePrevc, stlLinePrevd, stlLinePreve, stlLinePrevf, dblIntTol
Dim arrCCXab, arrCCXaf, arrCCXbc, arrCCXcd, arrCCXde, arrCCXef, dblDistab, dblDistbc, dblDistcd, dblDistde, dblDistef, dblDistfa
Dim arrCCXPab, arrCCXPaf, arrCCXPbc, arrCCXPcd, arrCCXPde, arrCCXPef, dblAngle, dblAngle1, dblAngle2
Dim strCrva, strCrvb, strCrvc, strCrvd, strCrve, strCrvf, arrMidPtab, arrMidPtbc, arrMidPtcd, arrMidPtde, arrMidPtef, arrMidPtfa
Dim arrRadiia(), arrRadiib(), arrRadiic(), arrRadiid(), arrRadiie(), arrRadiif(), arrCenterLoca(), arrCenterLocb(), arrCenterLocc(), arrCenterLocd(), arrCenterLoce(), arrCenterLocf()
Dim dblAnglea : dblAnglea = 1
Dim dblAngleb : dblAngleb = 1
Dim dblAnglec : dblAnglec = 1
Dim dblAngled : dblAngled = 1
Dim dblAnglee : dblAnglee = 1
Dim dblAnglef : dblAnglef = 1
Dim intUpper : intUpper = 120
dblRadii = 5
dblRad = 1
dblTol = 4
dblIntTol = 1
dblConv = 0.0174532925
Dim intLinesa : intLinesa = 24
Dim intLinesb : intLinesb = 12
intLinesa = 72/intLinesa
intLinesb = 72/intLinesb
Call Rhino.EnableRedraw (False)
For h = 0 To 0
For j = 0 To 0
Dim rndAnglea : rndAnglea = Random(0.5,1)*10
Dim rndAngleb : rndAngleb = Random(-1,-0.5)*10
Dim rndAnglec : rndAnglec = Random(0.5,1)*10
Dim rndAngled : rndAngled = Random(-1,-0.5)*10
Dim rndAnglee : rndAnglee = Random(0.5,1)*10
Dim rndAnglef : rndAnglef = Random(-1,-0.5)*10
Dim rnda : rnda = Random(10,50) / rndAnglea
Dim rndb : rndb = Random(70,110) / rndAngleb
Dim rndc : rndc = Random(130,170) / rndAnglec
Dim rndd : rndd = Random(190,230) / rndAngled
Dim rnde : rnde = Random(250,290) / rndAnglee
Dim rndf : rndf = Random(310,350) / rndAnglef
na=0 : nb=0 : nc=0 : nd=0 : ne=0 : nf=0 : m = 0
counterab=0 : counterbc=0 : countercd=0 : counterde=0 : counteref=0 : counterfa=0
For i = 0 To intUpper
If i < 8 Then
dblRadius = ((sin(i/10)*20) + 60) + ((9-i) * (9-i)*((9-i)/4))
Else
dblRadius = (sin(i/10)*20) + 60
End If
ReDim Preserve arrPtsa(i)
ReDim Preserve arrPtsb(i)
ReDim Preserve arrPtsc(i)
ReDim Preserve arrPtsd(i)
ReDim Preserve arrPtse(i)
ReDim Preserve arrPtsf(i)
ReDim Preserve arrRadiia(i)
ReDim Preserve arrRadiib(i)
ReDim Preserve arrRadiic(i)
ReDim Preserve arrRadiid(i)
ReDim Preserve arrRadiie(i)
ReDim Preserve arrRadiif(i)
ReDim Preserve arrCenterLoca(i)
ReDim Preserve arrCenterLocb(i)
ReDim Preserve arrCenterLocc(i)
ReDim Preserve arrCenterLocd(i)
ReDim Preserve arrCenterLoce(i)
ReDim Preserve arrCenterLocf(i)
arrPtsa(i) = (array(cos((na+rnda)*rndAnglea*dblConv)*dblRadius, sin((na+rnda)*rndAnglea*dblConv)*dblRadius, i*10))
arrPtsb(i) = (array(cos((nb+rndb)*rndAngleb*dblConv)*dblRadius, sin((nb+rndb)*rndAngleb*dblConv)*dblRadius, i*10))
arrPtsc(i) = (array(cos((nc+rndc)*rndAnglec*dblConv)*dblRadius, sin((nc+rndc)*rndAnglec*dblConv)*dblRadius, i*10))
arrPtsd(i) = (array(cos((nd+rndd)*rndAngled*dblConv)*dblRadius, sin((nd+rndd)*rndAngled*dblConv)*dblRadius, i*10))
arrPtse(i) = (array(cos((ne+rnde)*rndAnglee*dblConv)*dblRadius, sin((ne+rnde)*rndAnglee*dblConv)*dblRadius, i*10))
arrPtsf(i) = (array(cos((nf+rndf)*rndAnglef*dblConv)*dblRadius, sin((nf+rndf)*rndAnglef*dblConv)*dblRadius, i*10))
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)))
stlLinef = Rhino.AddInterpCurve (array(arrPtsf(i),arrPtsf(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)))
stlLinePrevf = Rhino.AddInterpCurve (array(arrPtsf(i-1),arrPtsf(i-2)))
arrCCXab = Rhino.CurveCurveIntersection (stlLinea, stlLineb,dblIntTol)
arrCCXPab = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePrevb,dblIntTol)
If IsArray(arrCCXab) And Not isArray (arrCCXPab) Then
dblAnglea = dblAnglea * -1
dblAngleb = dblAngleb * -1
arrPtsa(i) = arrCCXab(n,1)
arrPtsb(i) = arrCCXab(n,1)
m = m + 1
counterab = counterab+1
End If
arrCCXaf = Rhino.CurveCurveIntersection (stlLinea, stlLinef,dblIntTol)
arrCCXPaf = Rhino.CurveCurveIntersection (stlLinePreva, stlLinePrevf,dblIntTol)
If IsArray(arrCCXaf) And Not isArray (arrCCXPaf) Then
dblAnglea = dblAnglea * -1
dblAnglef = dblAnglef * -1
arrPtsa(i) = arrCCXaf(n,1)
arrPtsf(i) = arrCCXaf(n,1)
m = m + 1
counterfa = counterfa+1
End If
arrCCXbc = Rhino.CurveCurveIntersection (stlLineb, stlLinec,dblIntTol)
arrCCXPbc = Rhino.CurveCurveIntersection (stlLinePrevb, stlLinePrevc,dblIntTol)
If IsArray(arrCCXbc) And Not isArray (arrCCXPbc) Then
dblAngleb = dblAngleb * -1
dblAnglec = dblAnglec * -1
arrPtsb(i) = arrCCXbc(n,1)
arrPtsc(i) = arrCCXbc(n,1)
m = m + 1
counterbc = counterbc+1
End If
arrCCXcd = Rhino.CurveCurveIntersection (stlLinec, stlLined,dblIntTol)
arrCCXPcd = Rhino.CurveCurveIntersection (stlLinePrevc, stlLinePrevd,dblIntTol)
If IsArray(arrCCXcd) And Not isArray (arrCCXPcd) Then
dblAnglec = dblAnglec * -1
dblAngled = dblAngled * -1
arrPtsc(i) = arrCCXcd(n,1)
arrPtsd(i) = arrCCXcd(n,1)
m = m + 1
countercd = countercd+1
End If
arrCCXde = Rhino.CurveCurveIntersection (stlLined, stlLinee,dblIntTol)
arrCCXPde = Rhino.CurveCurveIntersection (stlLinePrevd, stlLinePreve,dblIntTol)
If IsArray(arrCCXde) And Not isArray (arrCCXPde) Then
dblAngled = dblAngled * -1
dblAnglee = dblAnglee * -1
arrPtsd(i) = arrCCXde(n,1)
arrPtse(i) = arrCCXde(n,1)
m = m + 1
counterde = counterde+1
End If
arrCCXef = Rhino.CurveCurveIntersection (stlLinee, stlLinef,dblIntTol)
arrCCXPef = Rhino.CurveCurveIntersection (stlLinePreve, stlLinePrevf,dblIntTol)
If IsArray(arrCCXef) And Not isArray (arrCCXPef) Then
dblAnglee = dblAnglee * -1
dblAnglef = dblAnglef * -1
arrPtse(i) = arrCCXef(n,1)
arrPtsf(i) = arrCCXef(n,1)
m = m + 1
counteref = counteref+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 (stlLinef)
Call Rhino.DeleteObject (stlLinePreva):Call Rhino.DeleteObject (stlLinePrevb):Call Rhino.DeleteObject (stlLinePrevc):Call Rhino.DeleteObject (stlLinePrevd):Call Rhino.DeleteObject (stlLinePreve):Call Rhino.DeleteObject (stlLinePrevf)
End If
dblDistab = rhino.Distance (array(0,0,i*10),arrPtsa(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(10,0,i*10)),array(array(0,0,i*10),arrPtsa(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(10,0,i*10)),array(array(0,0,i*10),arrPtsb(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = (dblAngle1(0) + dblAngle2(0))/2
arrMidPtab = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistab)
dblDistab = (Rhino.Distance (arrMidPtab,arrPtsa(i)))*2
dblDistbc = rhino.Distance (array(0,0,i*10),arrPtsb(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(10,10,i*10)),array(array(0,0,i*10),arrPtsb(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(10,10,i*10)),array(array(0,0,i*10),arrPtsc(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = ((dblAngle1(0) + dblAngle2(0))/2)+45
arrMidPtbc = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistbc)
dblDistbc = (Rhino.Distance (arrMidPtbc,arrPtsb(i)))*2
dblDistcd = rhino.Distance (array(0,0,i*10),arrPtsc(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(0,10,i*10)),array(array(0,0,i*10),arrPtsc(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(0,10,i*10)),array(array(0,0,i*10),arrPtsd(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = ((dblAngle1(0) + dblAngle2(0))/2)+90
arrMidPtcd = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistcd)
dblDistcd = (Rhino.Distance (arrMidPtcd,arrPtsc(i)))*2
dblDistde = rhino.Distance (array(0,0,i*10),arrPtsd(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,10,i*10)),array(array(0,0,i*10),arrPtsd(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,10,i*10)),array(array(0,0,i*10),arrPtse(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = ((dblAngle1(0) + dblAngle2(0))/2)+135
arrMidPtde = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistde)
dblDistde = (Rhino.Distance (arrMidPtde,arrPtsd(i)))*2
dblDistef = rhino.Distance (array(0,0,i*10),arrPtse(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,0,i*10)),array(array(0,0,i*10),arrPtse(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,0,i*10)),array(array(0,0,i*10),arrPtsf(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = ((dblAngle1(0) + dblAngle2(0))/2)+180
arrMidPtef = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistef)
dblDistef = (Rhino.Distance (arrMidPtef,arrPtse(i)))*2
dblDistfa = rhino.Distance (array(0,0,i*10),arrPtsf(i))
dblAngle2 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,-10,i*10)),array(array(0,0,i*10),arrPtsf(i)))
dblAngle1 = Rhino.Angle2 (array(array(0,0,i*10),array(-10,-10,i*10)),array(array(0,0,i*10),arrPtsa(i)))
If dblAngle2(0) < 0 Then
dblAngle2(0) = dblAngle2(0) + 360
End If
If dblAngle1(0) < 0 Then
dblAngle1(0) = dblAngle1(0) + 360
End If
dblAngle = ((dblAngle1(0) + dblAngle2(0))/2)+225
arrMidPtfa = Rhino.Polar(array(0,0,i*10), dblAngle, dblDistfa)
dblDistfa = (Rhino.Distance (arrMidPtfa,arrPtsf(i)))*2
If counterab Mod 2 = 0 And counterab < 7 Then
arrRadiia(i) = dblDistab+dblradii
arrCenterLoca(i) = arrMidPtab
Else
arrRadiia(i) = dblRadii
arrCenterLoca(i) = arrPtsa(i)
End If
If counterbc > 0 And counterbc < 7 Then
arrRadiib(i) = dblDistbc+dblradii
arrCenterLocb(i) = arrMidPtbc
Else
arrRadiib(i) = dblRadii
arrCenterLocb(i) = arrPtsb(i)
End If
If countercd Mod 2 = 0 And countercd < 7 Then
arrRadiic(i) = dblDistcd+dblradii
arrCenterLocc(i) = arrMidPtcd
Else
arrRadiic(i) = dblRadii
arrCenterLocc(i) = arrPtsc(i)
End If
If counterde > 0 And counterde < 7 Then
arrRadiid(i) = dblDistde+dblradii
arrCenterLocd(i) = arrMidPtde
Else
arrRadiid(i) = dblRadii
arrCenterLocd(i) = arrPtsd(i)
End If
If counteref Mod 2 = 0 And counteref < 7 Then
arrRadiie(i) = dblDistef+dblradii
arrCenterLoce(i) = arrMidPtef
Else
arrRadiie(i) = dblRadii
arrCenterLoce(i) = arrPtse(i)
End If
If counterfa > 0 And counterfa < 7 Then
arrRadiif(i) = dblDistfa+dblradii
arrCenterLocf(i) = arrMidPtfa
Else
arrRadiif(i) = dblRadii
arrCenterLocf(i) = arrPtsf(i)
End If
na=na+dblAnglea
nb=nb+dblAngleb
nc=nc+dblAnglec
nd=nd+dblAngled
ne=ne+dblAnglee
nf=nf+dblAnglef
Next
k = (m-30)*12.75
If k <0 Then
k=0
End If
strCrva = Rhino.AddCurve(arrPtsa,3):strCrvb = Rhino.AddCurve(arrPtsb,3):strCrvc = Rhino.AddCurve(arrPtsc,3):strCrvd = Rhino.AddCurve(arrPtsd,3):strCrve = Rhino.AddCurve(arrPtse,3):strCrvf = Rhino.AddCurve(arrPtsf,3)
Call Weaving(strCrva,intLinesb,dblRadii,k,intUpper,dblRad) : Call Weaving(strCrvb,intLinesb,dblRadii,k,intUpper,dblRad):Call Weaving(strCrvc,intLinesb,dblRadii,k,intUpper,dblRad):Call Weaving(strCrvd,intLinesb,dblRadii,k,intUpper,dblRad):Call Weaving(strCrve,intLinesb,dblRadii,k,intUpper,dblRad):Call Weaving(strCrvf,intLinesb,dblRadii,k,intUpper,dblRad)
Call Weavinga(arrCenterLoca,arrRadiia,intLinesa,intUpper,dblRadii,k) : Call Weavinga(arrCenterLocb,arrRadiib,intLinesa,intUpper,dblRadii,k) : Call Weavinga(arrCenterLocc,arrRadiic,intLinesa,intUpper,dblRadii,k) : Call Weavinga(arrCenterLocd,arrRadiid,intLinesa,intUpper,dblRadii,k) : Call Weavinga(arrCenterLoce,arrRadiie,intLinesa,intUpper,dblRadii,k) : Call Weavinga(arrCenterLocf,arrRadiif,intLinesa,intUpper,dblRadii,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 AddPipe(arrFinPtsf,dblRad,k)
Call Rhino.ObjectColor (Rhino.RotateObject (Rhino.AddText (“Intersections:_”&m, array(-60,-120), 15), Array (0,0,0), 90),rgb(0,k,0))
‘Call Rhino.ObjectColor (Rhino.Command (“-text -40,-100 h 15 Intersections:_”&m&” “),rgb(0,k,0))
‘Call Rhino.Command (“selall “) : Call Rhino.Command (“move 0,0,0 0,400,0 “) : Call Rhino.Command (“selnone “)
Next
‘Call Rhino.Command (“show “) : Call Rhino.Command (“selall “) : Call Rhino.Command (“move 0,0,0 400,0,0 “) : Call Rhino.Command (“hide “)
Next
‘Call Rhino.Command (“Show “) : Call Rhino.Command (“selall “) : Call Rhino.Command (“move 0,0,0 -400,-400,0 “) : Call Rhino.Command (“selnone “)
‘Call Rhino.Command (“selpt “) : Call Rhino.Command (“hide “)
Call Rhino.EnableRedraw (True)
End Sub
Function Weaving(ArrayOfPoints,intLinesa,dblRadii,j,k,dblRad)
Dim h, i, l, n
Dim dblConv, arrpt, arrPts, strPt, arrPtsa(), arrPtsb(),arrFlrPts(), arrFlrPt(), strObj
arrPts = Rhino.DivideCurve (ArrayOfPoints, k)
Call Rhino.DeleteObject(ArrayOfPoints)
dblConv = 0.0174532925
Dim dblLocX
Dim dblLocY
Dim dblLocZ
Dim dblRadius : dblRadius = dblRadii
Dim intStep : intStep = intLinesa
Dim intOffset : intOffset = intStep/(intStep*4)
For h = 0 To 35 Step intStep
n = 0
For Each arrPt In arrPts
‘Call Rhino.AddPoint (arrPt)
ReDim Preserve arrPtsa(n)
ReDim Preserve arrPtsb(n)
dblLocX = arrPt(0)
dblLocY = arrPt(1)
dblLocZ = arrPt(2)
If n Mod 2 = 0 Then
arrPtsa(n) = (array(cos((h+intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h+intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
arrPtsb(n) = (array(cos((h-intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h-intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
Else
arrPtsa(n) = (array(cos((h+(intStep/2)-intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h+(intStep/2)-intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
arrPtsb(n) = (array(cos((h-(intStep/2)+intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h-(intStep/2)+intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
End If
n=n+1
Next
strObj = Rhino.AddinterpCurve (arrPtsa)
Call Rhino.ObjectColor (strObj,RGB (0,j,0))
strObj = Rhino.AddinterpCurve (arrPtsb)
Call Rhino.ObjectColor (strObj,RGB (0,j,0))
‘Call AddPipe(arrPtsa,dblRad,j) : Call AddPipe(arrPtsb,dblRad,j)
Next
End Function
Function Weavinga(ArrayofPoints,ArrayofRadii,intLinesa,intUpper,dblRadii,k)
Dim h, i, j, l, n, m, strObj, strObja, strObjb
Dim arrPtsa(), arrPtsb(), arrFlrPt(), arrFlrPts()
Dim dblLocX
Dim dblLocY
Dim dblLocZ
Dim dblRadius
Dim dblInset : dblInset = 1.2
Dim intStep : intStep = intLinesa*8
Dim dblConv : dblConv = 0.0174532925
Dim dblRot : dblRot = 360/(intStep/2)
Dim intOffset : intOffset = intLinesa/(intLinesa*4)
For h = 0 To 35 Step intLinesa
n = 0
For i=0 To intUpper
ReDim Preserve arrPtsa(n)
ReDim Preserve arrPtsb(n)
dblRadius = ArrayofRadii(n)/3
dblLocX = ArrayofPoints(n)(0)
dblLocY = ArrayofPoints(n)(1)
dblLocZ = ArrayofPoints(n)(2)
If n Mod 2 = 0 Then
arrPtsa(n) = (array(cos((h+intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h+intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
arrPtsb(n) = (array(cos((h-intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h-intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
Else
arrPtsa(n) = (array(cos((h+(intLinesa/2)-intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h+(intLinesa/2)-intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
arrPtsb(n) = (array(cos((h-(intLinesa/2)+intOffset)*10*dblConv)*dblRadius+dblLocX, (sin((h-(intLinesa/2)+intOffset)*10*dblConv)*dblRadius)*-1+dblLocY, dblLocZ))
End If
n=n+1
Next
strObj = Rhino.AddinterpCurve (arrPtsa)
Call Rhino.Objectcolor (strObj,rgb(0,k,0))
strObj = Rhino.AddinterpCurve (arrPtsb)
Call Rhino.Objectcolor (strObj,rgb(0,k,0))
‘Call AddPipe(arrPtsa,dblRad,j) : Call AddPipe(arrPtsb,dblRad,j)
Next
n = 0
For i=0 To intUpper
ReDim Preserve arrFlrPt(n)
If ArrayofRadii(n) > dblRadii Then
dblRadius = ArrayofRadii(n)/3
dblLocX = ArrayofPoints(n)(0)
dblLocY = ArrayofPoints(n)(1)
dblLocZ = ArrayofPoints(n)(2)
If n Mod 2 = 0 Then
m=0
For l = 0 To intStep
ReDim Preserve arrFlrPts(m)
If l Mod 2 = 0 Then
arrFlrPts(m) = Rhino.Addcurve (array(array((cos(l*(dblRot/2)*dblConv)*dblRadius)/10+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/10+dblLocY,dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/5+dblLocY, dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/3+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/3+dblLocY, (dblLocZ+1)),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/1.5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/1.5+dblLocY, (dblLocZ-1)),_
array(cos(l*(dblRot/2)*dblConv)*dblRadius+dblLocX, (sin(l*(dblRot/2)*dblConv)*dblRadius)*-1+dblLocY, dblLocZ)))
Else
arrFlrPts(m) = Rhino.Addcurve (array(array((cos(l*(dblRot/2)*dblConv)*dblRadius)/10+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/10+dblLocY,dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/5+dblLocY, dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/3+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/3+dblLocY, (dblLocZ+1)),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/1.5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/1.5+dblLocY, (dblLocZ-1)),_
array(cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset)+dblLocX, (sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1+dblLocY, dblLocZ)))
End If
m=m+1
Next
strObja = Rhino.Addloftsrf (arrFlrPts)
Call Rhino.DeleteObjects (arrFlrPts)
Call Rhino.Objectcolor (strObja,rgb(0,k,0))
Else
m=0
For l = 0 To intStep
ReDim Preserve arrFlrPts(m)
If l Mod 2 = 0 Then
arrFlrPts(m) = Rhino.Addcurve (array(array((cos(l*(dblRot/2)*dblConv)*dblRadius)/10+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/10+dblLocY,dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/5+dblLocY, dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/3+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/3+dblLocY, (dblLocZ+1)),_
array((cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))/1.5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1)/1.5+dblLocY, (dblLocZ-1)),_
array(cos(l*(dblRot/2)*dblConv)*(dblRadius/dblInset)+dblLocX, (sin(l*(dblRot/2)*dblConv)*(dblRadius/dblInset))*-1+dblLocY, dblLocZ)))
Else
arrFlrPts(m) = Rhino.Addcurve (array(array((cos(l*(dblRot/2)*dblConv)*dblRadius)/10+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/10+dblLocY,dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/5+dblLocY, dblLocZ),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/3+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/3+dblLocY, (dblLocZ+1)),_
array((cos(l*(dblRot/2)*dblConv)*dblRadius)/1.5+dblLocX, ((sin(l*(dblRot/2)*dblConv)*dblRadius)*-1)/1.5+dblLocY, (dblLocZ-1)),_
array(cos(l*(dblRot/2)*dblConv)*dblRadius+dblLocX, (sin(l*(dblRot/2)*dblConv)*dblRadius)*-1+dblLocY, dblLocZ)))
End If
m=m+1
Next
strObja = Rhino.Addloftsrf (arrFlrPts)
Call Rhino.DeleteObjects (arrFlrPts)
Call Rhino.Objectcolor (strObja,rgb(0,k,0))
End If
End If
n=n+1
Next
‘Call AddPipe(arrPtsa,dblRad,j) : Call AddPipe(arrPtsb,dblRad,j)
End Function
Function AddPipe(arrMovPta,dblRad,k)
Dim strLine, strPipe
strLine = Rhino.AddInterpCurve (arrMovPta)
Call Rhino.SelectObject (strLine)
Call Rhino.Command (“Pipe “&dblRad&” “&dblRad&” enter”)
strPipe = Rhino.LastObject
Call Rhino.ObjectColor (strPipe, rgb(0,k,0))
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.