Pages of code RVB-Processing / Back

---------------------------------------

JA_1 Layer Scatterring

Option Explicit
‘Script written by <insert name>
‘Script copyrighted by <insert company name>
‘Script version Wednesday, October 01, 2008 3:42:11 PM

Call Main()
Sub Main()

Dim arrCrvs : arrCrvs = rhino.GetObjects(“pick crvs”)
Dim i,j
Dim xLayer,yLayer
Dim arrpts
Dim arrPlane
Dim arrplaneRef : arrPlaneRef = Rhino.WorldXYPlane
Dim srf, borders, borderCent
Dim newOrigin

Dim counter : counter = -1

Call rhino.EnableRedraw(False)
For i = 0 To Ubound(arrCrvs)
arrpts = Rhino.DivideCurveLength(arrCrvs(i), 0.3)
If isArray(arrpts) Then
For j = 0 To UBound(arrpts)

counter = counter +1
If counter < 6 Then
If counter = 0 Then
xLayer = 0.8
yLayer = 0.8
Else
xLayer = xLayer+0.1
yLayer = yLayer+0.1
End If
Else
xLayer = xLayer-0.1
yLayer = yLayer-0.1
If xLayer = 0.8 Then
counter = 0
End If
End If

newOrigin = Rhino.PointAdd(arrpts(j), array(-xLayer/2,-yLayer/2,0))
arrPlane = rhino.MovePlane(arrplaneRef, newOrigin)
srf = Rhino.AddPlaneSurface (arrplane, xLayer, yLayer)

‘Rhino.SelectObject srf
‘Rhino.Command (“Dupborder”)
‘Rhino.UnselectAllObjects
‘Rhino.DeleteObject srf
Next
End If
Next
Call rhino.EnableRedraw(True)

End Sub

JA_2

Option Explicit
‘Script written by <insert name>
‘Script copyrighted by <insert company name>
‘Script version Wednesday, October 01, 2008 3:42:11 PM

Call Main()
Sub Main()

Dim arrCrvs : arrCrvs = rhino.GetObjects(“pick crvs”)
Dim i,j
Dim xLayer,yLayer
Dim arrpts
Dim arrPlane
Dim arrplaneRef : arrPlaneRef = Rhino.WorldXYPlane
Dim srf, borders, borderCent
Dim newOrigin

Dim counter : counter = -1

Call rhino.EnableRedraw(False)
For i = 0 To Ubound(arrCrvs)
arrpts = Rhino.DivideCurveLength(arrCrvs(i), 0.4)
If isArray(arrpts) Then
For j = 0 To UBound(arrpts)

counter = counter +1
If counter < 10 Then
If counter = 0 Then
xLayer = 2.5
yLayer = 2.5
Else
xLayer = xLayer+0.1
yLayer = yLayer+0.1
End If
Else
xLayer = xLayer-0.1
yLayer = yLayer-0.1
If counter = 21 Then
counter = 0
End If
End If

newOrigin = Rhino.PointAdd(arrpts(j), array(-xLayer/2,-yLayer/2,0))
arrPlane = rhino.MovePlane(arrplaneRef, newOrigin)
srf = Rhino.AddPlaneSurface (arrplane, xLayer, yLayer)

‘Rhino.SelectObject srf
‘Rhino.Command (“Dupborder”)
‘Rhino.UnselectAllObjects
‘Rhino.DeleteObject srf
Next
End If
Next
Call rhino.EnableRedraw(True)

End Sub

 

 

 

 

 

 

 

 

EM_Sphere Generation

http://ncertainties2.files.wordpress.com/2008/10/balls.jpg?w=500&h=357

This script is creating several generations of groups of spheres at different height:

Option Explicit
‘If it is working then scripted by Eduardo Mayoral
‘If Not scripted by anyone else

Call Spheres()

Sub Spheres()
 
 ’===================================================
 ’  Set Up Starting Position
 ’===================================================
 
 Dim arrPt1, intGenerations
 
 arrPt1=Rhino.GetPoint
 intGenerations = Rhino.GetInteger

 Call generate(arrPt1, intGenerations, 1)
  
End Sub

‘===================================================
‘  Function to generate number of Spheres
‘===================================================

Function generate(arrPt, intGenerations, intCurrentGen)
 
 If intCurrentGen < intGenerations Then
 
  Dim intSpheres, arrGenPt
  
  intSpheres = CInt(funcRnd(5,3)) 
  Rhino.Print intSpheres
 
  arrGenPt =  funcGeom(intSpheres,arrPt) 
  
  Call generate(arrGenPt, intGenerations, intCurrentGen+1)
 
 End If
 
End Function

‘===================================================
‘  Function to control Distances between Spheres
‘===================================================

Function funcGeom(intSpheres,arrPt)
 
 Dim i, strLine, dblAngle, arrEndPt, Lines
 Dim d1, d2
  
 d1 = funcRD (12,9)
 d2 = funcRD (40,30)
 
 dblAngle = 360/intSpheres

 For i = 0 To intSpheres

  If i <> intSpheres Then
   
   strLine = Rhino.AddLine(arrPt, array(arrPt(0),arrPt(1)+d2,arrPt(2)+2*d2))
   Call Rhino.RotateObject(strLine,arrPt,(i*dblAngle))
   
   arrEndPt = Rhino.CurveEndPoint(strLine)   
   Call Rhino.AddSphere(arrEndPt,funcRnd(15,3))
   
   
  Else
   
   strLine = Rhino.AddLine(arrPt, array(arrPt(0),arrPt(1)+d2,arrPt(2)+d1))   
   Call Rhino.RotateObject(strLine,arrPt,funcRnd(360,dblAngle))
   
   arrEndPt = Rhino.CurveEndPoint(strLine)
   
   funcGeom = arrEndPt
   
  End If
  
 Next
 
 Lines = Rhino.ObjectsByType(4)
 Call Rhino.DeleteObjects(Lines)
 
End Function

‘===================================================
‘  Random Function for Distances and Radius
‘===================================================

Function funcRnd(intMax,intMin)
 
 Randomize
 
 funcRnd = (intMax – intMin)+(rnd+intMin)
 
End Function

 

EM_Main Trajectory

Option Explicit

Call Main()

Sub Main()

Rhino.AddLayer(“Cloud”)
Rhino.CurrentLayer(“Cloud”)

Dim arrPts : arrPts = Rhino.GetObjects(“Select Cloud of Points”,1)
Dim StPt : StPt = Rhino.GetPoint(“Select Starting Point”)
Dim nGen : nGen = Rhino.GetInteger(“Input Number of Generations”)

Call funcTrajectory(arrPts, StPt, nGen, 1)

‘Call Rhino.ObjectLayer(arrPts, Cloud)
‘Rhino.LayerVisible Cloud, False
Call Rhino.HideObjects(arrPts)

Rhino.AddLayer(“Trajectory”)
Rhino.CurrentLayer(“Trajectory”)
Rhino.Command “_CurveThroughPolyline”

Call Rhino.GetObjects(“Select Voronoi1 Points”, 1)
Rhino.AddLayer(“Voronoi1″)
Rhino.CurrentLayer(“Voronoi1″)
Rhino.Command (“Voronoi _enter”)
Rhino.Command(“_Ungroup”)

Call funcVoronoi()

Call Rhino.GetObjects(“Select Voronoi2 Points”, 1)
Rhino.AddLayer(“Voronoi2″)
Rhino.CurrentLayer(“Voronoi2″)
Rhino.Command (“Voronoi”)
Rhino.Command(“_Ungroup”)

End Sub

Function funcTrajectory(arrPts, StPt, nGen, minNGen)

Rhino.AddLayer(“Path”)
Rhino.CurrentLayer(“Path”)

If minNGen < nGen Then

Dim d1 : d2 = funcRnd(5000, 4000)
Dim d2 : d2 = funcRnd(5000, 4000)
Dim AuxLine1 : AuxLine1 = Rhino.AddLine(StPt, array(StPt(0)+d1,StPt(1)+d2,StPt(2)))

Call Rhino.RotateObject(AuxLine1,StPt,funcRnd(200,0))
Dim EndPt1 : EndPt1 = Rhino.CurveEndPoint(AuxLine1)

Dim i, DistTest, ClosestDist, ClosestPt, arrPtsCoord()

ClosestDist = 0

For i = 0 To UBound(arrPts)

ReDim Preserve arrPtsCoord(i) : arrPtsCoord(i) = Rhino.PointCoordinates(arrPts(i))
DistTest = Rhino.Distance(EndPt1, arrPtsCoord(i))

If DistTest = 5 Then

sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2),aCtrlPts(3), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),200,True)
Else
sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),200,True)

For k = 0 To UBound(aptsdiv)

aparam = Rhino.CurveClosestPoint(sCrv,aptsdiv(k))
apttemp = Rhino.EvaluateCurve(sCrv,aparam)
scrvmid = Rhino.AddLine(aptsdiv(k), apttemp)
aptmid = Rhino.CurveMidPoint(scrvmid)

Call Rhino.AddPoint(aptmid)
Call Rhino.DeleteObject(scrvmid)

Next
End If
Next

End Function

Function funcRnd(max,min)

Randomize
funcRnd = (max-min)*rnd+min

End Function

JA_3

Option Explicit
‘Script written by <insert name>
‘Script copyrighted by <insert company name>
‘Script version Wednesday, October 01, 2008 3:42:11 PM

Call Main()
Sub Main()

Dim arrCrvs : arrCrvs = rhino.GetObjects(“pick crvs”)
Dim i,j
Dim xLayer,yLayer
Dim arrpts
Dim arrPlane
Dim arrplaneRef : arrPlaneRef = Rhino.WorldXYPlane
Dim srf, borders, borderCent
Dim newOrigin

Dim counter : counter = -1

Call rhino.EnableRedraw(False)
For i = 0 To Ubound(arrCrvs)
arrpts = Rhino.DivideCurveLength(arrCrvs(i), 0.4)
If isArray(arrpts) Then
For j = 0 To UBound(arrpts)

counter = counter +1
If counter < 130 Then
If counter = 0 Then
xLayer = 5
yLayer = 5
Else
xLayer = xLayer-0.015
yLayer = yLayer-0.015
End If
Else
If counter < 160 Then
xLayer = xLayer-0.05
yLayer = yLayer-0.05
Else
xLayer = xLayer+0.05
yLayer = yLayer+0.05
End If
If xLayer > 1.25 Then
counter = 130
End If
End If

newOrigin = Rhino.PointAdd(arrpts(j), array(-xLayer/2,-yLayer/2,0))
arrPlane = rhino.MovePlane(arrplaneRef, newOrigin)
srf = Rhino.AddPlaneSurface (arrplane, xLayer, yLayer)

‘Rhino.SelectObject srf
‘Rhino.Command (“Dupborder”)
‘Rhino.UnselectAllObjects
‘Rhino.DeleteObject srf
Next
End If
Next
Call rhino.EnableRedraw(True)

End Sub

 

EM_Lofted Worm

http://ncertainties2.files.wordpress.com/2008/10/worm.jpg?w=500&h=248

This script is dividing a curve and drawing ellipses in each division to finally loft them:

Option Explicit
‘If it is working then scripted by Eduardo Mayoral
‘If Not scripted by anyone else

Call Worm()

Sub Worm()
 
 ’============================================
 ’  Selecting and Evaluating Path Curve
 ’============================================
 
 Dim crvObject : crvObject = Rhino.GetObject(“Select a Curve”, 4, True, False)
 Dim intSamples : intSamples = Rhino.GetInteger(“Number of Cross Sections”, 50, 5)
 
 Dim crvDomain : crvDomain = Rhino.CurveDomain(crvObject)
 Dim t, n

 Dim arrCrossSections(), CrossSectionPlane
 Dim crvCurvature, crvPoint, crvTangent, crvPerp, crvNormal
 
 n = -1

 For t = crvDomain(0) To crvDomain(1) + 1e-9 Step (crvDomain(1)-crvDomain(0))/intSamples

  Dim dblBendRadius : dblBendRadius = random(3,3.5)
  Dim dblPerpRadius : dblPerpRadius = random(3,3.5)

  n = n+1
  
  crvCurvature = Rhino.CurveCurvature(crvObject, t)

  If IsNull(crvCurvature) Then
   
   crvPoint = Rhino.EvaluateCurve(crvObject, t)
   crvTangent = Rhino.CurveTangent(crvObject, t)
   crvPerp = Array(0,0,1)
   crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)

  Else
   
   crvPoint = crvCurvature(0)
   crvTangent = crvCurvature(1)
   crvPerp = Rhino.VectorUnitize(crvCurvature(4))
   crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp)

  End If
   
  ’============================================
  ’  Drawing Sections and Lofting
  ’============================================

  CrossSectionPlane = Rhino.PlaneFromFrame(crvPoint, crvPerp, crvNormal)
  ReDim Preserve arrCrossSections(n)
  arrCrossSections(n) = Rhino.AddEllipse(CrossSectionPlane, dblBendRadius, dblPerpRadius)

 Next
 
 If n < 1 Then Exit Sub
 
 Call Rhino.AddLoftSrf(arrCrossSections)
 Call Rhino.DeleteObjects(arrCrossSections)

End Sub

 ’============================================
 ’  Random Function for the Ellipse Radius
 ’============================================

Function random(intLow,intUp)
 
 Randomize
 
 random = (intUp-intLow) * Rnd() + intLow
 
End Function

 

EM_hole maker

Option Explicit

Call Main()
Sub Main()

Dim scrvs : scrvs = Rhino.GetObjects(“Pick Voronoi Cells”,4)

Dim j,k
Dim aCtrlPts, scrv, aptsdiv, scrvmid, aparam, apttemp, aptmid

For j = 0 To UBound(scrvs)

aCtrlPts = Rhino.PolylineVertices(scrvs(j))

If UBound(aCtrlPts) >= 5 Then

sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2),aCtrlPts(3), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),400,True)
Else
sCrv = Rhino.AddCurve(array(aCtrlPts(0),aCtrlPts(1),aCtrlPts(2), aCtrlPts(0)))
aptsdiv = Rhino.DivideCurveLength(scrv,200,True)
aptsdiv = Rhino.DivideCurveLength(scrvs(j),400,True)

For k = 0 To UBound(aptsdiv)

aparam = Rhino.CurveClosestPoint(sCrv,aptsdiv(k))
apttemp = Rhino.EvaluateCurve(sCrv,aparam)
scrvmid = Rhino.AddLine(aptsdiv(k), apttemp)
aptmid = Rhino.CurveMidPoint(scrvmid)

Call Rhino.AddPoint(aptmid)
Call Rhino.DeleteObject(scrvmid)

Next
End If
Next
End Sub

 

EM_curve generator

Option Explicit

Call Main()
Sub Main()

Call Rhino.AddLayer(“Voro3DCurves”, RGB(0, 255, 0))
Rhino.CurrentLayer(“Voro3DCurves”)

Dim aCrvs : aCrvs = Rhino.GetObjects(“Pick Voronoi Cells”, 4)

Dim i,j

For i = 0 To UBound( aCrvs)

Dim x,y,z,d
x = funcRnd(0.9,0)
y = x + funcRnd(0.3,0.1)
‘y = funcRnd(0.9,0)
‘y = x
‘z = funcRnd(1,0.9)
z = 1
d = funcRnd(0.5,0.1)

If Rhino.IsCurveClosed(aCrvs(i)) And Rhino.IsPolyline(aCrvs(i)) Then

Dim aCtrlPts : aCtrlPts = Rhino.PolylineVertices(acrvs(i))
ReDim aPts(UBound(aCtrlPts)+1)
For j = 0 To UBound(aCtrlPts)
Dim aPlane : aPlane = Rhino.WorldXYPlane
Dim vDir : vDir = Rhino.VectorScale(aPlane(3), funcRnd(600,500))
aPts(j) = Rhino.PointAdd(aCtrlPts(j), vDir)
Next
aPts(UBound(aCtrlPts)+1) = aPts(0)

Dim VoroCurve3D : VoroCurve3D = Rhino.AddCurve(aPts)
Dim arrBBox: arrBBox = Rhino.BoundingBox(VoroCurve3D)
Dim arrCntrPt : arrCntrPt = array((((arrBBox(2)(0)) + (arrBBox(0)(0))) / 2)+d, (((arrBBox(2)(1)) + (arrBBox(0)(1))) / 2)+d, (((arrBBox(0)(2)) + (arrBBox(4)(2))) / 2)+d)
Dim ScVoroCurve3D : ScVoroCurve3D = Rhino.ScaleObject(VoroCurve3D,arrCntrPt,array(x,y,z),True)
Call Rhino.ObjectColor(ScVoroCurve3D, RGB(0, 0, 255))

End If
Next

‘Rhino.Command(“_MeshPatch”)
‘Rhino.Command(“_OffsetMesh”)

End Sub
Function funcRnd(max,min)

Randomize
funcRnd = (max-min) * Rnd + min

End Function

 

AN_Clay cracks

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archiologics
‘Script version Thursday, October 30, 2008 1:27:08 PM

Call Main()
Sub Main()
 
 Dim intU,intV, uDom, vDom, strSrf
 strSrf = Rhino.GetObject(“srf”,8,True)
 
 intU = Rhino.GetInteger(“u”,10)
 intV = Rhino.GetInteger(“v”,5)
 uDom = Rhino.SurfaceDomain(strSrf,0)
 vDom = Rhino.SurfaceDomain(strSrf,1)
 
 Dim uStep : uStep = (UDom(1) – UDom(0)) / intU
 Dim vStep : vStep = (VDom(1) – VDom(0)) / intV
 
 Dim t,s, u, v
 ReDim arrFrame(intU,intV)
 Dim n,m, aPt, iRnd, p
 
 
 Call rhino.EnableRedraw(False)
 For t = 0 To intU
  For s = 0 To intV
   
   u = uDom(0) + uStep * t
   v = vDom(0) + vStep * s
   
   arrFrame(t,s) = Rhino.SurfaceFrame (strSrf, Array(u,v))
   ’Rhino.AddPoint(arrFrame(t,s)(0))
   
   ’If t >= 1 And s >= 1 Then
   ’ Call rhino.addline(arrFrame(t,s)(0),arrFrame(t-1,s-1)(0)) 
   ’End If
   
   ’If t >= 1 And s >= 1 Then
   ’ Call rhino.addline(arrFrame(t-1,s)(0),arrFrame(t,s-1)(0)) 
   ’End If
   
   If t >= 1 And s >= 1 Then

    Dim aPtsQuad : aPtsQuad = array(arrFrame(t,s)(0),arrFrame(t,s-1)(0), arrFrame(t-1,s-1)(0),arrFrame(t-1,s)(0))
    
    iRnd = rnd
    
    If iRnd > 0.6 Then
     Rhino.Print “rnd>.6″
     Call rhino.addSrfpt(aPtsQuad)
    End If
    
    If iRnd > 0.3 And iRnd <= 0.6   Then
     aPt = rndCPtWithin(aPtsQuad)
     For n = 1 To UBound(aPtsQuad)
      Call rhino.addSrfpt(array(aPtsQuad(n), aPtsQuad(n-1), aPt))
      If n = UBound(aPtsQuad) Then
       Call rhino.addSrfpt(array(aPtsQuad(n), aPtsQuad(0), aPt))
      End If
     Next
    End If
    
    If iRnd <= 0.3   Then
     Rhino.AddPolyline(aPtsQuad)
     aPt = rndCPtWithin(aPtsQuad)
     For n = 1 To UBound(aPtsQuad)
      Dim aPtsTri : aPtsTri = array(aPtsQuad(n), aPtsQuad(n-1), aPt)
      Dim width : width = 0.02
      Dim NraPtsTri : NraPtsTri = array(Rhino.VectorAdd(aPtsQuad(n),Rhino.VectorReverse(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(strSrf,Rhino.SurfaceClosestPoint(strSrf,aPtsQuad(n)))),width))),_
       Rhino.VectorAdd(aPtsQuad(n-1),Rhino.VectorReverse(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(strSrf,Rhino.SurfaceClosestPoint(strSrf,aPtsQuad(n-1)))),width))),_
       Rhino.VectorAdd(aPt,Rhino.VectorReverse(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(strSrf,Rhino.SurfaceClosestPoint(strSrf,aPt))),width))))
      
      Dim aPt2: aPt2 = rndCPtWithin(aPtsTri)
      
      ’CALCULATE NORMAL POINT BASED ON TRIANGLE RND PT WITHIN
      Dim scalefactor : scalefactor = Rnd*1.25
      Dim aPt2Normal : aPt2Normal = Rhino.SurfaceNormal(strSrf,Rhino.SurfaceClosestPoint(strSrf,aPt2))
      aPt2Normal = Rhino.VectorReverse(Rhino.VectorScale(Rhino.VectorUnitize (aPt2Normal),scalefactor))
      aPt2Normal = Rhino.PointAdd (aPt2,aPt2Normal)
      
      ’CALCULATE THE OTHER NORMAL TO HAVE THICK ELEMENTS (TO OBTAIN THE SECOND PATCH SURFACE TO JOIN TO THE PRECIOUS ONE)
      Dim NraPt2 : NraPt2 = Rhino.VectorAdd(aPt2,Rhino.VectorReverse(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(strSrf,Rhino.SurfaceClosestPoint(strSrf,aPt))),(scalefactor-width))))
      
      For m = 1 To UBound(aPtsTri)
       
       Call rhino.addSrfpt(array(aPtsTri(m), aPtsTri(m-1), aPt2))
       
       ’DEFINE POINTS FOR STRPATCH
       Dim Line1 : Line1 = Rhino.AddLine(aPtsTri(m-1), aPtsTri(m))
       Dim L1Ptsdiv : L1PtsDiv = Rhino.DivideCurve(Line1, 3)
       Dim Line2 : Line2 = Rhino.AddLine(aPtsTri(m), aPt2)
       Dim L2Ptsdiv : L2PtsDiv = Rhino.DivideCurve(Line2, 3)
       Dim Line3 : Line3 = Rhino.AddLine(aPt2, aPtsTri(m-1))
       Dim L3Ptsdiv : L3PtsDiv = Rhino.DivideCurve(Line3, 3)
       Dim strPatchCrv : strPatchCrv = Rhino.AddCurve (array(aPtsTri(m-1),L1Ptsdiv(2),L1Ptsdiv(1),aPtsTri(m),L2Ptsdiv(1),L2Ptsdiv(2),aPt2Normal,L3Ptsdiv(1),L3Ptsdiv(2),aPtsTri(m-1)))
       
       Rhino.SelectObject StrPatchCrv
       Rhino.Command “-patch p=1 u=10 v=10 s=1 a=yes t=yes enter”
       Dim strPatch : strPatch = Rhino.FirstObject
       Rhino.UnselectAllObjects
       
       ’DEFINE POINTS FOR STRPATCHNORMAL
       
       Dim NrLine1 : NrLine1 = Rhino.AddLine(NraPtsTri(m-1), NraPtsTri(m))
       Dim NrL1Ptsdiv : NrL1PtsDiv = Rhino.DivideCurve(NrLine1, 3)
       Dim NrLine2 : NrLine2 = Rhino.AddLine(NraPtsTri(m), NraPt2)
       Dim NrL2Ptsdiv : NrL2PtsDiv = Rhino.DivideCurve(NrLine2, 3)
       Dim NrLine3 : NrLine3 = Rhino.AddLine(NraPt2, NraPtsTri(m-1))
       Dim NrL3Ptsdiv : NrL3PtsDiv = Rhino.DivideCurve(NrLine3, 3)
       Dim NrstrPatchCrv : NrstrPatchCrv = Rhino.AddCurve (array(NraPtsTri(m-1),NrL1Ptsdiv(2),NrL1Ptsdiv(1),NraPtsTri(m),NrL2Ptsdiv(1),NrL2Ptsdiv(2),NraPt2,NrL3Ptsdiv(1),NrL3Ptsdiv(2),NraPtsTri(m-1)))
       
       Rhino.SelectObject NrStrPatchCrv
       Rhino.Command “-patch p=1 u=10 v=10 s=1 a=yes t=yes enter”
       Dim NrstrPatch : NrstrPatch = Rhino.FirstObject
       Rhino.UnselectAllObjects       
       
       If Rhino.IsSurfaceTrimmed(strPatch) And Rhino.IsSurfaceTrimmed(NrstrPatch)Then
        Dim strLoftSrf : strLoftSrf = Rhino.AddLoftSrf(array(strPatchCrv,NrstrPatchCrv))
        Rhino.JoinSurfaces(array(strPatch,strLoftSrf(0),NrstrPatch))
       Else
        Rhino.DeleteObject(strPatch)
        Rhino.DeleteObject(NrstrPatch)
       End If
              
       If m = Ubound(aPtsTri) Then
        Call rhino.addSrfpt(array(aPtsTri(m), aPtsTri(0), aPt2))
        Line1 = Rhino.AddLine (aPtsTri(m),aPtsTri(0))
        L1PtsDiv = Rhino.DivideCurve(Line1, 3)
        Line2 = Rhino.AddLine (aPtsTri(0),aPt2)
        L2PtsDiv = Rhino.DivideCurve(Line2, 3)
        Line3 = Rhino.AddLine (aPt2,aPtsTri(m))
        L3PtsDiv = Rhino.DivideCurve(Line3, 3)
        Rhino.AddCurve array(aPtsTri(m),L1Ptsdiv(1),L1Ptsdiv(2),aPtsTri(0),L2Ptsdiv(1),L2Ptsdiv(2),aPt2,L3Ptsdiv(1),L3Ptsdiv(2),aPtsTri(m))
       End If       
      Next
      If n = Ubound(aPtsQuad) Then
       Call rhino.addSrfpt(array(aPtsQuad(n),aPtsQuad(0),aPt))
      End If
     Next
    End If
   End If
  Next
 Next
 Rhino.HideObject strSrf
 Call rhino.EnableRedraw(True)  
End Sub

Function rndCPtWithin(aPts)
 
 Dim i, x, y, z
 x = aPts(0)(0) : y = aPts(0)(1) : z = aPts(0)(2)
 For i = 1 To Ubound(aPts)
  x = x + aPts(i)(0)
  y = y + aPts(i)(1)
  z = z + aPts(i)(2)
 Next
 x = x / (UBound(aPts)+1)
 y = y / (UBound(aPts)+1)
 z = z / (UBound(aPts)+1)
 Dim aPtCenter : aPtCenter = array(x,y,z)
 
 Dim sPt : sPt = Rhino.AddPoint(aPtCenter)
 Call rhino.ObjectColor(sPt, vbred)
 
 Dim scrv : sCrv = rhino.AddPolyline(aPts)
 
 If Not Rhino.IsCurveClosed(sCrv) And Rhino.IsCurveClosable(sCrv) Then
  sCrv = Rhino.CloseCurve (scrv)
 End If
 
 Rhino.ObjectColor scrv,vbBlue
 Dim aPtsdiv : aPtsDiv = rhino.DivideCurve(sCrv, 30)
 Dim aPtDir : aPtDir = aPtsdiv(int(UBound(aPtsDiv)* rnd))
 Dim vDir : vDir = rhino.VectorCreate(aptDir, aPtcenter)
 vDir = rhino.VectorScale(vDir, rnd)
 rndCPtWithin = rhino.PointAdd(aPtcenter, vDir)
 
 Call rhino.DeleteObject(scrv)
  
End Function

AN_Digging in box

Option Explicit
‘Script written by Adolfo Nadal
‘Script Copyrighted by Archiologics

Call Main()
Sub Main()
 
 Dim inLayer
 inLayer = Rhino.GetString(“Introduce new Layers?”,”yes”,array(“yes”,”no”))
 If inLayer = “yes” Then
  Call AddLayers
 End If
 
 Dim arrPtSeed : arrPtSeed = Rhino.GetObject(“Base Point”,1)
 arrPtSeed = Rhino.PointCoordinates(arrPtSeed)
 If IsNull (arrPtSeed) Then Exit Sub
 
 Dim n : n = Rhino.GetInteger(“nr of points”, 10)
 
 ” SPEED:
 ’Dim bbox : bbox = Rhino.BoundingBox(strSrf)
 Dim min : min = -500 ‘Rhino.Distance(bbox(0),bbox(6))/8
 Dim max : max =  200 ‘Rhino.Distance(bbox(0),bbox(6))/4
 Dim Density : Density = 2
 
 Dim i, j, k, l, g : k = 1 : i = 0
 Dim arrPt, arrLines()
 Dim arrPtsCollect()
 
 ReDim Preserve arrPtsCollect(0)
 arrPtsCollect(0) = arrPtSeed
 
 ’————————————————————————————-
 ’————————————————————————————-
 Do Until k = n+1
  arrPt = array(arrPtSeed(0)+arbitraryValue(min, max),arrPtSeed(1) + arbitraryValue(min, max),arrPtSeed(2)- abs(1/2*arbitraryValue(min, max)))
  
  Dim arrPtNeighBor : arrPtneighbor = shortestPt(arrPtsCollect, arrPt)
  
  If arrPtneighbor(2) < min/2 Then
   arrPtneighbor(2)=0
  End If
  
  ReDim Preserve arrLines(k-1)
  arrLines(k-1) = Rhino.AddLine(arrPt, arrPtNeighBor)
 
  ReDim Preserve arrPtsCollect(k)
  arrPtsCollect(k) = arrPt
  k = k + 1
 Loop
 ’————————————————————————————-
 ’————————————————————————————-

 Dim arrPoly : arrPoly = Rhino.JoinCurves(arrLines,True)
 Rhino.Print “From ” & Ubound(arrLines)+1 & ” segments ” & Ubound(arrPoly)+1 & ” polylines were extracted. Segments erased”
 
 ’————————————————————————————-
 ’————————————————————————————-
 
 For j=0 To Ubound(arrPoly)-1

  Dim StrtPt, EndPt
  StrtPt = Rhino.CurveStartPoint(arrPoly(j))
  EndPt = Rhino.CurveEndPoint(arrPoly(j))
  
  Dim strtvl, endvl, endvllength
  ’sometimes complains it does not find a string!!!
  If StrtPt(2)<>0 Then
   strtvl = Rhino.AddLine (StrtPt,array(StrtPt(0),StrtPt(1),0))
  End If
  
  If EndPt(2)<>0 Then
   endvl = Rhino.AddLine (EndPt, array(EndPt(0),EndPt(1),0))
   endvllength= Rhino.CurveLength(endvl)
   Rhino.Print endvl
  End If
  
  If Not IsNull(strtvl) Then
   ReDim arrPolyfinal(j)
   ’—————————————————————
   ’arrPolyfinal is a temp array to store the result, since the method joinCurves returns an array… this way we can avoid having nested arrays.
   arrPolyfinal(j) = Rhino.JoinCurves(array(arrPoly(j),strtvl),True)
   arrPoly(j) = arrPolyfinal(j)(0)
   Rhino.Print “so far, index j is ” & j
   If endvllength > Rhino.UnitRelativeTolerance Then
    If Not IsNull(endvl) And IsCurve(arrPoly(j)) Or IsPolyCurve(arrPoly(j)) Or IsPolyline(arrPoly(j)) Then
     ReDim arrPolyfinal(j)
     arrPolyfinal(j) = Rhino.JoinCurves(array(arrPoly(j),endvl) ,True)
     arrPoly(j) = arrPolyfinal(j)(0)
    End If
   End If
  Else
   If Not IsNull(endvl) Then
    arrPolyfinal(j) = Rhino.JoinCurves(array(arrPoly(j),endvl) ,True)
    arrPoly(j) = arrPolyfinal(j)(0)
   End If
  End If
  
  Dim Length
  Length = Rhino.CurveLength(arrPoly(j))
  If Length < max/density Then
   Rhino.DeleteObject(arrPoly(j))
   j=j-1
  End If
  
  Dim hl
  ’Add a (horizontal) line between end and start points
  StrtPt = Rhino.CurveStartPoint(arrPoly(j))
  EndPt = Rhino.CurveEndPoint(arrPoly(j))
  hl = Rhino.AddInterpCurve (array(StrtPt,EndPt))
  
  ’Add annotation text
  Dim txt1: txt1 = Rhino.AddText (“Crv ” & j & vbCrLf & “l= ” & Length,StrtPt,15,”Verdana”)  
  ’Change layers  
  Rhino.ObjectLayer txt1,”text”
  ’Rhino.ObjectLayer txt2,”text”
  Rhino.ObjectLayer hl,”annotations”
  
 Next
 ’————————————————————————————-
 ’————————————————————————————-

 ’we make curves out of the polyline
 ’————————————————————————————-
 ’————————————————————————————-
 Dim arrPolytmp()
 For l=0 To Ubound(arrPoly)
  ReDim arrPolytmp(l)
  arrPolytmp(l) = Rhino.CurvePoints (arrPoly(l))
  For g=0 To Ubound(arrPolytmp(l))-1
   Dim txt2
   txt2 = Rhino.AddText (“Pt ” & l & “,” & g & vbCrLf & “Zcoord: ” & arrPolytmp(l)(g)(2), arrPolytmp(l)(g), 5,”verdana”)
   Rhino.ObjectLayer txt2,”text”
   Call Rhino.ObjectColor(txt2,ParameterColor(Abs(arrPolytmp(l)(g)(2)/(min/density))))
  Next
  arrPoly(l)= Rhino.AddInterpCurve(arrPolytmp(l),3)
 Next
 ’————————————————————————————-
 ’————————————————————————————-
 
 Rhino.ObjectLayer arrPoly,”Polylines”
 Dim inHelix, npt
 inHelix = Rhino.GetString(“Run submachines?”,”yes”,array(“yes”,”no”))
 If inHelix = “yes” Then
  Dim counter, nhelix
  nhelix = Rhino.GetInteger(“nr of machines per line”,3,,4)
  npt = Rhino.GetInteger(“nr of points”,20,20)
  For counter=0 To Ubound (arrPoly)
   ’Rhino.SelectObject arrPoly(counter)
   Call HelixC (arrPoly(counter), StrtPt,nhelix,npt,.2,.2,10,20, Length/75)
   Rhino.CurrentLayer(“Default”)
   Rhino.UnselectAllObjects
  Next
 End If 
End Sub

Function ParameterColor(dblParam)
 Dim RedComponent : RedComponent = 255 * dblParam
 If (RedComponent<0) Then RedComponent = 0
 If (RedComponent>255) Then RedComponent = 255
 
 ParameterColor = RGB(RedComponent, 0, 255 – RedComponent)
 
End Function

Function shortestPt(arrPtsCollection, arrPtTest)
 Dim i
 Dim dblDistMin : dblDistMin = 100000000
 For i = 0 To UBound(arrPtsCollection)
  Dim dblDist : dblDist = rhino.Distance(arrPtTest, arrPtsCollection(i))
  If dbldist <> 0 Then
   If dblDist < dblDistMin Then
    dblDistMin = dblDist
    shortestPt = arrPtsCollection(i)
   End If
  End If
 Next
End Function

Function arbitraryValue(min, max)
 Randomize
 arbitraryValue = Int((max – min + 1) * Rnd + min)
End Function

Function AddLayers
 If Not IsLayer(“Script”) Then
  Rhino.AddLayer “Script”,RGB(0, 0, 0),True,False
 End If
 
 If Not IsLayer(“Polylines”) Then
  Rhino.AddLayer “Polylines”,RGB(128, 0, 128),True,False,”Script”
  Rhino.LayerLinetype “Polylines”, “Continuous”
 End If
 
 If Not IsLayer(“Points”) Then
  Rhino.AddLayer “Points”,RGB(0, 0, 0),True,False,”Script”
  Rhino.LayerLinetype “Polylines”, “Continuous”
 End If
 
 If Not IsLayer(“Annotations”) Then
  Rhino.AddLayer “Annotations”,RGB(128, 128, 128),True,False,”Script”
  Rhino.LayerLinetype “Polylines”, “Dots”
 End If
 
 If Not IsLayer(“Helix”) Then
  Rhino.AddLayer “Helix”,RGB(89, 50, 89),True,False,”Script”
  Rhino.LayerLinetype “Polylines”, “Dashed”
 End If
 
 If Not IsLayer(“Text”) Then
  Rhino.AddLayer “Text”,RGB(0, 0, 0),True,False,”Script”
  Rhino.LayerLinetype “Text”, “Continuous”
 End If
 
End Function

Function HelixC(strCrv,basePt,nhelix,npt, ByVal dblBendRadius,ByVal dblPerpRadius, Rotations, ByVal Diam,ByVal textsize)

 Rhino.CurrentLayer(“Helix”)
 Dim crvDomain
 
 Dim t, m
 Dim arrCrossSections(), CrossSectionPlane
 Dim crvCurvature, crvPoint, crvTangent, crvPerp, crvNormal
 Dim arrPt()
 Dim ptLine(), TgLine(), NrLine(), tmpVector
 ’Dim rotations : rotations= Rhino.GetInteger(“please enter nr of rotations”,10,1)
 Dim crvHelix
 Dim diameter : diameter = 6
 Dim Poly
 
 Dim k, i, rad
 For k = 0 To nhelix-1
  Dim tmprotation : tmprotation = 360/nhelix*(k+1)
  Dim factor : factor = 4
  ’rad = k/nsec*2*PI 
  
  crvDomain = Rhino.CurveDomain(strCrv)
  m = -1 
  For t = crvDomain(0) To crvDomain(1) + 1e-9 Step (crvDomain(1)-crvDomain(0))/npt
   m = m+1
   crvCurvature = Rhino.CurveCurvature(strCrv, t)
   If IsNull (crvCurvature) Then
    crvPoint = Rhino.EvaluateCurve(strCrv,t)
    crvTangent = Rhino.CurveTangent(strCrv,t)
    crvPerp = array(0,0,1)
    crvNormal = Rhino.VectorCrossProduct(crvTangent,crvPerp) 
   Else
    ’ CurveCurvature(0) returns point at the specified Perimeter on the curve
    crvPoint = crvCurvature(0)
    ’ CurveCurvature(1) returns the tangent vector
    crvTangent = crvCurvature(1)
    ’ CurveCurvature(4) returns the Curvature vector, meaning the one that goes from the pt on the curve to the center of curvature, therefore PERPENDICULAR
    ’crvPerp = Rhino.VectorUnitize(crvCurvature(4))
    crvPerp = crvCurvature(4)
    crvNormal = Rhino.VectorCrossProduct(crvTangent, crvPerp) 
   End If
   CrossSectionPlane = Rhino.PlaneFromFrame(crvPoint, crvPerp, crvNormal)
  
   ReDim Preserve arrPt(m)
   arrPt(m) = Rhino.VectorUnitize(crvPerp)
   arrPt(m) = Rhino.VectorScale(arrPt(m),100)
   arrPt(m) = Rhino.VectorRotate(arrPt(m),tmprotation,crvTangent)
   ’arrPt(m) = Rhino.AddPoint(Rhino.VectorRotate(Rhino.VectorScale(Rhino.VectorUnitize(crvPerp),dblPerpRadius),tmprotation,crvTangent))
  
   ’this adds the vector to put it to the needed position
   crvPerp= Rhino.VectorAdd(crvPoint,Rhino.VectorScale(crvPerp,factor))
   ’ReDim Preserve ptLine(m) : ptLine(m) = Rhino.AddLine ((crvPoint),crvPerp)
   ’Rhino.ObjectColor ptLine(m),vbred
   crvTangent = Rhino.VectorAdd(crvPoint,crvTangent)
   ’ReDim Preserve TgLine(m) : TgLine(m) = Rhino.AddLine (crvPoint,crvTangent)
   ’Rhino.ObjectColor TgLine(m),vbblue
   crvNormal = Rhino.VectorAdd(crvPoint,crvNormal)
   ’ReDim Preserve NrLine(m) : NrLine(m) = Rhino.AddLine (crvPoint,crvNormal)
   ’Rhino.ObjectColor NrLine(m),vbgreen
   ’here we take into account the initial angle (rad)
   crvHelix = Rhino.VectorRotate(crvPerp,tmprotation,crvTangent)
   ’crvHelix = Rhino.VectorRotate(crvPerp,(t*rad/(crvDomain(1)-crvDomain(0)))*Rotations,crvTangent)
   ReDim Preserve PolyPts(m)
   PolyPts(m) = Rhino.PointCoordinates(Rhino.AddPoint(crvHelix))
   ’Call Rhino.ObjectColor(crvHelix,ParameterColor(Abs(crvHelix(2)/(250))))
   Rhino.DeleteObjects(crvHelix)
  
   ’Rhino.Command “_Cplane _Previous”
   Rhino.UnselectAllObjects
  Next
  
  If m < 1 Then Exit Function
  
  Poly = Rhino.AddInterpCurve(PolyPts)
  Rhino.SelectObjects array(Poly)
  Rhino.Command “Pipe “&diameter/2&” “&diameter/2&” enter”
  Rhino.UnselectAllObjects
  Rhino.AddText “Settings 2: ” & vbCrLf & “1. Pipe radius= ” & (diameter/2) & vbCrLf & ” 2. Number of Spins: ” & (rotations) & vbCrLf & ” 3. Sample points: ” & (npt),array(basePt(0),basePt(1)-25, basePt(2)),textsize,”arial”
 Next
End Function

AN_Meander

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archi-o-logics
‘Script version Friday, October 17, 2008 6:01:58 PM

Call Main()
Sub Main()

Dim sCrv : sCrv = rhino.GetObject(“pick crv”, 4)

Dim i, j

Dim arrPtdiv()

Dim createdCrvs()
ReDim Preserve createdCrvs(0) : createdCrvs(0) = sCrv
For i = 0 To 6

Dim aEditpts : aEditpts = Rhino.CurveEditPoints (sCrv)
ReDim aptsCrvs(Ubound(aEditpts))

For j = 0 To Ubound(aEditpts)

Dim offsetdist: offsetdist = arbitraryValue(0, 10*j) +1
If i Mod 3 = 0 Then
If j Mod 2 = 0 Then
‘offsetdist < Ubound(aEditpts) Then
offsetdist=0
End If
If j Mod 2 =1 Then
offsetdist = offsetdist+1
End If
End If

Dim var

If i Mod 2 = 0 Then
var = 1
Else
var = 0
End If
aptsCrvs(j) = array(aEditpts(j)(0) + offsetdist,aEditpts(j)(1),aEditpts(j)(2)-20*(-1)^(var))

Next
‘If i <> 0 Then Call rhino.AddInterpCurve(aptsCrvs)
If i <> 0 Then
Dim sCrv2 : sCrv2 = rhino.AddInterpCurve(aptsCrvs)
ReDim Preserve arrPtdiv(i-1)
arrPtdiv(i-1) = Div_curvature(sCrv2)
Call rhino.ObjectColor(sCrv2, rgb(255/10*i, 0, 255/10*i))
ReDim Preserve createdCrvs(i) : createdCrvs(i) = sCrv2
sCrv = sCrv2
End If
Next
‘Add_lines arrPtdiv
Add_lines1 arrPtdiv,createdCrvs

End Sub

Function arbitraryValue(min, max)
Randomize
arbitraryValue = min + (max – min) * Rnd
End Function

Function Div_curvature(sCrv)
Rhino.EnableRedraw False
Dim i
Dim arrPtdiv()

Dim sCrv3 : sCrv3 = Rhino.CopyObject(sCrv)

Dim arrCrv : arrCrv = Rhino.ConvertCurveToPolyline(sCrv3,40,0.08)
Dim arrCrvEPt : arrCrvEPt = Rhino.CurveEditPoints(arrCrv)

Dim t
Dim crvDom : crvDom = Rhino.CurveDomain(sCrv)
Dim ACurv: ACurv = AverageCurv(t,sCrv,crvDom)

If IsArray(arrCrvEPt) Then
For i = 0 To Ubound(arrCrvEPt)
t = Rhino.CurveClosestPoint(sCrv,arrCrvEpt(i))
Dim crvCurv : crvCurv = Rhino.CurveCurvature(sCrv,t)(3)
‘Rhino.AddTextDot crvCurv & t,arrCrvEpt(i)
‘Rhino.Print “Point ” & i & “of ” & Ubound(arrCrvEpt)
‘ReDim Preserve arrPtdiv(i)
‘arrPtdiv(i) = Rhino.AddPoint(arrCrvEPt(i))
Next
Else
Rhino.Print “it is not an array”
End If
‘Div_curvature = arrPtdiv
Div_curvature = arrCrvEPt
Rhino.DeleteObjects(array(sCrv3,arrCrv))
Rhino.EnableRedraw True
End Function

Function add_lines(arrPtdiv)
Rhino.EnableRedraw False
Dim i, j
Dim counter : counter = 0

Do While (counter+3<=Ubound(arrPtdiv)+1)
If Ubound(arrPtdiv(counter))<Ubound(arrPtdiv(counter+2)) Then
For i = 1 To Ubound(arrPtdiv(counter))
Rhino.AddLine arrPtdiv(counter)(i),arrPtdiv(counter+2)(i-1)
Next
Else
For i = 1 To Ubound(arrPtdiv(counter+2))
Rhino.AddLine arrPtdiv(counter)(i),arrPtdiv(counter+2)(i-1)
Next
End If
counter = counter +3
Loop
Rhino.EnableRedraw True
End Function

Function add_lines1(arrPtdiv, createdCrvs)
Rhino.EnableRedraw False
Dim i, j
Dim counter : counter = 0

Do While (counter+3<=Ubound(arrPtdiv)+1)
If Ubound(arrPtdiv(counter))<Ubound(arrPtdiv(counter+2)) Then
For i = 1 To Ubound(arrPtdiv(counter))
Rhino.AddLine arrPtdiv(counter)(i),Rhino.EvaluateCurve(createdCrvs(counter+2),Rhino.CurveClosestPoint(createdCrvs(counter+2),arrPtdiv(counter)(i)))
Next
Else
For i = 1 To Ubound(arrPtdiv(counter+2))
Rhino.AddLine arrPtdiv(counter)(i),Rhino.EvaluateCurve(createdCrvs(counter+2),Rhino.CurveClosestPoint(createdCrvs(counter+2),arrPtdiv(counter)(i)))
Next
End If
counter = counter +3
Loop
Rhino.EnableRedraw True
End Function

AN_Meander Creator

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archi-o-logics
‘Script version Friday, October 17, 2008 6:01:58 PM

Call Main()
Sub Main()
 Dim sCrv : sCrv = rhino.GetObject(“pick crv”, 4)
 Dim i, j,l
 Dim arrPtdiv()
 
 Dim createdCrvs()
 ReDim Preserve createdCrvs(0) : createdCrvs(0) = sCrv
 Dim aEditpts
 
 Rhino.EnableRedraw False
 
 For i = 0 To 100
  aEditpts = Rhino.CurveEditPoints(sCrv)
  ReDim aptsCrvs(Ubound(aEditpts))
  
  For j = 0 To Ubound(aEditpts)
   Dim offsetdist: offsetdist = arbitraryValue(0, 10*i^(0.5)) +1
   If i Mod 2 =0 Then
    If j Mod 3= 0 Then
     offsetdist = 0
    End If   
   End If
   
   Dim var
   ’Dim ZVar: ZVar = 0
   If j<> 0 And j<>Ubound(aEditPts) Then
    ’ZVar = 4*i+1   
    If i Mod 2 = 0 Then
     var = 1
    Else
     var = 0
    End If
   End If
   
   If j=0 Or j=Ubound(aEditpts) Then
    offsetdist = offsetdist/2
   End If 
   aptsCrvs(j) = array(aEditpts(j)(0) + offsetdist,aEditpts(j)(1),aEditpts(j)(2))   
  Next
  ’—————————————————
  If i <> 0 Then
   Dim sCrv2 : sCrv2 = rhino.AddInterpCurve(aptsCrvs)
   ReDim Preserve arrPtdiv(i-1)
   arrPtdiv(i-1) = Div_curvature(sCrv2)
   Call rhino.ObjectColor(sCrv2, rgb(255/10*i, 0, 255/10*i))
   ReDim Preserve createdCrvs(i) : createdCrvs(i) = sCrv2
   sCrv = sCrv2
  End If
 Next
 
 Add_lines1 arrPtdiv,createdCrvs
 
 Rhino.EnableRedraw False
 
End Sub

Function arbitraryValue(min, max)
 Randomize
 arbitraryValue = min + (max – min) * Rnd
End Function
Function Div_curvature(sCrv)
 Rhino.EnableRedraw False
 Dim i
 Dim arrPtdiv()
 
 Dim sCrv3 : sCrv3 = Rhino.CopyObject(sCrv)
 
 Dim arrCrv : arrCrv = Rhino.ConvertCurveToPolyline(sCrv3,40,0.08)
 Dim arrCrvEPt : arrCrvEPt = Rhino.CurveEditPoints(arrCrv)
 
 Dim t
 Dim crvDom : crvDom = Rhino.CurveDomain(sCrv) 
 ’Dim ACurv: ACurv = AverageCurv(t,sCrv,crvDom)
 
 If IsArray(arrCrvEPt) Then
  For i = 0 To Ubound(arrCrvEPt)
   t = Rhino.CurveClosestPoint(sCrv,arrCrvEpt(i))
  Next
 Else
  Rhino.Print “it is not an array”
 End If 
 Div_curvature = arrCrvEPt
 Rhino.DeleteObjects(array(sCrv3,arrCrv))
 Rhino.EnableRedraw True
End Function
Function add_lines(arrPtdiv)
 Rhino.EnableRedraw False
 Dim i, j
 Dim counter : counter = 0
 
 Do While (counter+3<=Ubound(arrPtdiv)+1)
  If Ubound(arrPtdiv(counter))<Ubound(arrPtdiv(counter+2)) Then
   For i = 1 To Ubound(arrPtdiv(counter))
    Rhino.AddLine arrPtdiv(counter)(i),arrPtdiv(counter+2)(i-1)
   Next  
  Else
   For i = 1 To Ubound(arrPtdiv(counter+2))
    Rhino.AddLine arrPtdiv(counter)(i),arrPtdiv(counter+2)(i-1)
   Next
  End If
  counter = counter +3
 Loop
 Rhino.EnableRedraw True
End Function
Function add_lines1(arrPtdiv, createdCrvs)
 Rhino.EnableRedraw False
 Dim i, j
 Dim counter : counter = 0
 
 Do While (counter+3<=Ubound(arrPtdiv)+1)
  If Ubound(arrPtdiv(counter))<Ubound(arrPtdiv(counter+2)) Then
   ’this controls the height of the curve to make more “crazy things”
   createdCrvs(counter+2) = Rhino.MoveObject(createdCrvs(counter+2),array(0,0,0),array(0,0,-10))
   change_certain_zs createdCrvs(counter+2),counter
   For i = 1 To Ubound(arrPtdiv(counter))
    ’createdCrvs(counter+2) = Rhino.MoveObject(createdCrvs(counter+2),array(0,0,0),array(0,0,-50))
    Rhino.AddLine arrPtdiv(counter)(i),Rhino.EvaluateCurve(createdCrvs(counter+2),Rhino.CurveClosestPoint(createdCrvs(counter+2),arrPtdiv(counter)(i)))
   Next  
  Else
   For i = 1 To Ubound(arrPtdiv(counter+2))
    ’createdCrvs(counter+2)=Rhino.MoveObject(createdCrvs(counter+2),array(0,0,0),array(0,0,-50))
    Rhino.AddLine arrPtdiv(counter)(i),Rhino.EvaluateCurve(createdCrvs(counter+2),Rhino.CurveClosestPoint(createdCrvs(counter+2),arrPtdiv(counter)(i)))
   Next
  End If
  counter = counter +3
 Loop
 Rhino.EnableRedraw True
End Function
Function AverageCurv(t,strCrv,crvDom)
 Dim aveCurv : aveCurv = 0
 For t=0 To crvDom(1)+1e-9 Step (crvDom(1)-CrvDom(0))/100
  Dim curv : curv = Rhino.CurveCurvature(strCrv,t)(3)
  If isNull (curv) Then
   curv=0
  End If
  aveCurv = aveCurv + curv
 Next
 Rhino.Print aveCurv/100
 
End Function
Function Change_certain_zs (createdCrv,counter)
 Dim EditPts : EditPts = Rhino.CurveEditPoints(createdCrv,False)
 Dim m
 For m = 0 To Ubound(EditPts)
  If counter Mod 2 = 0 Then
   If m Mod 2 = 0 Then
    EditPts(m)(2) = EditPts(m)(2)+10
    ’Rhino.AddTextDot Rhino.Pt2Str(EditPts(m)),EditPts(m)
   End If
  End If
  If counter Mod 2 =1 Then
   If m Mod 2 = 0 Then
    EditPts(m)(2) = EditPts(m)(2)+10
    ’Rhino.AddTextDot “counter+2 mod 2 =1″ & Rhino.Pt2Str(EditPts(m)),EditPts(m)
   End If   
  End If  
 Next
 createdCrv = Rhino.AddInterpCurve(EditPts)
 Change_certain_zs = createdCrv
End Function

AN_Multiple Helix

Option Explicit

By Adolfo Nadal

Copyrighted by Archiologics

Call Main()
Sub Main()
 Dim i, n
 n = Rhino.GetInteger(“Nr of points”, 50,1,100)
 If IsNull (n) Then Exit Sub
 
 Dim D
 D = Rhino.GetInteger(“Diameter for curves”,2,1,5)
 
 Dim basePt : basePt = Rhino.GetPoint(“Base Point”,array(0,0,0))
 
 Dim k, h : h = Rhino.GetInteger(“Nr of Curves”, 4,1,360)
 Dim rad
 
 Dim Pt(), Pts()
 Dim arrPts (), arrPtss()
 Dim arrCrv()
 Dim PolyPt()
 Dim r
 Dim Poly
 
 Rhino.EnableRedraw(False)
 For k = 0 To h-1
  rad = k/h*2*PI
  
  For i = 0 To n-1
   
   ReDim Preserve arrPts(i)
   ’ReDim Preserve arrPtss(i)
   arrPts(i) = Rhino.AddPoint(array(D*sin(i+rad)+basePt(0),D*cos(i+rad)+basePt(1),i+basePt(2)))
   ’arrPtss(i) = Rhino.AddPoint(array(cos(i+rad),sin(i+rad),i))
  
   ReDim Preserve Pt(i)
   ’ReDim Preserve Pts(i)
   Pt(i) = Rhino.PointCoordinates(arrPts(i))
   ’Pts(i) = Rhino.PointCoordinates(arrPtss(i))
     
   If i>0 Then
    ReDim Preserve arrCrv(i)
    ’rrCrv(i-1) = Rhino.AddLine (Pt(i),Pt(i-1))
   End If
   
   If i=n Then
    Rhino.Print(“Point ” & (i) & “: ” & (sin(i)) & “, ” & (cos(i)) & “, ” & (i))   
   End If
  
  Next
  
  Poly = Rhino.AddInterpCurve (Pt)
  r = (Rhino.CurveLength(Poly)/2000)
  Rhino.SelectObject(Poly)
  ’Rhino.Command “Sellast enter Pipe pause 1 pause enter 1 enter enter”
  Rhino.Command “Pipe (r) enter (r) enter enter”
  Rhino.DeleteObjects(arrPts)
  Rhino.UnselectAllObjects
 Next
 Rhino.EnableRedraw(True)
 Rhino.AddText “Settings: ” & vbCrLf & “1. general radius= ” & (D) & vbCrLf & ” 2. Number of Curves: ” & (h) & vbCrLf & ” 3. Sample points: ” & (n),array(basePt(0),basePt(1)-10, basePt(2)),.5,”arial”
 ’Rhino.AddInterpCurve Pts
 
End Sub

AN_Pseudo_class_machine

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archi-o-logics
‘Script version Monday, October 20, 2008 4:50:16 PM

Call Main()
Sub Main()
Dim strDest, arrDest, strLoc, strLocs, arrPt, arrLoc, i,j, dblDist, dblNewDist, arrClosePt, strTempLine, strTempLine2,strTempLine3,strTempLine4, arrMidPt, arrMidPt2, arrMidPt3, arrNewPts, arrNewPts2, arrNewPts3, arrNewPt
arrDest = Rhino.GetObjects (“select your destinations”,1)
strLocs = Rhino.GetObjects (“select your acticator”,1)

Dim factor : factor = 6

For Each strLoc In strLocs
arrLoc = rhino.PointCoordinates (strLoc)
dblDist = 100000

For i = 0 To Ubound(arrDest)
arrPt = rhino.PointCoordinates (arrDest(i))
dblNewDist = Rhino.distance (arrLoc, arrPt)
If dblNewDist < dblDist Then
dblDist = dblNewDist
arrClosePt = arrPt
End If
Next

strTempLine = Rhino.AddLine (arrLoc,arrClosePt)
arrMidPt = Rhino.CurveMidPoint (strTempLine)
strTempLine2 = Rhino.CopyObject (strTempLine)

strTempLine3 = Rhino.AddLine(arrLoc,arrMidPt)
arrMidPt2 = Rhino.CurveMidPoint (strTempLine3)

strTempLine4 = Rhino.AddLine(arrClosePt,arrMidPt)
arrMidPt3 = Rhino.CurveMidPoint (strTempLine4)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine2, arrMidPt,90),arrMidPt,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts = Rhino.DivideCurve (strTempLine2,10)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine3, arrMidPt2,90),arrMidPt2,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts2 = Rhino.DivideCurve (strTempLine3,10)

Call Rhino.ScaleObject (Rhino.RotateObject (strTempLine4, arrMidPt3,90),arrMidPt3,array(rnd(0.5),rnd(0.5),rnd(0.5)))
arrNewPts3 = Rhino.DivideCurve (strTempLine4,10)

For j = 0 To ubound(arrNewPts)
Dim z : z = factor * Abs(sin (180*j/ubound(arrnewPts)))
If j< ubound(arrNewPts) Then
Call Rhino.AddInterpCurve (array(rhino.CurveStartPoint (strTempLine),arrNewPts2(j),array(arrNewPts(j)(0),arrNewPts(j)(1),arrNewPts(j)(2)+z),arrNewPts3(j),rhino.CurveEndPoint(strTempLine)))
‘Call Rhino.AddInterpCurve (array(rhino.CurveStartPoint (strTempLine),array(arrNewPts(j)(0),arrNewPts(j)(1),z),rhino.CurveEndPoint (strTempLine)))
End If
Next

Call Rhino.deleteobject (strTempLine)
Call Rhino.deleteobject (strTempLine2)
Next
End Sub

AN_Skin Creator

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archiologics
‘Script version domingo, 16 de noviembre de 2008 12:52:20

Call Main()
Sub Main()
 ’SURFACE DECLARATIONS AND SO ON———————————————————————————————
 Dim intU,intV, uDom, vDom, strSrf
 strSrf = Rhino.GetObject(“srf”,8,True)
 If IsNull(strSrf) Then Exit Sub
 
 intU = Rhino.GetInteger(“u”,20)
 intV = Rhino.GetInteger(“v”,20)
 uDom = Rhino.SurfaceDomain(strSrf,0)
 vDom = Rhino.SurfaceDomain(strSrf,1)
 
 Dim uStep : uStep = (UDom(1) – UDom(0)) / intU
 Dim vStep : vStep = (VDom(1) – VDom(0)) / intV
 
 Dim t,s, u, v
 ReDim arrFrame(intU,intV)
 ReDim arrNormal(intU,intV)
 Dim dblDist, dblDistAvg : dblDistAvg = 0
 
 Dim arrSrfLines(), arrSrfLines2(),arrNrLines(), nrcounter, srcounter, srcounter2, distcounter, arrPts
 srcounter = 0
 srcounter2 = 0
 nrcounter = 0
 distcounter = 0
 
 ’DIM VARIABLES WHICH ARE GOING TO DEFINE HOW INTRICATE THE WEAVING IS (BASICALLY THE MODS)———————————-
 Dim a, b
 a = 1
 b = 1
 
 Rhino.EnableRedraw False
 
 For t = 0 To intU
  For s = 0 To intV
   u = uDom(0) + uStep * t
   v = vDom(0) + vStep * s
   arrFrame(t,s) = Rhino.SurfaceFrame (strSrf, Array(u,v))    
   
   ’DISTANCE BETWEEN CORNER POINTS EVERY ITERATION FOR RECURSION
   ’LET US MEASURE THE DISTANCE ON THE SURFACE: COMPARE THAT TO THE AVERAGE IN ORDER TO KNOW WHICH ONES TO DO 
   If t> 0 And s>0 Then
    distcounter = distcounter + 1
    Dim strCrvDist : strCrvDist = Rhino.AddInterpCrvOnSrf(strSrf,array(arrFrame(t,s)(0),arrFrame(t-b,s-b)(0)))
    If Not isNull(strCrvDist) Then
     Rhino.DeleteObject strCrvDist
    End If
    ’MAKE A SQUARE IN THIS POSITIONS———————————————————————-
    ’    If t >= a And s >= a Then
    ’     distcounter = distcounter + 1
    ’     arrPts = array(arrFrame(t,s)(0),arrFrame(t,s-a)(0),arrFrame(t-a,s-a)(0),arrFrame(t-a,s)(0))
    ’     Rhino.CurrentLayer “Layer 01″
    ’     ReDim Preserve arrSrfLines(srcounter)
    ’     arrSrfLines(srcounter) = Subdivide (arrPts,strSrf,0,1)
    ’     srcounter = srcounter +1
    ’    End If
    If t>=b And s>=b  Then ‘And a<>b
     distcounter = distcounter + 1
     arrPts = array(arrFrame(t,s)(0),arrFrame(t,s-b)(0),arrFrame(t-b,s-b)(0),arrFrame(t-b,s)(0))
     Rhino.CurrentLayer “Skin1_lines”
     ReDim Preserve arrSrfLines2(srcounter2)
     arrSrfLines2(srcounter2) = Subdivide (arrPts,strSrf,0,1)
     srcounter2 = srcounter2 +1
    End If
   End If
  Next
 Next
 ’Dim opt : opt = 1
 ’Rhino.CurrentLayer “Text”
 ’Rhino.AddText “iteration” & vbCrlf & ” ” & dbldist & vbCrlf & “u: ” & intU & vbCrlf & “v: ” & intV & vbCrlf & ” ” & opt,array(arrFrame(0,0)(0)(0),arrFrame(0,0)(0)(1)-0.5,arrFrame(0,0)(0)(2)),0.5
 ’Rhino.HideObject strSrf
 Rhino.EnableRedraw True
End Sub

Function Subdivide(arrPts,strSrf, dblDistAvg, distCounter)
 
 Dim dblThreshold1,dblThreshold2,dblThreshold3,dblThreshold4
 ’CALCULATE RANDOM POINT WITHIN THE 4 GIVEN POINTS
 Dim dblDist
 Dim strPoly : strPoly = Rhino.AddInterpCrvOnSrf(strSrf,array(arrPts(0),arrPts(1),arrPts(2),arrPts(3),arrPts(0)))
 If isNull(strPoly) Then Exit Function
 dblDist = Rhino.CurveLength (strPoly)
 If isNull(strPoly) Then Exit Function
 dblDistAvg = dblDist + dblDistAvg
 ’Rhino.Print “distCounter: ” & distCounter & ” dblDistAvg/t: ” & dblDistAvg/(distcounter) & ” dblDist: ” & dblDist
 
 Dim arrPtCenter : arrPtCenter = rndCPtWithin (arrPts,strPoly,strSrf)
 Rhino.DeleteObject strPoly  
 ’Dim strPtCenter : strPtCenter = Rhino.AddPoint (arrPtCenter)
 ’Rhino.ObjectColor strPtCenter,vbblue
 
 ’CALCULATE PARAMETERS OF NEW POINTS AND ORIGINAL T,S POINTS
 Dim arrOriParam : arrOriParam = Rhino.SurfaceClosestPoint(strSrf, arrPts(0))
 Dim arrOriParam2 : arrOriParam2 = Rhino.SurfaceClosestPoint(strSrf, arrPts(2))
 Dim arrParam : arrParam = Rhino.SurfaceClosestPoint(strSrf,arrPtCenter)

 ’CALCULATE THE OTHER 3 POINTS TO BUILD THE SUBDIVISION
 Dim arrPt1, arrPt2, arrPt3, arrPt4, arrPtnew
 arrPt1 = Rhino.EvaluateSurface(strSrf,array(arrParam(0),arrOriParam2(1)))
 arrPt2 = Rhino.EvaluateSurface(strSrf,array(arrOriParam2(0),arrParam(1)))
 arrPt3 = Rhino.EvaluateSurface(strSrf,array(arrParam(0),arrOriParam(1)))
 arrPt4 = Rhino.EvaluateSurface(strSrf,array(arrOriParam(0),arrParam(1)))
 
 ’DRAW CURVES ON SURFACE———————————————————————–
 ’THESE DRAW LINES IN THE SQUARE
 ’ Dim arrSrfLines : arrSrfLines = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPts(3),arrPts(1)))
 Dim arrSrfLines2 : arrSrfLines2 = Rhino.AddInterpCrvOnSrf (strSrf, array(arrPTs(0),arrPts(2)))
 ’THESE DRAW LINES IN THE FOUR SUBSQUARES
 Dim strCrv_a1 : strCrv_a1 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPts(0),arrPtCenter))
 ’ Dim strCrv_a2 : strCrv_a2 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPt3,arrPt4))
 ’ Dim strCrv_b1 : strCrv_b1 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPt4,arrPt1))
 Dim strCrv_b2 : strCrv_b2 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPts(1),arrPtCenter))
 Dim strCrv_c1 : strCrv_c1 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPts(2),arrPtCenter))
 ’ Dim strCrv_c2 : strCrv_c2 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPt2,arrPt1))
 ’ Dim strCrv_d1 : strCrv_d1 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPt2,arrPt3))
 Dim strCrv_d2 : strCrv_d2 = Rhino.AddInterpCrvOnSrf (strSrf,array(arrPts(3),arrPtCenter))

 Rhino.AddInterpCrvOnSrf strSrf,array(arrPts(0),arrPts(1),arrPts(2),arrPts(3),arrPts(0))
 
 ’EXTEND END POINTS OF CURVE———————————————————————-
 Dim opt
:opt = 1
 ’ If Not IsNull (arrSrfLines) Then
 ’  Call Rhino.ExtendCurveLength(arrSrfLines,opt,1,Rhino.CurveLength(arrSrfLines))
 ’ End If
 ’ If Not IsNull (arrSrfLines) Then
 ’  Call Rhino.ExtendCurveLength(arrSrfLines,opt,0,Rhino.CurveLength(arrSrfLines))
 ’ End If
 If Not IsNull (arrSrfLines2) Then
  Call Rhino.ExtendCurveLength(arrSrfLines2,opt,1,0.1*Rhino.CurveLength(arrSrfLines2)) 
 End If
 If Not IsNull (arrSrfLines2) Then
  Call Rhino.ExtendCurveLength(arrSrfLines2,opt,0,0.1*Rhino.CurveLength(arrSrfLines2))
 End If
 
 
 If Not IsNull (strCrv_a1) Then
  Call Rhino.ExtendCurveLength(strCrv_a1,opt,1,0.25*Rhino.CurveLength(strCrv_a1))
 End If
 ’ If Not IsNull (strCrv_a2) Then
 ’  Call Rhino.ExtendCurveLength(strCrv_a2,opt,1,0.5*Rhino.CurveLength(strCrv_a2))
 ’ End If
 ’ If Not IsNull (strCrv_b1) Then
 ’  Call Rhino.ExtendCurveLength(strCrv_b1,opt,1,0.5*Rhino.CurveLength(strCrv_b1)) 
 ’ End If
 If Not IsNull (strCrv_b2) Then
  Call Rhino.ExtendCurveLength(strCrv_b2,opt,1,0.25*Rhino.CurveLength(strCrv_b2))
 End If
 If Not IsNull (strCrv_c1) Then
  Call Rhino.ExtendCurveLength(strCrv_c1,opt,1,0.25*Rhino.CurveLength(strCrv_c1))
 End If
 ’ If Not IsNull (strCrv_c2) Then
 ’  Call Rhino.ExtendCurveLength(strCrv_c2,opt,1,0.5*Rhino.CurveLength(strCrv_c2)) 
 ’ End If
 ’ If Not IsNull (strCrv_d1) Then
 ’  Call Rhino.ExtendCurveLength(strCrv_d1,opt,1,0.5*Rhino.CurveLength(strCrv_d1)) 
 ’ End If
 If Not IsNull (strCrv_d2) Then
  Call Rhino.ExtendCurveLength(strCrv_d2,opt,1,0.25*Rhino.CurveLength(strCrv_d2)) 
 End If
 
 
 ’CALCULATE DISTANCES TO SEE FURTHER RECURSION
 dblThreshold1 = Rhino.Distance(arrPts(0),arrPtCenter)
 dblThreshold2 = Rhino.Distance(arrPts(1),arrPtCenter)
 dblThreshold3 = Rhino.Distance(arrPts(2),arrPtCenter)
 dblThreshold4 = Rhino.Distance(arrPts(3),arrPtCenter)
 
 ’ Rhino.Print “dblThreshold1 ” & dblThreshold1
 ’ Rhino.Print “dblThreshold2 ” & dblThreshold2
 ’ Rhino.Print “dblThreshold3 ” & dblThreshold3
 ’ Rhino.Print “dblThreshold4 ” & dblThreshold4
 
 If dblThreshold1 > 2 Then
  Subdivide array(arrPts(0),arrPt4,arrPtCenter,arrPt3),strSrf, dblDistAvg, distCounter
  ’Rhino.Print “Subdivide1″
 End If
 ’ If dblThreshold2 > 3.6 Then
 ’  Subdivide array(arrPts(1),arrPt1,arrPtCenter,arrPt4),strSrf, dblDistAvg, distCounter
 ’  Rhino.Print “Subdivide2″
 ’ End If 
 If dblThreshold3 > 4 Then
  Subdivide array(arrPts(2),arrPt2,arrPtCenter,arrPt1),strSrf, dblDistAvg, distCounter
  ’Rhino.Print “Subdivide3″
 End If
 ’ If dblThreshold4 > 4.8 Then
 ’  Subdivide array(arrPts(3),arrPt3,arrPtCenter,arrPt2),strSrf, dblDistAvg, distCounter
 ’  Rhino.Print “Subdivide4″
 ’ End If 
 ’ Subdivide = array(strCrv_a1,strCrv_a2,strCrv_b1,strCrv_b2,strCrv_c1,strCrv_c2,strCrv_d1,strCrv_d2)
 
End Function

Function rndCPtWithin(arrPts,strPoly,strSrf)
 
 Dim i, x, y, z
 x = arrPts(0)(0) : y = arrPts(0)(1) : z = arrPts(0)(2)
 For i = 1 To Ubound(arrPts)
  x = x + arrPts(i)(0)
  y = y + arrPts(i)(1)
  z = z + arrPts(i)(2)
 Next
 x = x / (UBound(arrPts)+1)
 y = y / (UBound(arrPts)+1)
 z = z / (UBound(arrPts)+1)
 Dim aPtCenter : aPtCenter = array(x,y,z)
 
 If Not Rhino.IsCurveClosed(strPoly) And Rhino.IsCurveClosable(strPoly) Then
  strPoly = Rhino.CloseCurve (strPoly)
 End If
 
 Dim aPtsdiv : aPtsDiv = rhino.DivideCurve(strPoly, 30)
 Dim aPtDir : aPtDir = aPtsdiv(int(UBound(aPtsDiv)* rnd))
 Dim vDir : vDir = rhino.VectorCreate(aptDir, aPtcenter)
 vDir = rhino.VectorScale(vDir, rnd)
 
 rndCPtWithin = rhino.PointAdd(aPtcenter, vDir)
 Dim arrParam : arrParam = Rhino.SurfaceClosestPoint(strSrf,rndCPtWithin)
 rndCPtWithin = Rhino.EvaluateSurface(strSrf,arrParam)
 
 ’Call rhino.DeleteObject(strPoly)
  
End Function

Function arbitraryValue(min, max)
 Randomize
 arbitraryValue = min + (max – min) * Rnd
End Function

AN_Skin modifier

Option Explicit
‘Script written by Adolfo Nadal
‘Script copyrighted by Archiologics
‘Script version Thursday, November 20, 2008 1:10:35 AM

Call Main()
Sub Main()
 Dim line
 Dim strtPt
 Dim endPt
 Dim arrEditPts
 
 Dim arrLines : arrLines = Rhino.GetObjects (“lines”,4)
 Dim scalefactor
 Rhino.EnableRedraw False
 For Each line In arrLines
  strtPt = Rhino.CurveStartPoint(line)
  endPt = Rhino.CurveEndPoint(line)
  scalefactor = -0.35*ArbitraryValue(1,1.3)
  
  Dim h : h = Rhino.CurveLength (line)
  ’Rhino.Print h
  ’strtPt(0) = strtPt(0)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  ’strtPt(1) = strtPt(1)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  strtPt(2) = strtPt(2) + h*scalefactor
  ’endPt(0) = endPt(0)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  ’endPt(1) = endPt(1)’ + 0.5*h*scalefactor’*(-1)^(2*Int(ArbitraryValue(0,2)))
  endPt(2) = endPt(2) + h*scalefactor
  
  arrEditPts = Rhino.CurveEditPoints(line)
  arrEditPts(0) = strtPt
  arrEditPts(Ubound(arrEditPts)) = endPt

  Rhino.DeleteObject(line)
  Rhino.AddInterpCurve(arrEditPts)
 Next
 Rhino.EnableRedraw True
End Sub
Function arbitraryValue(min, max)
 Randomize
 arbitraryValue = min + (max – min) * Rnd
End Function

AN_sweep_tool

Option Explicit
‘Adolfo Nadal -Archiologics

Call Main()
Sub Main()
Dim strObj : strObj = Rhino.GetObject(“obj”,4)
Dim strCrvs : strCrvs = Rhino.GetObjects(“crvs”,4)

Dim arrCtPt : arrCtPt = Rhino.CurveAreaCentroid(strObj)

‘let’s try to get the fckg normal vector to the curve
Dim strdecide: strdecide = Rhino.GetString(“wanna try to select points on your own?”,”yes”,array(“yes”,”no”))
Dim objDom : objDom = CurveDomain(strObj)
Dim xP
Dim yP

If strdecide = “no” Then
xP = Rhino.EvaluateCurve(strObj,0)
yP = Rhino.EvaluateCurve(strObj,(objDom(1)-objDom(0))/4)
Else
arrCtPt(0) = Rhino.GetPoint (“center Pt”)
xP = Rhino.GetPoint(,,”pt 1 on X dir”)
yP = Rhino.GetPoint(,,”pt 1 on Y dir”)
End If

Dim vNormal : vNormal = Rhino.VectorAdd (Rhino.VectorUnitize(Rhino.VectorCrossProduct(xP,yP)),arrCtPt(0))

Dim arrPerpPlane : arrPerpPlane = Rhino.PlaneFromFrame(arrCtPt(0),xP,yP)

‘let’s try to do the same with the curves…
Dim strCrv
Dim crvPt, crvTangent, crvPerp, crvNormal
Dim crvCurvature
Dim t

Dim orientObj()
Rhino.EnableRedraw False
For Each strCrv In strCrvs

Dim crvDom : crvDom = Rhino.CurveDomain(strCrv)

Dim arrStPt : arrStPt = Rhino.CurveStartPoint(strCrv)
Dim arrEnPt : arrEnPt = Rhino.CurveEndPoint(strCrv)
Dim m : m=0

For t =0 To crvDom(1) Step (crvDom(1)-crvDom(0))/2
crvCurvature = Rhino.CurveCurvature(strCrv,t)
If IsNull (crvCurvature) Then
crvPt = Rhino.EvaluateCurve(strCrv,t)
crvTangent = Rhino.VectorUnitize(Rhino.CurveTangent(strCrv,t))
crvPerp = Array(0,0,1)
Else
crvPt = crvCurvature(0)
crvTangent = Rhino.VectorUnitize(crvCurvature(1))
crvPerp = Rhino.VectorUnitize(crvCurvature(4))
End If

crvNormal = Rhino.VectorAdd(Rhino.VectorUnitize(Rhino.VectorCrossProduct(crvTangent,crvPerp)),crvPt)
Dim CrossSectionPlane : CrossSectionPlane = Rhino.PlaneFromFrame(crvPt,crvPerp,crvNormal)
Dim xPtgt : xPtgt = Rhino.VectorAdd(Rhino.VectorUnitize(CrossSectionPlane(1)),crvPt)
Dim zPtgt : zPtgt = Rhino.VectorAdd(Rhino.VectorUnitize(CrossSectionPlane(2)),crvPt)

Dim strObj2 : strObj2 = Rhino.CopyObject(strObj,array(0,0,0),array(0,0,0))

‘We orient the object
ReDim Preserve orientObj(m)
orientObj(m) = Rhino.OrientObject (strObj2,array(arrCtPt(0),xP,yP),array(crvPt,xPtgt,crvNormal),1)

‘we scale the object
‘for the scalefactor we need to “unitize” the domain
Dim scalefactor, n
Dim unitize : unitize = crvDom(1)-crvDom(0)
n = 180*(t-crvDom(0))/unitize
Rhino.Print(n)
If n = 0 Or n Mod 180 =0 Then
scalefactor =.5
Else
scalefactor = (1/(2*sin(n)))+1/2
End If

Rhino.ScaleObject orientObj(m),crvPt,array(scalefactor,scalefactor,scalefactor)
Rhino.DeleteObject(strObj2)
m =m+1
Next
Rhino.Command “Sweep1 _SelID ” & strCrv & ” _SelID ” & orientObj(0) & ” _SelID ” & orientObj(1) & ” _SelID ” & orientObj(2) & “_enter _enter Natural enter enter”

Next
Rhino.EnableRedraw True
End Sub

cv_sphere packing tower

Option Explicit
‘Script written by <valla>
‘Script copyrighted by <insert company name>
‘Script version Tuesday, October 07, 2008 9:20:25 PM

Call Colonize()
Sub Colonize()
 
 Dim FrstPt : FrstPt = Rhino.GetPointCoordinates (“first center pt”)
 If IsNull (FrstPt) Then Exit Sub 
 
 Dim count : count = Rhino.GetInteger(“number of units”, 15, 2, 1000)
 If IsNull (count) Then Exit Sub
 
 Dim o : o = Rhino.GetInteger(“points to generate”, 500, 0, 1000)
 If IsNull (o) Then Exit Sub
 
 Call Rhino.AddLayer (“trajectory”, RGB(255,0,0))
 Call Rhino.AddLayer (“textDot”, RGB(255,0,255))
 Call Rhino.AddLayer (“tree”, RGB(0,0,255))
 Call Rhino.AddLayer (“spheres”)
 
 ReDim CPts(count) : CPts(0) = FrstPt(0)  ’array of array of coordinates (center points)
 Dim RPts()      ’array of numbers (radius)
 Dim SPts()      ’array of objects (spheres)
 Dim trajec()      ’array of objects (curves)
 
 Dim i
 
 
 For i=0 To 0  
  
  ReDim Preserve RPts(i)
  ReDim Preserve SPts(i)
  
  ’DRAW FIRST SPHERE
  RPts(i) = random(15,35)
  
  Call Rhino.CurrentLayer (“spheres”)
  SPts(i) = Rhino.AddSphere (CPts(i), RPts(i))
  Call Rhino.CurrentLayer (“Default”)
  
  Call funcEllipsoid(CPts,RPts,i,o)
  
 Next
 

 For i=1 To count
  
  ReDim Preserve RPts(i)
  ReDim Preserve SPts(i)
  ReDim Preserve trajec(i-1)
  
  
  ’ADD NEW POINT
  Dim v
  v = i-1
  CPts(i) = Rhino.PointAdd(CPts(v), funcVector(CPts,v))
  trajec(v) = Rhino.AddLine (CPts(v), CPts(i))  
  
  
  ’FIND NEAREST SURFACE WITH CONNECTING VECTOR
  Dim D, D2, dis, dis2, k
  ReDim Vec(0), Vec2(0)
  ’D is the distance from new point to the surface of all existing spheres 
  dis = Rhino.Distance(CPts(i), CPts(v))
  D = dis – RPts(v)
  Vec(0) = Rhino.VectorCreate(CPts(k), CPts(i))
  ’find smallest distance D (compare all distances and keep smallest one)
  For k = 0 To i-1
   ReDim Preserve Vec(0), Vec2(0)
   dis2 = Rhino.Distance(CPts(i), CPts(k))
   D2 = dis2 – RPts(k)
   Vec2(0) = Rhino.VectorCreate(CPts(k), CPts(i))
   If D2<>D And D2<D Then
    D = D2
    Vec(0) = Vec2(0)
   End If 
  Next
  
  
  ’DRAW SPHERE
  Dim t : t=0
  ’if new point is in an existing sphere then skip’
  If D<0 Then
   t=t+1
  End If
  ’if new point is not in an existing sphere then add new shere’
  If t=0 Then
   Call Rhino.CurrentLayer (“spheres”)
   RPts(i) = D
   SPts(i) = Rhino.AddSphere (CPts(i), RPts(i))
   Call Rhino.CurrentLayer (“Default”)
   
   Call funcEllipsoid(CPts,RPts,i,o)
   
   Call Rhino.CurrentLayer (“tree”)
   Dim tempPt, tree
   tempPt = Rhino.PointAdd(CPts(i), Vec(0))
   tree = Rhino.AddLine (CPts(i), tempPt)
   Call Rhino.CurrentLayer (“Default”)
   
   Call Rhino.CurrentLayer (“textDot”)
   Call Rhino.AddTextDot (i, CPts(i))
   Call Rhino.CurrentLayer (“Default”)   
  End If
  
 Next
 
 Call Rhino.CurrentLayer (“trajectory”)
 Dim trajectory : trajectory = Rhino.JoinCurves (trajec,True)
 Call Rhino.CurrentLayer (“Default”)
 
End Sub
Function funcEllipsoid(CPts,RPts,i,o)
 ’FUNCTION WILL CREAT AN ARRAY OF POINTS IN SHAPE OF ELLIPSOID 
  
 Call Rhino.AddLayer (“PointCloud”)
 Call Rhino.CurrentLayer (“PointCloud”)
  
 Dim minRx, maxRx, minRy, maxRy, minRz, maxRz
 Dim beta, landa
 Dim x, y, z
 
 ReDim arrPoints(o-1)
 Dim p
 
 Randomize
 minRx = RPts(i)
 maxRx = minRx + 6
 minRy = RPts(i)
 maxRy = minRy + 6
 minRz = RPts(i)
 maxRz = minRz + 6
 
 Call rhino.enableRedraw(False)
 
 For p = 0 To o-1
  beta = random(-90,90)   ’latitude
  landa = random(-180,180)  ’longitude
  x = CPts(i)(0) + random (minRx,maxRx)*Cos(beta)*Cos(landa)
  y = CPts(i)(1) + random (minRy,maxRy)*Cos(beta)*Sin(landa)
  z = CPts(i)(2) + random (minRz,maxRz)*Sin(beta)
  arrPoints(p) = Rhino.AddPoint(Array(x,y,z))
 Next
 
 Call rhino.enableRedraw(True)
 
 Call Rhino.objectcolor (arrPoints, RGB(150*Rnd, 0, 150*Rnd))
 Call Rhino.CurrentLayer (“Default”)
 
End Function

 

Function funcVector(CPts,v)
 
 Dim x, y, z
 
 If CPts(v)(0) > 0 Then
  x = random(-80,-30)
 Else
  x = random(80,30)
 End If
  
 If CPts(v)(1) > 0 Then
  y = random(-30,-80)
 Else
  y = random(80,30)
 End If 
 
 z = random(-10,30)
 
 funcVector = Array(x, y, z)

End Function

 

Function random(min,max)
 Randomize
 random = ((max-min) * Rnd + min)
End Function

 

 

ML_ColorBySize

snapping-matrix

Option Explicit

‘Script written by <Matthew Lutz>

‘Script version Monday, October 06, 2008 11:47:41 PM

 

Dim triangleCrv, vertexPts, endpt1, endpt2, endpt0, newSpicule, gens, origPt, origPtCoord, objArr

Dim attractorPt, threshDist, strLeg, strSphere, scaleFact, testSphere1, testSphere2, testSphere3

 

Call SpiculeGenerator()

Sub SpiculeGenerator()

Rhino.EnableRedraw False

gens = Rhino.GetReal(“How many generations?”, 50)

‘threshDist = Rhino.GetReal(“What is the threshold distance?”, 20)

origPt = Rhino.GetObject(“choose a starting point”, 1)

attractorPt = Rhino.GetObject(“choose an attractor point”, 1)

scaleFact = Rhino.GetReal(“Unit scale factor?”, 1)

testSphere1 = Rhino.GetObject(“choose the first sphere”, 8)

testSphere2 = Rhino.GetObject(“choose the second sphere”, 8)

testSphere3 = Rhino.GetObject(“choose the third sphere”, 8)

origPtCoord = Rhino.PointCoordinates (origPt)

attractorPt = Rhino.PointCoordinates (attractorPt)

endPt0 = Rhino.AddPoint (Array(origPtCoord(0), origPtCoord(1) + (scaleFact * 1.5), origPtCoord(2)))

endPt1 = Rhino.RotateObject (endPt0, origPtCoord, 120.0, , True)

endPt2 = Rhino.RotateObject (endPt1, origPtCoord, 120.0, , True)

 

endPt0 = Rhino.PointCoordinates (endPt0)

endPt1 = Rhino.PointCoordinates (endPt1)

endPt2 = Rhino.PointCoordinates (endPt2)

Call Rhino.AddLayer (“spicules”)

Call Rhino.AddLayer (“lines”)

Call Rhino.AddLayer (“points”)

Call Rhino.AddLayer (“circles”)

Call Rhino.AddLayer (“spheres”)

Call Rhino.AddLayer (“trajectory1″)

Call Rhino.AddLayer (“trajectory2″)

Call Rhino.AddLayer (“trajectory3″)

 

objArr = AddNewSpicule(endPt0, endPt1, endPt2, 0)

Call RecursiveGrowth(objArr, gens, origPtCoord, attractorPt, scaleFact, testSphere1, testSphere2, testSphere3)

 

End Sub

 

Function RecursiveGrowth(objArr, gens, origPtCoord, attractorPt, scaleFact, testSphere1, testSphere2, testSphere3)

 

Dim i, currentType1, currentType2, currentType3, arrTypes, Rand1, Rand2, Rand3, RadS, RadSM, RadM, RadML, RadL, RadXL, arrAllSpicules()

Dim newEndPt0(), newEndPt1(), newEndPt2(), newEndPt3()

Dim sphereTest1(), sphereTest2(), sphereTest3()

Dim sphereColor1(), sphereColor2(), sphereColor3()

Dim sphereCtrPt(), trajLine1a, trajLine2a, trajLine3a, trajLine1b, trajLine2b, trajLine3b, trajLine1c, trajLine2c, trajLine3c,trajLine1d, trajLine2d, trajLine3d, trajLine1e, trajLine2e, trajLine3e

Dim sphereObj1(), sphereObj2(), sphereObj3()

Dim objArr1(), objArr2(), objArr3(), labelSphere1, labelSphere2, labelSphere3

Dim startPts1(), startPts2(), startPts3(), craneLine1, craneLine2, craneLine3, testPt1, testPt2, testPt3

 

For i = 1 To gens

ReDim Preserve objArr1(i)

ReDim Preserve objArr2(i)

ReDim Preserve objArr3(i)

ReDim Preserve sphereTest1(i)

ReDim Preserve sphereTest2(i)

ReDim Preserve sphereTest3(i)

ReDim Preserve sphereColor1(i)

ReDim Preserve sphereColor2(i)

ReDim Preserve sphereColor3(i)

ReDim Preserve sphereObj1(i)

ReDim Preserve sphereObj2(i)

ReDim Preserve sphereObj3(i)

ReDim Preserve startPts1(i)

ReDim Preserve startPts2(i)

ReDim Preserve startPts3(i)

If i<2 Then

objArr1(i) = AddNewSpicule(endPt0, endPt1, endPt2, i)

objArr2(i) = AddNewSpicule(endPt0, endPt1, endPt2, i)

objArr3(i) = AddNewSpicule(endPt0, endPt1, endPt2, i)

Else 

RadS = scaleFact * .75

RadSM = scaleFact * 1.15

RadM = scaleFact * 1.25

RadML = scaleFact * .95

RadL = scaleFact * .65

RadXL = scaleFact * .85

arrTypes = Array(RadS, RadSM, RadM, RadML, RadL, RadXL)

Rand1 = Random(2,5)

currentType1 = arrTypes(Rand1)

sphereTest1(i) = Rhino.AddSphere (objArr1(i-1)(1)(4), currentType1)

‘sphereColor1(i) = Rhino.AddSphere (objArr1(i-1)(1)(4), currentType1*.25)

‘Call Rhino.ObjectColor (sphereColor1(i), RGB(200, 20+(i*3), 64))

startPts1(i) = SphereIntersect(objArr1(i-1), sphereTest1(i))

objArr1(i) = ClosestSpicule(startPts1(i), attractorPt, i)

If Rhino.IsPointInSurface (testSphere1, objArr1(i)(1)(4)) Then

objArr1(i) = objArr1(i-2)

ElseIf Rhino.IsPointInSurface (testSphere2, objArr1(i)(1)(4)) Then

objArr1(i) = objArr1(i-2)

ElseIf Rhino.IsPointInSurface (testSphere3, objArr1(i)(1)(4)) Then

objArr1(i) = objArr1(i-2)

End If

Rand2 = Random(0,3)

currentType2 = arrTypes(Rand2)

sphereTest2(i) = Rhino.AddSphere (objArr2(i-1)(1)(4), currentType2)

‘sphereColor2(i) = Rhino.AddSphere (objArr2(i-1)(1)(4), currentType2*.25)

‘Call Rhino.ObjectColor (sphereColor2(i), RGB(209, 4.25*i, 64))

startPts2(i) = SphereIntersect(objArr2(i-1), sphereTest2(i))

objArr2(i) = ClosestSpicule(startPts2(i), attractorPt, i)

If Rhino.IsPointInSurface (testSphere1, objArr2(i)(1)(4)) Then

objArr2(i) = objArr2(i-2)

ElseIf Rhino.IsPointInSurface (testSphere2, objArr2(i)(1)(4)) Then

objArr2(i) = objArr2(i-2)

ElseIf Rhino.IsPointInSurface (testSphere3, objArr2(i)(1)(4)) Then

objArr2(i) = objArr2(i-2)

End If

Rand3 = Random(0,5)

currentType3 = arrTypes(Rand3)

sphereTest3(i) = Rhino.AddSphere (objArr3(i-1)(1)(4), currentType3)

‘sphereColor3(i) = Rhino.AddSphere (objArr3(i-1)(1)(4), currentType3*.25)

‘Call Rhino.ObjectColor (sphereColor3(i), RGB(209, 2.5*i, 64))

startPts3(i) = SphereIntersect(objArr3(i-1), sphereTest3(i))

objArr3(i) = ClosestSpicule(startPts3(i), attractorPt, i)

If Rhino.IsPointInSurface (testSphere1, objArr3(i)(1)(4)) Then

objArr3(i) = objArr3(i-2)

ElseIf Rhino.IsPointInSurface (testSphere2, objArr3(i)(1)(4)) Then

objArr3(i) = objArr3(i-2)

ElseIf Rhino.IsPointInSurface (testSphere3, objArr3(i)(1)(4)) Then

objArr3(i) = objArr3(i-2)

End If

If currentType1 = RadS Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(235, 91, 46))

ElseIf currentType1 = RadSM Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(235, 164, 26))

ElseIf currentType1 = RadM Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(231, 229, 34))

ElseIf currentType1 = RadML Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(179, 206, 32))

ElseIf currentType1 = RadL Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(122, 165, 19))

ElseIf currentType1 = RadXL Then

Call Rhino.ObjectColor (objArr1(i)(0), RGB(31, 157, 159))

End If

If currentType2 = RadS Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(215, 71, 25))

ElseIf currentType2 = RadSM Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(215, 144, 6))

ElseIf currentType2 = RadM Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(210, 209, 14))

ElseIf currentType2 = RadML Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(179, 206, 32))

ElseIf currentType2 = RadL Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(122, 165, 19))

ElseIf currentType2 = RadXL Then

Call Rhino.ObjectColor (objArr2(i)(0), RGB(31, 157, 159))

End If

If currentType3 = RadS Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(235, 91, 46))

ElseIf currentType3 = RadSM Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(235, 164, 26))

ElseIf currentType3 = RadM Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(231, 229, 34))

ElseIf currentType3 = RadML Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(179, 206, 32))

ElseIf currentType3 = RadL Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(122, 165, 19))

ElseIf currentType3 = RadXL Then

Call Rhino.ObjectColor (objArr3(i)(0), RGB(31, 157, 159))

End If

Rhino.DeleteObject (sphereTest1(i))

Rhino.DeleteObject (sphereTest2(i))

Rhino.DeleteObject (sphereTest3(i))

trajLine1a = Rhino.AddLine (objArr1(i)(1)(4), objArr1(i-1)(1)(4))

‘ trajLine1b = Rhino.AddLine (objArr1(i)(1)(0), objArr1(i-1)(1)(0))

‘ trajLine1c = Rhino.AddLine (objArr1(i)(1)(1), objArr1(i-1)(1)(1))

‘ trajLine1d = Rhino.AddLine (objArr1(i)(1)(2), objArr1(i-1)(1)(2))

‘ trajLine1e = Rhino.AddLine (objArr1(i)(1)(5), objArr1(i-1)(1)(5))

‘craneLine1 = Rhino.AddLine (objArr1(i)(1)(4), cranePt)

‘testPt1 = Call Rhino.AddPoint (objArr1(i)(1)(3)(0), objArr1(i)(1)(3)((1)+3), objArr1(i)(1)(3)(2))

‘Call Rhino.AddLine (objArr1(i)(1)(4), testPt1)

Call Rhino.ObjectLayer (trajLine1a, “trajectory1″)

trajLine2a = Rhino.AddLine (objArr2(i)(1)(4), objArr2(i-1)(1)(4))

‘ trajLine2b = Rhino.AddLine (objArr2(i)(1)(0), objArr2(i-1)(1)(0))

‘ trajLine2c = Rhino.AddLine (objArr2(i)(1)(1), objArr2(i-1)(1)(1))

‘ trajLine2d = Rhino.AddLine (objArr2(i)(1)(2), objArr2(i-1)(1)(2))

‘ trajLine2e = Rhino.AddLine (objArr2(i)(1)(5), objArr2(i-1)(1)(5))

‘craneLine2 = Rhino.AddLine (objArr2(i)(1)(4), cranePt)

Call Rhino.ObjectLayer (trajLine2a, “trajectory2″)

trajLine3a = Rhino.AddLine (objArr3(i)(1)(4), objArr3(i-1)(1)(4))

‘ trajLine3b = Rhino.AddLine (objArr3(i)(1)(0), objArr3(i-1)(1)(0))

‘ trajLine3c = Rhino.AddLine (objArr3(i)(1)(1), objArr3(i-1)(1)(1))

‘ trajLine3d = Rhino.AddLine (objArr3(i)(1)(2), objArr3(i-1)(1)(2))

‘ trajLine3e = Rhino.AddLine (objArr3(i)(1)(5), objArr3(i-1)(1)(5))

‘craneLine3 = Rhino.AddLine (objArr3(i)(1)(4), cranePt)

Call Rhino.ObjectLayer (trajLine3a, “trajectory3″)

End If

Next

Rhino.EnableRedraw True

End Function

 

Function ClosestSpicule(startPts, attractorPt, i)

Dim TestSpicule1, TestSpicule2, TestSpicule3, AllTestArr, RandArr

Dim ClosestDist, ClosestDist1, ClosestDist2, ClosestDist3

Dim RandTest

TestSpicule1 = AddNewSpicule(startPts(0), startPts(1), startPts(3), i)

TestSpicule2 = AddNewSpicule(startPts(2), startPts(0), startPts(3), i)

TestSpicule3 = AddNewSpicule(startPts(1), startPts(2), startPts(3), i)

If i Mod 4 = 0 Then

RandTest = Random(0,2)

If RandTest = 0 Then

ClosestSpicule = TestSpicule1

ElseIf RandTest = 1 Then

ClosestSpicule = TestSpicule2

ElseIf RandTest = 2 Then

ClosestSpicule = TestSpicule3

End If

Else If i Mod 5 = 0 Then

ClosestSpicule = TestSpicule3

ElseIf i Mod 6 = 0 Then

ClosestSpicule = TestSpicule2

Else

ClosestDist1 = Rhino.Distance(TestSpicule1(1)(5), attractorPt)

ClosestDist2 = Rhino.Distance(TestSpicule2(1)(5), attractorPt)

ClosestDist3 = Rhino.Distance(TestSpicule3(1)(5), attractorPt)

If ClosestDist1 < ClosestDist2 Then

ClosestDist = ClosestDist1

Else

ClosestDist = ClosestDist2

End If

If ClosestDist > ClosestDist3 Then

ClosestDist = ClosestDist3

End If

If ClosestDist = ClosestDist1 Then

ClosestSpicule = TestSpicule1

ElseIf ClosestDist = ClosestDist2 Then

ClosestSpicule = TestSpicule2

ElseIf ClosestDist = ClosestDist3 Then

ClosestSpicule = TestSpicule3

End If

End If

End If

End Function

 

Function SphereIntersect(objArr, sphereTest)

Dim ptOnBaseLineA, ptOnBaseLineB, ptOnBaseLineC, ptOnTopLine

Dim newEndPtA, newEndPtB, newEndPtC, newEndPtTop

ptOnBaseLineA = Rhino.CurveSurfaceIntersection(objArr(0)(2), sphereTest)

If IsArray(ptOnBaseLineA) Then

Call Rhino.AddPoint (ptOnBaseLineA(0,1))

newEndPtA = Rhino.FirstObject

newEndPtA = Rhino.PointCoordinates (newEndPtA)

Else

newEndPtA = Rhino.AddPoint (objArr(1)(1))

newEndPtA = Rhino.PointCoordinates (newEndPtA)

End If

ptOnBaseLineB = Rhino.CurveSurfaceIntersection(objArr(0)(0), sphereTest)

If IsArray(ptOnBaseLineB) Then

Call Rhino.AddPoint (ptOnBaseLineB(0,1))

newEndPtB = Rhino.FirstObject

newEndPtB = Rhino.PointCoordinates (newEndPtB)

Else

newEndPtB = Rhino.AddPoint (objArr(1)(2))

newEndPtB = Rhino.PointCoordinates (newEndPtB)

End If

ptOnBaseLineC = Rhino.CurveSurfaceIntersection(objArr(0)(1), sphereTest)

If IsArray(ptOnBaseLineC) Then

Call Rhino.AddPoint (ptOnBaseLineC(0,1))

newEndPtC = Rhino.FirstObject

newEndPtC = Rhino.PointCoordinates (newEndPtC)

Else

newEndPtC = Rhino.AddPoint (objArr(1)(0))

newEndPtC = Rhino.PointCoordinates (newEndPtC)

End If

”””””

ptOnTopLine = Rhino.CurveSurfaceIntersection(objArr(0)(3), sphereTest)

If IsArray(ptOnTopLine) Then    

Call Rhino.AddPoint (ptOnTopLine(0,1))

newEndPtTop = Rhino.FirstObject

newEndPtTop = Rhino.PointCoordinates (newEndPtTop)

Else

newEndPtTop = Rhino.AddPoint (objArr(1)(5))

newEndPtTop = Rhino.PointCoordinates (newEndPtTop)

End If

SphereIntersect = Array(newEndPtA, newEndPtB, newEndPtC, newEndPtTop)

End Function

 

Function Random(min, max)

Randomize()

Random = Int((max – min) * Rnd + min)

End Function

 

Function AddNewSpicule(startPt0, startPt1, startPt2, i)

AddNewSpicule = Null

Dim centerPt, newCenterPt, topCenterPt, strLabel 

Dim baseLine1, baseLine2, baseLine3, baseLine4Top, dblRadius, crvNormal

Dim triangle, offTriangle, offTriangle2

Dim strCircle, CirclePlane, offCirclePlane1, offCirclePlane2, offCircleCurve1, offCircleCurve2

Dim arrPlane1, arrPlane2, arrPlane3, arrPlane4Top, newCirc1, newCirc2, newCirc3, newCirc4Top, pipeSurf1, pipeSurf2, pipeSurf3, pipeSurf4Top

Dim baseLine1Ext, baseLine2Ext, baseLine3Ext, baseLine4ExtTop, ExtPt1, ExtPt2, ExtPt3, ExtPt4

strCircle = Rhino.AddCircle3Pt (startPt0, startPt1, startPt2)

centerPt = Rhino.CircleCenterPoint (strCircle) 

CirclePlane = Rhino.AddPlanarSrf (Array(strCircle))

crvNormal = Rhino.CurveNormal(strCircle)

dblRadius = Rhino.CircleRadius (strCircle) 

offCirclePlane1 = Rhino.OffsetSurface(CirclePlane(0), dblRadius * 0.707)

newCenterPt = Rhino.SurfaceAreaCentroid(offCirclePlane1)

offCirclePlane2 = Rhino.OffsetSurface(offCirclePlane1, dblRadius * 1.25)

topCenterPt = Rhino.SurfaceAreaCentroid(offCirclePlane2)

baseLine1 = Rhino.AddLine(newCenterPt(0), startPt0)

baseLine1Ext = Rhino.ExtendCurveLength (baseLine1, 0, 1, dblRadius * .45)

ExtPt1 = Rhino.CurveEndPoint (baseLine1Ext)

pipeSurf1 = Rhino.AddCylinder (newCenterPt(0), ExtPt1, dblRadius*0.07)

Call Rhino.ObjectLayer (baseLine1, “lines”)

Call Rhino.ObjectLayer (pipeSurf1, “spicules”)

‘Call Rhino.ObjectColor (pipeSurf1, RGB(209, 2.5*i, 64))

‘Call Rhino.ObjectColor (baseLine1, RGB(209, 2.5*i, 64))

 

baseLine2 = Rhino.AddLine(newCenterPt(0), startPt1)

baseLine2Ext = Rhino.ExtendCurveLength (baseLine2, 0, 1, dblRadius * .45)

ExtPt2 = Rhino.CurveEndPoint (baseLine2Ext)

pipeSurf2 = Rhino.AddCylinder (newCenterPt(0), ExtPt2, dblRadius*0.07)

Call Rhino.ObjectLayer (baseLine2, “lines”)

Call Rhino.ObjectLayer (pipeSurf2, “spicules”)

‘Call Rhino.ObjectColor (pipeSurf2, RGB(20+(i*3), 200, 64))

‘Call Rhino.ObjectColor (baseLine2, RGB(20+(i*3), 200, 64))

baseLine3 = Rhino.AddLine(newCenterPt(0), startPt2)

baseLine3Ext = Rhino.ExtendCurveLength (baseLine3, 0, 1, dblRadius * .45)

ExtPt3 = Rhino.CurveEndPoint (baseLine3Ext)

pipeSurf3 = Rhino.AddCylinder (newCenterPt(0), ExtPt3, dblRadius*0.07)

Call Rhino.ObjectLayer (baseLine3, “lines”)

Call Rhino.ObjectLayer (pipeSurf3, “spicules”)

‘Call Rhino.ObjectColor (pipeSurf3, RGB(150, 20+(i*2), 64))

‘Call Rhino.ObjectColor (baseLine3, RGB(150, 20+(i*2), 64))

 

baseLine4Top = Rhino.AddLine(newCenterPt(0), topCenterPt(0))

baseLine4ExtTop = Rhino.ExtendCurveLength (baseLine4Top, 0, 1, dblRadius * .45)

ExtPt4 = Rhino.CurveEndPoint (baseLine4ExtTop)

pipeSurf4Top = Rhino.AddCylinder (newCenterPt(0), ExtPt4, dblRadius*0.07)

Call Rhino.ObjectLayer (baseLine4Top, “lines”)

Call Rhino.ObjectLayer (pipeSurf4Top, “spicules”)

‘Call Rhino.ObjectColor (pipeSurf4Top, RGB(175, i*4, 64))

‘Call Rhino.ObjectColor (baseLine4Top, RGB(175, i*4, 64))

Dim arrSpiculeLines, arrSpiculePoints, arrSpiculeVectors

‘Dim CapShere1 : CapShere1 = Rhino.AddSphere(newCenterPt(0), dblRadius*.25)

Dim CapShere2 : CapShere2 = Rhino.AddSphere(ExtPt4, dblRadius*.07)

Dim CapShere3 : CapShere3 = Rhino.AddSphere(ExtPt1, dblRadius*.07)

Dim CapShere4 : CapShere4 = Rhino.AddSphere(ExtPt2, dblRadius*.07)

Dim CapShere5 : CapShere5 = Rhino.AddSphere(ExtPt3, dblRadius*.07)

Call Rhino.ObjectLayer (CapShere2, “spicules”)

Call Rhino.ObjectLayer (CapShere3, “spicules”)

Call Rhino.ObjectLayer (CapShere4, “spicules”)

Call Rhino.ObjectLayer (CapShere5, “spicules”)

Rhino.DeleteObject strCircle

Rhino.DeleteObject CirclePlane(0)

Rhino.DeleteObject offCirclePlane1

Rhino.DeleteObject offCirclePlane2

 

‘arrSpiculeLines = Array(baseLine1Ext, baseLine2Ext, baseLine3Ext, baseLine4ExtTop)

arrSpiculeLines = Array(baseLine1, baseLine2, baseLine3, baseLine4Top)

arrSpiculePoints = Array(startPt0, startPt1, startPt2, centerPt, newCenterPt(0), topCenterPt(0))

arrSpiculeVectors = Array(crvNormal, dblRadius)

Call Rhino.ObjectLayer (strCircle, “circles”)

AddNewSpicule = Array(arrSpiculeLines, arrSpiculePoints, arrSpiculeVectors)

 

End Function

 

 

 

 

ML_Spicule Generator

Option Explicit
‘Script written by <Matthew Lutz>
‘Script version Monday, October 06, 2008 11:47:41 PM

Dim triangleCrv, vertexPts, endpt1, endpt2, endpt0, newSpicule, gens, origPt, origPtCoord

Call SpiculeGenerator()
Sub SpiculeGenerator()
 
 gens = Rhino.GetReal(“How many generations?”, 50)
 origPt = Rhino.GetObject(“choose a starting point”, 1)
 origPtCoord = Rhino.PointCoordinates (origPt)

‘This is just a quick bit to get the first three starting points (equilateral triangle)
 endPt0 = Rhino.AddPoint (Array(origPtCoord(0), origPtCoord(1) + 7, origPtCoord(2)))
 endPt1 = Rhino.RotateObject (endPt0, origPtCoord, 120.0, , True)
 endPt2 = Rhino.RotateObject (endPt1, origPtCoord, 120.0, , True)
  
 endPt0 = Rhino.PointCoordinates (endPt0)
 endPt1 = Rhino.PointCoordinates (endPt1)
 endPt2 = Rhino.PointCoordinates (endPt2)

Call RecursiveGrowth()

End Sub
 
Sub RecursiveGrowth()

 Dim i, currentType, arrTypes, Rand, RadS, RadM, RadL, RadXL, arrAllSpicules()
 Dim newEndPt0(), newEndPt1(), newEndPt2(), newEndPt3()
 Dim sphereTest(), ptOnBaseLine1(), ptOnBaseLine2(), ptOnBaseLine3(), ptOnTopLine1(), j
 Dim sphereCtrPt()
 
 For i = 0 To gens
  
  ’set up the dynamic array to add another unit each time
  ReDim Preserve arrAllSpicules(i)
 
  If i<2 Then
   arrAllSpicules(i) = AddNewSpicule(endPt0, endPt1, endPt2)
   
  Else
     ‘choose the current type – each holds a radius value
    ’type = (top leg, base leg) — There are 4 sizes of units to be placed
   
       RadS = 1.75
       RadM = 3.5
       RadL = 5.25
       RadXL = 7
       arrTypes = Array(RadS, RadM, RadL, RadXL)
      
     ‘a random Function To Select the currentType from an Array of all 4 possible
    Rand = Random(0,3)
    currentType = arrTypes(Rand)
   
   ReDim Preserve sphereTest(i)
   sphereTest(i) = Rhino.AddSphere (arrAllSpicules(i-1)(1)(4), currentType)
   
   ReDim Preserve ptOnBaseLine1(i)
   ReDim Preserve newEndPt0(i)
   ptOnBaseLine1(i) = Rhino.CurveSurfaceIntersection(arrAllSpicules(i-1)(0)(0), sphereTest(i))
   If IsArray(ptOnBaseLine1(i)) Then
     
       Call Rhino.AddPoint (ptOnBaseLine1(i)(0,1))
       newEndPt0(i) = Rhino.FirstObject
       newEndPt0(i) = Rhino.PointCoordinates (newEndPt0(i))
   
        Else
  
        Rhino.Print “Curve and surface do not intersect.”
        newEndPt0(i) = Rhino.AddPoint (arrAllSpicules(i-1)(1)(4))
        newEndPt0(i) = Rhino.PointCoordinates (newEndPt0(i))

   End If
   
 If currentType = 5.25 Then
  ReDim Preserve ptOnBaseLine2(i)
  ReDim Preserve newEndPt1(i)
  ptOnBaseLine2(i) = Rhino.CurveSurfaceIntersection(arrAllSpicules(i-1)(0)(2), sphereTest(i))
     If IsArray(ptOnBaseLine2(i)) Then
   
         Call Rhino.AddPoint (ptOnBaseLine2(i)(0,1))
         newEndPt1(i) = Rhino.FirstObject
         newEndPt1(i) = Rhino.PointCoordinates (newEndPt1(i))
        
         Else
        
         Rhino.Print “Curve and surface do not intersect.”
         newEndPt1(i) = Array(newEndPt0(i)(0), newEndPt0(i)(1), newEndPt0(i)(2)-7)
     End If
       
 Else
     
  ReDim Preserve ptOnBaseLine2(i)
  ReDim Preserve newEndPt1(i)
  ptOnBaseLine2(i) = Rhino.CurveSurfaceIntersection(arrAllSpicules(i-1)(0)(1), sphereTest(i))
    If IsArray(ptOnBaseLine2(i)) Then
   
       Call Rhino.AddPoint (ptOnBaseLine2(i)(0,1))
       newEndPt1(i) = Rhino.FirstObject
       newEndPt1(i) = Rhino.PointCoordinates (newEndPt1(i))
        
       Else
        
       Rhino.Print “Curve and surface do not intersect.”
       newEndPt1(i) = Array(newEndPt0(i)(0), newEndPt0(i)(1), newEndPt0(i)(2)+7)
    End If
   
  End If
  
   ReDim Preserve ptOnTopLine1(i)
   ReDim Preserve newEndPt2(i)
   ptOnTopLine1(i) = Rhino.CurveSurfaceIntersection(arrAllSpicules(i-1)(0)(3), sphereTest(i))
   If IsArray(ptOnTopLine1(i)) Then
              
       Call Rhino.AddPoint (ptOnTopLine1(i)(0,1))
       newEndPt2(i) = Rhino.FirstObject
       newEndPt2(i) = Rhino.PointCoordinates (newEndPt2(i))
       
        Else
       
        Rhino.Print “Curve and surface do not intersect.”
        newEndPt2(i) = Array(newEndPt0(i)(0), newEndPt0(i)(1)+7, newEndPt0(i)(2))
     
   End If
   
   ReDim Preserve ptOnBaseLine3(i)
  ReDim Preserve newEndPt3(i)
  ptOnBaseLine3(i) = Rhino.CurveSurfaceIntersection(arrAllSpicules(i-1)(0)(2), sphereTest(i))
  If IsArray(ptOnBaseLine3(i)) Then
   
         Call Rhino.AddPoint (ptOnBaseLine3(i)(0,1))
         newEndPt3(i) = Rhino.FirstObject
         newEndPt3(i) = Rhino.PointCoordinates (newEndPt3(i))
       
          Else
       
          Rhino.Print “Curve and surface do not intersect.”
          newEndPt3(i) = Array(newEndPt0(i)(0)+7, newEndPt0(i)(1), newEndPt0(i)(2))
     End If
   
   ’ptOnBaseLine3 = Rhino.CurveSurfaceIntersection (arrAllSpicules(i-1)(0)(2), sphereTest)
   ’newendPt1 = Rhino.AddPoint(ptOnBaseLine2(i,1))
   
   arrAllSpicules(i) = AddNewSpicule(newEndPt0(i), newEndPt1(i), newEndPt2(i))
   Rhino.DeleteObject (sphereTest(i))
   
   End If
   Next

End Sub

‘random function
Function Random(min, max)
 
 Randomize()
 Random = Int((max – min) * Rnd + min)
 
End Function
””””” This is the function that gets called each time
””””” It takes 3 starting points as inputs
””””” This one seems to be working OK because it builds the first one fine…
Function AddNewSpicule(startPt0, startPt1, startPt2)
 AddNewSpicule = Null
 
 Dim centerPt, newCenterPt, topCenterPt, strLabel
 Dim baseLine1, baseLine2, baseLine3, baseLine4Top, dblRadius, crvNormal
 Dim triangle, offTriangle, offTriangle2
 Dim strCircle, CirclePlane, offCirclePlane1, offCirclePlane2, offCircleCurve1, offCircleCurve2 

 strCircle = Rhino.AddCircle3Pt (startPt0, startPt1, startPt2)
 centerPt = Rhino.CircleCenterPoint (strCircle)
 CirclePlane = Rhino.AddPlanarSrf (Array(strCircle))
 crvNormal = Rhino.CurveNormal(strCircle)

 dblRadius = Rhino.CircleRadius (strCircle) 
 offCirclePlane1 = Rhino.OffsetSurface(CirclePlane(0), dblRadius * 0.707)
 newCenterPt = Rhino.SurfaceAreaCentroid(offCirclePlane1)
 ’strLabel = Rhino.AddTextDot (Rhino.Pt2Str(newCenterPt(0)), newCenterPt(0))

 offCirclePlane2 = Rhino.OffsetSurface(offCirclePlane1, dblRadius * 2)
 topCenterPt = Rhino.SurfaceAreaCentroid(offCirclePlane2)
 
 ’ draw 3 new base lines and one top line
 baseLine1 = Rhino.AddLine(startPt0, newCenterPt(0))
 baseLine2 = Rhino.AddLine(startPt1, newCenterPt(0))
 baseLine3 = Rhino.AddLine(startPt2, newCenterPt(0))
 baseLine4Top = Rhino.AddLine(newCenterPt(0), topCenterPt(0))
 
 Dim arrSpiculeLines, arrSpiculePoints, arrSpiculeVectors
 
 Rhino.DeleteObject strCircle
 Rhino.DeleteObject CirclePlane(0)
 Rhino.DeleteObject offCirclePlane1
 Rhino.DeleteObject offCirclePlane2
 
 ”’make the pipes
 Rhino.SelectObject baseLine1
 Rhino.Command(“Pipe .25 .25 _enter”)
 Rhino.UnselectAllObjects
  
 Rhino.SelectObject baseLine2
 Rhino.Command(“Pipe .25 .25 _enter”)
 Rhino.UnselectAllObjects
  
 Rhino.SelectObject baseLine3
 Rhino.Command(“Pipe .25 .25 _enter”)
 Rhino.UnselectAllObjects
  
 Rhino.SelectObject baseLine4Top
 Rhino.Command(“Pipe .25 .25 _enter”)
 Rhino.UnselectAllObjects
  ‘now it collects all the info generated into an array that we can refer to
 arrSpiculeLines = Array(baseLine1, baseLine2, baseLine3, baseLine4Top)
 arrSpiculePoints = Array(startPt0, startPt1, startPt2, centerPt, newCenterPt(0), topCenterPt(0))
 arrSpiculeVectors = Array(crvNormal, dblRadius)
 
 AddNewSpicule = Array(arrSpiculeLines, arrSpiculePoints, arrSpiculeVectors)
 ’ whatever it returns should have all the info you need to place the next one(within nested array)…

End Function

 

 

 

 

 

 

LC_Straw Growing

1124tower2Call Main()

Sub Main()
Dim a
Dim arrPoints1, arrPoints2
Dim arrCurve(),arrCurveExt()
Dim arrCurveSub1(),arrCurveSub2(),arrCurveSub3(),arrCurveSub4(),arrCurveSub5()
Dim arrCurveSub6(),arrCurveSub7(),arrCurveSub8(),arrCurveSub9(),arrCurveSub10()
Dim arrCurveSub11(),arrCurveSub12(),arrCurveSub13(),arrCurveSub14(),arrCurveSub15()
Dim arrCurveSub16(),arrCurveSub17(),arrCurveSub18(),arrCurveSub19(),arrCurveSub20()
Dim arrCurveExtSub1(),arrCurveExtSub2(),arrCurveExtSub3(),arrCurveExtSub4(),arrCurveExtSub5()
Dim arrCurveExtSub6(),arrCurveExtSub7(),arrCurveExtSub8(),arrCurveExtSub9(),arrCurveExtSub10()
Dim arrCurveExtSub11(),arrCurveExtSub12(),arrCurveExtSub13(),arrCurveExtSub14(),arrCurveExtSub15()
Dim arrCurveExtSub16(),arrCurveExtSub17(),arrCurveExtSub18(),arrCurveExtSub19(),arrCurveExtSub20()
Dim arrCurveFloor(),arrCurveFloor2()
Dim arrPlane(),arrPlaneExt()
Dim arrPlanesub1(),arrPlanesub2(),arrPlanesub3(),arrPlanesub4(),arrPlanesub5()
Dim arrPlanesub6(),arrPlanesub7(),arrPlanesub8(),arrPlanesub9(),arrPlanesub10()
Dim arrPlanesub11(),arrPlanesub12(),arrPlanesub13(),arrPlanesub14(),arrPlanesub15()
Dim arrPlanesub16(),arrPlanesub17(),arrPlanesub18(),arrPlanesub19(),arrPlanesub20()
Dim arrPlaneExtsub1(),arrPlaneExtsub2(),arrPlaneExtsub3(),arrPlaneExtsub4(),arrPlaneExtsub5()
Dim arrPlaneExtsub6(),arrPlaneExtsub7(),arrPlaneExtsub8(),arrPlaneExtsub9(),arrPlaneExtsub10()
Dim arrPlaneExtsub11(),arrPlaneExtsub12(),arrPlaneExtsub13(),arrPlaneExtsub14(),arrPlaneExtsub15()
Dim arrPlaneExtsub16(),arrPlaneExtsub17(),arrPlaneExtsub18(),arrPlaneExtsub19(),arrPlaneExtsub20()
Dim arrPlaneFloor(),arrPlaneFloor2()
Dim arrPt(),arrPtExt()
Dim arrPtSub1(),arrPtSub2(),arrPtSub3(),arrPtSub4(),arrPtSub5()
Dim arrPtSub6(),arrPtSub7(),arrPtSub8(),arrPtSub9(),arrPtSub10()
Dim arrPtSub11(),arrPtSub12(),arrPtSub13(),arrPtSub14(),arrPtSub15()
Dim arrPtSub16(),arrPtSub17(),arrPtSub18(),arrPtSub19(),arrPtSub20()
Dim arrPtExtSub1(),arrPtExtSub2(),arrPtExtSub3(),arrPtExtSub4(),arrPtExtSub5()
Dim arrPtExtSub6(),arrPtExtSub7(),arrPtExtSub8(),arrPtExtSub9(),arrPtExtSub10()
Dim arrPtExtSub11(),arrPtExtSub12(),arrPtExtSub13(),arrPtExtSub14(),arrPtExtSub15()
Dim arrPtExtSub16(),arrPtExtSub17(),arrPtExtSub18(),arrPtExtSub19(),arrPtExtSub20()
Dim arrPtFloor(),arrPtFloor2()

arrPoints1 = Rhino.GetPoint(“Please Pick Lower Point”)
arrPoints2 = Rhino.GetPoint(“Please Pick Upper Point”)

If IsArray(arrPoints1) Then
If IsArray(arrPoints2) Then

For a = 0 To 18

ReDim Preserve arrCurve(25)

arrCurve(0)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+5*Cos(18*a-1.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20+5*Sin(18*a-1.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-9.57)/20+arrPoints1(2))
arrCurve(1)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+7*Cos(18*a-1.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20+7*Sin(18*a-1.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-6.835)/20+arrPoints1(2))
arrCurve(2)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+12*Cos(18*a-0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20+12*Sin(18*a-0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-3.6)/20+arrPoints1(2))

arrCurve(3)=Array(((arrPoints2(0)-arrPoints1(0))*0/20+14*Cos(18*a+0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0/20+14*Sin(18*a+0)+arrPoints1(1),arrPoints1(2))
arrCurve(4)=Array(((arrPoints2(0)-arrPoints1(0))*0.1/20+21*Cos(18*a+0.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.1/20+21*Sin(18*a+0.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*1.215/20+arrPoints1(2))
arrCurve(5)=Array(((arrPoints2(0)-arrPoints1(0))*0.44/20+28*Cos(18*a+0.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.44/20+28*Sin(18*a+0.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*2.42/20+arrPoints1(2))
arrCurve(6)=Array(((arrPoints2(0)-arrPoints1(0))*1.02/20+35*Cos(18*a+0.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.02/20+35*Sin(18*a+0.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*3.6/20+arrPoints1(2))
arrCurve(7)=Array(((arrPoints2(0)-arrPoints1(0))*1.88/20+42*Cos(18*a+0.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.88/20+42*Sin(18*a+0.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*4.735/20+arrPoints1(2))
arrCurve(8)=Array(((arrPoints2(0)-arrPoints1(0))*2.99/20+49*Cos(18*a+0.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*2.99/20+49*Sin(18*a+0.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*5.82/20+arrPoints1(2))
arrCurve(9)=Array(((arrPoints2(0)-arrPoints1(0))*4.32/20+56*Cos(18*a+0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*4.32/20+56*Sin(18*a+0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*6.835/20+arrPoints1(2))
arrCurve(10)=Array(((arrPoints2(0)-arrPoints1(0))*5.82/20+63*Cos(18*a+0.7)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*5.82/20+63*Sin(18*a+0.7)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*7.79/20+arrPoints1(2))
arrCurve(11)=Array(((arrPoints2(0)-arrPoints1(0))*7.45/20+70*Cos(18*a+0.8)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*7.45/20+70*Sin(18*a+0.8)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*8.695/20+arrPoints1(2))
arrCurve(12)=Array(((arrPoints2(0)-arrPoints1(0))*9.14/20+77*Cos(18*a+0.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*9.14/20+77*Sin(18*a+0.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*9.57/20+arrPoints1(2))
arrCurve(13)=Array(((arrPoints2(0)-arrPoints1(0))*10.86/20+77*Cos(18*a+1.0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*10.86/20+77*Sin(18*a+1.0)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*10.43/20+arrPoints1(2))
arrCurve(14)=Array(((arrPoints2(0)-arrPoints1(0))*12.55/20+70*Cos(18*a+1.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*12.55/20+70*Sin(18*a+1.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*11.305/20+arrPoints1(2))
arrCurve(15)=Array(((arrPoints2(0)-arrPoints1(0))*14.18/20+63*Cos(18*a+1.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*14.18/20+63*Sin(18*a+1.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*12.21/20+arrPoints1(2))
arrCurve(16)=Array(((arrPoints2(0)-arrPoints1(0))*15.68/20+56*Cos(18*a+1.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*15.68/20+56*Sin(18*a+1.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*13.165/20+arrPoints1(2))
arrCurve(17)=Array(((arrPoints2(0)-arrPoints1(0))*17.01/20+49*Cos(18*a+1.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*17.01/20+49*Sin(18*a+1.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*14.18/20+arrPoints1(2))
arrCurve(18)=Array(((arrPoints2(0)-arrPoints1(0))*18.12/20+42*Cos(18*a+1.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*18.12/20+42*Sin(18*a+1.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*15.265/20+arrPoints1(2))
arrCurve(19)=Array(((arrPoints2(0)-arrPoints1(0))*18.98/20+35*Cos(18*a+1.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*18.98/20+35*Sin(18*a+1.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*16.4/20+arrPoints1(2))
arrCurve(20)=Array(((arrPoints2(0)-arrPoints1(0))*19.56/20+28*Cos(18*a+1.7)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*19.56/20+28*Sin(18*a+1.7)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*17.58/20+arrPoints1(2))
arrCurve(21)=Array(((arrPoints2(0)-arrPoints1(0))*19.9/20+21*Cos(18*a+1.8)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*19.9/20+21*Sin(18*a+1.8)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*18.785/20+arrPoints1(2))
arrCurve(22)=Array(((arrPoints2(0)-arrPoints1(0))*20/20+14*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*20/20+14*Sin(18*a+1.9)+arrPoints1(1),arrPoints2(2))
arrcurve(23)=Array(((arrPoints2(0)-arrPoints1(0))*22.42/20+6*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*22.42/20+6*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*22.42/20)
arrcurve(24)=Array(((arrPoints2(0)-arrPoints1(0))*24.735/20+3.5*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*24.735/20+3.5*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*24.735/20)
arrcurve(25)=Array(((arrPoints2(0)-arrPoints1(0))*26.835/20+1*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*26.835/20+1*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*26.835/20)

ReDim Preserve arrCurveExt(25)

arrCurveExt(0)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+14*Cos(18*a-1.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20-14*Sin(18*a-1.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-9.57)/20+arrPoints1(2))
arrCurveExt(1)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+28*Cos(18*a-1.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20-28*Sin(18*a-1.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-6.835)/20+arrPoints1(2))
arrCurveExt(2)=Array(((arrPoints2(0)-arrPoints1(0))*(0)/20+32*Cos(18*a-0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*(0)/20-32*Sin(18*a-0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*(-3.6)/20+arrPoints1(2))
arrCurveExt(3)=Array(((arrPoints2(0)-arrPoints1(0))*0/20+34*Cos(18*a+0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0/20-34*Sin(18*a+0)+arrPoints1(1),arrPoints1(2))
arrCurveExt(4)=Array(((arrPoints2(0)-arrPoints1(0))*0.1/20+41*Cos(18*a+0.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.1/20-41*Sin(18*a+0.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*1.215/20+arrPoints1(2))
arrCurveExt(5)=Array(((arrPoints2(0)-arrPoints1(0))*0.44/20+48*Cos(18*a+0.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.44/20-48*Sin(18*a+0.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*2.42/20+arrPoints1(2))
arrCurveExt(6)=Array(((arrPoints2(0)-arrPoints1(0))*1.02/20+55*Cos(18*a+0.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.02/20-55*Sin(18*a+0.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*3.6/20+arrPoints1(2))
arrCurveExt(7)=Array(((arrPoints2(0)-arrPoints1(0))*1.88/20+62*Cos(18*a+0.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.88/20-62*Sin(18*a+0.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*4.735/20+arrPoints1(2))
arrCurveExt(8)=Array(((arrPoints2(0)-arrPoints1(0))*2.99/20+69*Cos(18*a+0.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*2.99/20-69*Sin(18*a+0.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*5.82/20+arrPoints1(2))
arrCurveExt(9)=Array(((arrPoints2(0)-arrPoints1(0))*4.32/20+76*Cos(18*a+0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*4.32/20-76*Sin(18*a+0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*6.835/20+arrPoints1(2))
arrCurveExt(10)=Array(((arrPoints2(0)-arrPoints1(0))*5.82/20+83*Cos(18*a+0.7)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*5.82/20-83*Sin(18*a+0.7)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*7.79/20+arrPoints1(2))
arrCurveExt(11)=Array(((arrPoints2(0)-arrPoints1(0))*7.45/20+90*Cos(18*a+0.8)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*7.45/20-90*Sin(18*a+0.8)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*8.695/20+arrPoints1(2))
arrCurveExt(12)=Array(((arrPoints2(0)-arrPoints1(0))*9.14/20+97*Cos(18*a+0.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*9.14/20-97*Sin(18*a+0.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*9.57/20+arrPoints1(2))
arrCurveExt(13)=Array(((arrPoints2(0)-arrPoints1(0))*10.86/20+97*Cos(18*a+1.0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*10.86/20-97*Sin(18*a+1.0)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*10.43/20+arrPoints1(2))
arrCurveExt(14)=Array(((arrPoints2(0)-arrPoints1(0))*12.55/20+90*Cos(18*a+1.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*12.55/20-90*Sin(18*a+1.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*11.305/20+arrPoints1(2))
arrCurveExt(15)=Array(((arrPoints2(0)-arrPoints1(0))*14.18/20+83*Cos(18*a+1.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*14.18/20-83*Sin(18*a+1.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*12.21/20+arrPoints1(2))
arrCurveExt(16)=Array(((arrPoints2(0)-arrPoints1(0))*15.68/20+76*Cos(18*a+1.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*15.68/20-76*Sin(18*a+1.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*13.165/20+arrPoints1(2))
arrCurveExt(17)=Array(((arrPoints2(0)-arrPoints1(0))*17.01/20+69*Cos(18*a+1.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*17.01/20-69*Sin(18*a+1.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*14.18/20+arrPoints1(2))
arrCurveExt(18)=Array(((arrPoints2(0)-arrPoints1(0))*18.12/20+59*Cos(18*a+1.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*18.12/20-59*Sin(18*a+1.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*15.265/20+arrPoints1(2))
arrCurveExt(19)=Array(((arrPoints2(0)-arrPoints1(0))*18.98/20+49*Cos(18*a+1.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*18.98/20-49*Sin(18*a+1.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*16.4/20+arrPoints1(2))
arrCurveExt(20)=Array(((arrPoints2(0)-arrPoints1(0))*19.56/20+39*Cos(18*a+1.7)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*19.56/20-39*Sin(18*a+1.7)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*17.58/20+arrPoints1(2))
arrCurveExt(21)=Array(((arrPoints2(0)-arrPoints1(0))*19.9/20+29*Cos(18*a+1.8)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*19.9/20-29*Sin(18*a+1.8)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*18.785/20+arrPoints1(2))
arrCurveExt(22)=Array(((arrPoints2(0)-arrPoints1(0))*20/20+19*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*20/20-19*Sin(18*a+1.9)+arrPoints1(1),arrPoints2(2))
arrcurveExt(23)=Array(((arrPoints2(0)-arrPoints1(0))*22.42/20+7*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*22.42/20-7*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*22.42/20)
arrcurveExt(24)=Array(((arrPoints2(0)-arrPoints1(0))*24.735/20+3.5*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*24.735/20-3.5*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*24.735/20)
arrcurveExt(25)=Array(((arrPoints2(0)-arrPoints1(0))*26.835/20+1*Cos(18*a+1.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*26.835/20-1*Sin(18*a+1.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*26.835/20)
ReDim Preserve arrPlane(25)

arrPlane(0) = Rhino.PlaneFromPoints ((arrCurve(0)),Array(arrCurve(0)(0)+1,arrCurve(0)(1),arrCurve(0)(2)),Array(arrCurve(0)(0),arrCurve(0)(1)+1,arrCurve(0)(2)))
arrPlane(1) = Rhino.PlaneFromPoints ((arrCurve(1)),Array(arrCurve(1)(0)+1,arrCurve(1)(1),arrCurve(1)(2)),Array(arrCurve(1)(0),arrCurve(1)(1)+1,arrCurve(1)(2)))
arrPlane(2) = Rhino.PlaneFromPoints ((arrCurve(2)),Array(arrCurve(2)(0)+1,arrCurve(2)(1),arrCurve(2)(2)),Array(arrCurve(2)(0),arrCurve(2)(1)+1,arrCurve(2)(2)))
arrPlane(3) = Rhino.PlaneFromPoints ((arrCurve(3)),Array(arrCurve(3)(0)+1,arrCurve(3)(1),arrCurve(3)(2)),Array(arrCurve(3)(0),arrCurve(2)(1)+1,arrCurve(3)(2)))
arrPlane(4) = Rhino.PlaneFromPoints ((arrCurve(4)),Array(arrCurve(4)(0)+1,arrCurve(4)(1),arrCurve(4)(2)),Array(arrCurve(4)(0),arrCurve(4)(1)+1,arrCurve(4)(2)))
arrPlane(5) = Rhino.PlaneFromPoints ((arrCurve(5)),Array(arrCurve(5)(0)+1,arrCurve(5)(1),arrCurve(5)(2)),Array(arrCurve(5)(0),arrCurve(5)(1)+1,arrCurve(5)(2)))
arrPlane(6) = Rhino.PlaneFromPoints ((arrCurve(6)),Array(arrCurve(6)(0)+1,arrCurve(6)(1),arrCurve(6)(2)),Array(arrCurve(6)(0),arrCurve(6)(1)+1,arrCurve(6)(2)))
arrPlane(7) = Rhino.PlaneFromPoints ((arrCurve(7)),Array(arrCurve(7)(0)+1,arrCurve(7)(1),arrCurve(7)(2)),Array(arrCurve(7)(0),arrCurve(7)(1)+1,arrCurve(7)(2)))
arrPlane(8) = Rhino.PlaneFromPoints ((arrCurve(8)),Array(arrCurve(8)(0)+1,arrCurve(8)(1),arrCurve(8)(2)),Array(arrCurve(8)(0),arrCurve(8)(1)+1,arrCurve(8)(2)))
arrPlane(9) = Rhino.PlaneFromPoints ((arrCurve(9)),Array(arrCurve(9)(0)+1,arrCurve(9)(1),arrCurve(9)(2)),Array(arrCurve(9)(0),arrCurve(9)(1)+1,arrCurve(9)(2)))
arrPlane(10) = Rhino.PlaneFromPoints ((arrCurve(10)),Array(arrCurve(10)(0)+1,arrCurve(10)(1),arrCurve(10)(2)),Array(arrCurve(10)(0),arrCurve(10)(1)+1,arrCurve(10)(2)))
arrPlane(11) = Rhino.PlaneFromPoints ((arrCurve(11)),Array(arrCurve(11)(0)+1,arrCurve(11)(1),arrCurve(11)(2)),Array(arrCurve(11)(0),arrCurve(11)(1)+1,arrCurve(11)(2)))
arrPlane(12) = Rhino.PlaneFromPoints ((arrCurve(12)),Array(arrCurve(12)(0)+1,arrCurve(12)(1),arrCurve(12)(2)),Array(arrCurve(12)(0),arrCurve(12)(1)+1,arrCurve(12)(2)))
arrPlane(13) = Rhino.PlaneFromPoints ((arrCurve(13)),Array(arrCurve(13)(0)+1,arrCurve(13)(1),arrCurve(13)(2)),Array(arrCurve(13)(0),arrCurve(13)(1)+1,arrCurve(13)(2)))
arrPlane(14) = Rhino.PlaneFromPoints ((arrCurve(14)),Array(arrCurve(14)(0)+1,arrCurve(14)(1),arrCurve(14)(2)),Array(arrCurve(14)(0),arrCurve(14)(1)+1,arrCurve(14)(2)))
arrPlane(15) = Rhino.PlaneFromPoints ((arrCurve(15)),Array(arrCurve(15)(0)+1,arrCurve(15)(1),arrCurve(15)(2)),Array(arrCurve(15)(0),arrCurve(15)(1)+1,arrCurve(15)(2)))
arrPlane(16) = Rhino.PlaneFromPoints ((arrCurve(16)),Array(arrCurve(16)(0)+1,arrCurve(16)(1),arrCurve(16)(2)),Array(arrCurve(16)(0),arrCurve(16)(1)+1,arrCurve(16)(2)))
arrPlane(17) = Rhino.PlaneFromPoints ((arrCurve(17)),Array(arrCurve(17)(0)+1,arrCurve(17)(1),arrCurve(17)(2)),Array(arrCurve(17)(0),arrCurve(17)(1)+1,arrCurve(17)(2)))
arrPlane(18) = Rhino.PlaneFromPoints ((arrCurve(18)),Array(arrCurve(18)(0)+1,arrCurve(18)(1),arrCurve(18)(2)),Array(arrCurve(18)(0),arrCurve(18)(1)+1,arrCurve(18)(2)))
arrPlane(19) = Rhino.PlaneFromPoints ((arrCurve(19)),Array(arrCurve(19)(0)+1,arrCurve(19)(1),arrCurve(19)(2)),Array(arrCurve(19)(0),arrCurve(19)(1)+1,arrCurve(19)(2)))
arrPlane(20) = Rhino.PlaneFromPoints ((arrCurve(20)),Array(arrCurve(20)(0)+1,arrCurve(20)(1),arrCurve(20)(2)),Array(arrCurve(20)(0),arrCurve(20)(1)+1,arrCurve(20)(2)))
arrPlane(21) = Rhino.PlaneFromPoints ((arrCurve(21)),Array(arrCurve(21)(0)+1,arrCurve(21)(1),arrCurve(21)(2)),Array(arrCurve(21)(0),arrCurve(21)(1)+1,arrCurve(21)(2)))
arrPlane(22) = Rhino.PlaneFromPoints ((arrCurve(22)),Array(arrCurve(22)(0)+1,arrCurve(22)(1),arrCurve(22)(2)),Array(arrCurve(22)(0),arrCurve(22)(1)+1,arrCurve(22)(2)))
arrPlane(23) = Rhino.PlaneFromPoints ((arrCurve(23)),Array(arrCurve(23)(0)+1,arrCurve(23)(1),arrCurve(23)(2)),Array(arrCurve(23)(0),arrCurve(23)(1)+1,arrCurve(23)(2)))
arrPlane(24) = Rhino.PlaneFromPoints ((arrCurve(24)),Array(arrCurve(24)(0)+1,arrCurve(24)(1),arrCurve(24)(2)),Array(arrCurve(24)(0),arrCurve(24)(1)+1,arrCurve(24)(2)))
arrPlane(25) = Rhino.PlaneFromPoints ((arrCurve(25)),Array(arrCurve(25)(0)+1,arrCurve(25)(1),arrCurve(25)(2)),Array(arrCurve(25)(0),arrCurve(25)(1)+1,arrCurve(25)(2)))
ReDim Preserve arrPlaneExt(25)

arrPlaneExt(0) = Rhino.PlaneFromPoints ((arrCurveExt(0)),Array(arrCurveExt(0)(0)+1,arrCurveExt(0)(1),arrCurveExt(0)(2)),Array(arrCurveExt(0)(0),arrCurveExt(0)(1)+1,arrCurveExt(0)(2)))
arrPlaneExt(1) = Rhino.PlaneFromPoints ((arrCurveExt(1)),Array(arrCurveExt(1)(0)+1,arrCurveExt(1)(1),arrCurveExt(1)(2)),Array(arrCurveExt(1)(0),arrCurveExt(1)(1)+1,arrCurveExt(1)(2)))
arrPlaneExt(2) = Rhino.PlaneFromPoints ((arrCurveExt(2)),Array(arrCurveExt(2)(0)+1,arrCurveExt(2)(1),arrCurveExt(2)(2)),Array(arrCurveExt(2)(0),arrCurveExt(2)(1)+1,arrCurveExt(2)(2)))
arrPlaneExt(3) = Rhino.PlaneFromPoints ((arrCurveExt(3)),Array(arrCurveExt(3)(0)+1,arrCurveExt(3)(1),arrCurveExt(3)(2)),Array(arrCurveExt(3)(0),arrCurveExt(2)(1)+1,arrCurveExt(3)(2)))
arrPlaneExt(4) = Rhino.PlaneFromPoints ((arrCurveExt(4)),Array(arrCurveExt(4)(0)+1,arrCurveExt(4)(1),arrCurveExt(4)(2)),Array(arrCurveExt(4)(0),arrCurveExt(4)(1)+1,arrCurveExt(4)(2)))
arrPlaneExt(5) = Rhino.PlaneFromPoints ((arrCurveExt(5)),Array(arrCurveExt(5)(0)+1,arrCurveExt(5)(1),arrCurveExt(5)(2)),Array(arrCurveExt(5)(0),arrCurveExt(5)(1)+1,arrCurveExt(5)(2)))
arrPlaneExt(6) = Rhino.PlaneFromPoints ((arrCurveExt(6)),Array(arrCurveExt(6)(0)+1,arrCurveExt(6)(1),arrCurveExt(6)(2)),Array(arrCurveExt(6)(0),arrCurveExt(6)(1)+1,arrCurveExt(6)(2)))
arrPlaneExt(7) = Rhino.PlaneFromPoints ((arrCurveExt(7)),Array(arrCurveExt(7)(0)+1,arrCurveExt(7)(1),arrCurveExt(7)(2)),Array(arrCurveExt(7)(0),arrCurveExt(7)(1)+1,arrCurveExt(7)(2)))
arrPlaneExt(8) = Rhino.PlaneFromPoints ((arrCurveExt(8)),Array(arrCurveExt(8)(0)+1,arrCurveExt(8)(1),arrCurveExt(8)(2)),Array(arrCurveExt(8)(0),arrCurveExt(8)(1)+1,arrCurveExt(8)(2)))
arrPlaneExt(9) = Rhino.PlaneFromPoints ((arrCurveExt(9)),Array(arrCurveExt(9)(0)+1,arrCurveExt(9)(1),arrCurveExt(9)(2)),Array(arrCurveExt(9)(0),arrCurveExt(9)(1)+1,arrCurveExt(9)(2)))
arrPlaneExt(10) = Rhino.PlaneFromPoints ((arrCurveExt(10)),Array(arrCurveExt(10)(0)+1,arrCurveExt(10)(1),arrCurveExt(10)(2)),Array(arrCurveExt(10)(0),arrCurveExt(10)(1)+1,arrCurveExt(10)(2)))
arrPlaneExt(11) = Rhino.PlaneFromPoints ((arrCurveExt(11)),Array(arrCurveExt(11)(0)+1,arrCurveExt(11)(1),arrCurveExt(11)(2)),Array(arrCurveExt(11)(0),arrCurveExt(11)(1)+1,arrCurveExt(11)(2)))
arrPlaneExt(12) = Rhino.PlaneFromPoints ((arrCurveExt(12)),Array(arrCurveExt(12)(0)+1,arrCurveExt(12)(1),arrCurveExt(12)(2)),Array(arrCurveExt(12)(0),arrCurveExt(12)(1)+1,arrCurveExt(12)(2)))
arrPlaneExt(13) = Rhino.PlaneFromPoints ((arrCurveExt(13)),Array(arrCurveExt(13)(0)+1,arrCurveExt(13)(1),arrCurveExt(13)(2)),Array(arrCurveExt(13)(0),arrCurveExt(13)(1)+1,arrCurveExt(13)(2)))
arrPlaneExt(14) = Rhino.PlaneFromPoints ((arrCurveExt(14)),Array(arrCurveExt(14)(0)+1,arrCurveExt(14)(1),arrCurveExt(14)(2)),Array(arrCurveExt(14)(0),arrCurveExt(14)(1)+1,arrCurveExt(14)(2)))
arrPlaneExt(15) = Rhino.PlaneFromPoints ((arrCurveExt(15)),Array(arrCurveExt(15)(0)+1,arrCurveExt(15)(1),arrCurveExt(15)(2)),Array(arrCurveExt(15)(0),arrCurveExt(15)(1)+1,arrCurveExt(15)(2)))
arrPlaneExt(16) = Rhino.PlaneFromPoints ((arrCurveExt(16)),Array(arrCurveExt(16)(0)+1,arrCurveExt(16)(1),arrCurveExt(16)(2)),Array(arrCurveExt(16)(0),arrCurveExt(16)(1)+1,arrCurveExt(16)(2)))
arrPlaneExt(17) = Rhino.PlaneFromPoints ((arrCurveExt(17)),Array(arrCurveExt(17)(0)+1,arrCurveExt(17)(1),arrCurveExt(17)(2)),Array(arrCurveExt(17)(0),arrCurveExt(17)(1)+1,arrCurveExt(17)(2)))
arrPlaneExt(18) = Rhino.PlaneFromPoints ((arrCurveExt(18)),Array(arrCurveExt(18)(0)+1,arrCurveExt(18)(1),arrCurveExt(18)(2)),Array(arrCurveExt(18)(0),arrCurveExt(18)(1)+1,arrCurveExt(18)(2)))
arrPlaneExt(19) = Rhino.PlaneFromPoints ((arrCurveExt(19)),Array(arrCurveExt(19)(0)+1,arrCurveExt(19)(1),arrCurveExt(19)(2)),Array(arrCurveExt(19)(0),arrCurveExt(19)(1)+1,arrCurveExt(19)(2)))
arrPlaneExt(20) = Rhino.PlaneFromPoints ((arrCurveExt(20)),Array(arrCurveExt(20)(0)+1,arrCurveExt(20)(1),arrCurveExt(20)(2)),Array(arrCurveExt(20)(0),arrCurveExt(20)(1)+1,arrCurveExt(20)(2)))
arrPlaneExt(21) = Rhino.PlaneFromPoints ((arrCurveExt(21)),Array(arrCurveExt(21)(0)+1,arrCurveExt(21)(1),arrCurveExt(21)(2)),Array(arrCurveExt(21)(0),arrCurveExt(21)(1)+1,arrCurveExt(21)(2)))
arrPlaneExt(22) = Rhino.PlaneFromPoints ((arrCurveExt(22)),Array(arrCurveExt(22)(0)+1,arrCurveExt(22)(1),arrCurveExt(22)(2)),Array(arrCurveExt(22)(0),arrCurveExt(22)(1)+1,arrCurveExt(22)(2)))
arrPlaneExt(23) = Rhino.PlaneFromPoints ((arrCurveExt(23)),Array(arrCurveExt(23)(0)+1,arrCurveExt(23)(1),arrCurveExt(23)(2)),Array(arrCurveExt(23)(0),arrCurveExt(23)(1)+1,arrCurveExt(23)(2)))
arrPlaneExt(24) = Rhino.PlaneFromPoints ((arrCurveExt(24)),Array(arrCurveExt(24)(0)+1,arrCurveExt(24)(1),arrCurveExt(24)(2)),Array(arrCurveExt(24)(0),arrCurveExt(24)(1)+1,arrCurveExt(24)(2)))
arrPlaneExt(25) = Rhino.PlaneFromPoints ((arrCurveExt(25)),Array(arrCurveExt(25)(0)+1,arrCurveExt(25)(1),arrCurveExt(25)(2)),Array(arrCurveExt(25)(0),arrCurveExt(25)(1)+1,arrCurveExt(25)(2)))

ReDim Preserve arrPt(25)
arrPt(0) = Rhino.AddCircle (arrPlane(0), 4.5)
arrPt(1) = Rhino.AddCircle (arrPlane(1), 4.5)
arrPt(2) = Rhino.AddCircle (arrPlane(2), 4.5)
arrPt(3) = Rhino.AddCircle (arrPlane(3), 5)
arrPt(4) = Rhino.AddCircle (arrPlane(4), 6.5)
arrPt(5) = Rhino.AddCircle (arrPlane(5), 6.5)
arrPt(6) = Rhino.AddCircle (arrPlane(6), 5)
arrPt(7) = Rhino.AddCircle (arrPlane(7), 4.5)
arrPt(8) = Rhino.AddCircle (arrPlane(8), 3.5)
arrPt(9) = Rhino.AddCircle (arrPlane(9), 2.8)
arrPt(10) = Rhino.AddCircle (arrPlane(10), 2.8)
arrPt(11) = Rhino.AddCircle (arrPlane(11), 3)
arrPt(12) = Rhino.AddCircle (arrPlane(12), 4)
arrPt(13) = Rhino.AddCircle (arrPlane(13), 5)
arrPt(14) = Rhino.AddCircle (arrPlane(14), 6.5)
arrPt(15) = Rhino.AddCircle (arrPlane(15), 6.5)
arrPt(16) = Rhino.AddCircle (arrPlane(16), 5)
arrPt(17) = Rhino.AddCircle (arrPlane(17), 4)
arrPt(18) = Rhino.AddCircle (arrPlane(18), 4)
arrPt(19) = Rhino.AddCircle (arrPlane(19), 3)
arrPt(20) = Rhino.AddCircle (arrPlane(20), 2)
arrPt(21) = Rhino.AddCircle (arrPlane(21), 1)
arrPt(22) = Rhino.AddCircle (arrPlane(22), 1)
arrPt(23) = Rhino.AddCircle (arrPlane(23), 0.5)
arrPt(24) = Rhino.AddCircle (arrPlane(24), 0.5)
arrPt(25) = Rhino.AddCircle (arrPlane(25), 0.5)

Rhino.AddLoftSrf (arrPt),,,1
Rhino.AddPlanarSrf Array(arrPt(0))
Rhino.AddPlanarSrf Array(arrPt(25))
Rhino.DeleteObjects (arrPt)

ReDim Preserve arrPtExt(25)
arrPtExt(0) = Rhino.AddCircle (arrPlaneExt(0), 4.5)
arrPtExt(1) = Rhino.AddCircle (arrPlaneExt(1), 4.5)
arrPtExt(2) = Rhino.AddCircle (arrPlaneExt(2), 4.5)
arrPtExt(3) = Rhino.AddCircle (arrPlaneExt(3), 4.5)
arrPtExt(4) = Rhino.AddCircle (arrPlaneExt(4), 6)
arrPtExt(5) = Rhino.AddCircle (arrPlaneExt(5), 6)
arrPtExt(6) = Rhino.AddCircle (arrPlaneExt(6), 4.5)
arrPtExt(7) = Rhino.AddCircle (arrPlaneExt(7), 3.5)
arrPtExt(8) = Rhino.AddCircle (arrPlaneExt(8), 3)
arrPtExt(9) = Rhino.AddCircle (arrPlaneExt(9), 2)
arrPtExt(10) = Rhino.AddCircle (arrPlaneExt(10), 2)
arrPtExt(11) = Rhino.AddCircle (arrPlaneExt(11), 3)
arrPtExt(12) = Rhino.AddCircle (arrPlaneExt(12), 4)
arrPtExt(13) = Rhino.AddCircle (arrPlaneExt(13), 4.5)
arrPtExt(14) = Rhino.AddCircle (arrPlaneExt(14), 6)
arrPtExt(15) = Rhino.AddCircle (arrPlaneExt(15), 6)
arrPtExt(16) = Rhino.AddCircle (arrPlaneExt(16), 4.5)
arrPtExt(17) = Rhino.AddCircle (arrPlaneExt(17), 4)
arrPtExt(18) = Rhino.AddCircle (arrPlaneExt(18), 3)
arrPtExt(19) = Rhino.AddCircle (arrPlaneExt(19), 2)
arrPtExt(20) = Rhino.AddCircle (arrPlaneExt(20), 2)
arrPtExt(21) = Rhino.AddCircle (arrPlaneExt(21), 2)
arrPtExt(22) = Rhino.AddCircle (arrPlaneExt(22), 1)
arrPtExt(23) = Rhino.AddCircle (arrPlaneExt(23), 0.5)
arrPtExt(24) = Rhino.AddCircle (arrPlaneExt(24), 0.5)
arrPtExt(25) = Rhino.AddCircle (arrPlaneExt(25), 0.5)

Rhino.AddLoftSrf (arrPtExt),,,1
Rhino.AddPlanarSrf Array(arrPtExt(0))
Rhino.AddPlanarSrf Array(arrPtExt(25))
Rhino.DeleteObjects (arrPtExt)

ReDim Preserve arrCurveFloor(7)
arrCurveFloor(0)=Array(((arrPoints2(0)-arrPoints1(0))*0/20+7*Cos(18*a+0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0/20+7*Sin(18*a+0)+arrPoints1(1),arrPoints1(2))
arrCurveFloor(1)=Array(((arrPoints2(0)-arrPoints1(0))*0.1/20+14*Cos(18*a+0.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.1/20+14*Sin(18*a+0.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*1.215/20+arrPoints1(2))
arrCurveFloor(2)=Array(((arrPoints2(0)-arrPoints1(0))*0.44/20+21*Cos(18*a+0.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.44/20+21*Sin(18*a+0.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*2.42/20+arrPoints1(2))
arrCurveFloor(3)=Array(((arrPoints2(0)-arrPoints1(0))*1.02/20+28*Cos(18*a+0.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.02/20+28*Sin(18*a+0.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*3.6/20+arrPoints1(2))
arrCurveFloor(4)=Array(((arrPoints2(0)-arrPoints1(0))*1.88/20+35*Cos(18*a+0.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.88/20+35*Sin(18*a+0.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*4.735/20+arrPoints1(2))
arrCurveFloor(5)=Array(((arrPoints2(0)-arrPoints1(0))*2.99/20+42*Cos(18*a+0.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*2.99/20+42*Sin(18*a+0.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*5.82/20+arrPoints1(2))
arrCurveFloor(6)=Array(((arrPoints2(0)-arrPoints1(0))*4.32/20+49*Cos(18*a+0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*4.32/20+49*Sin(18*a+0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*6.835/20+arrPoints1(2))
arrCurveFloor(7)=Array(((arrPoints2(0)-arrPoints1(0))*5.82/20+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*5.82/20+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*6.835/20+arrPoints1(2))
ReDim Preserve arrPlaneFloor(7)

arrPlaneFloor(0) = Rhino.PlaneFromPoints ((arrCurveFloor(0)),Array(arrCurveFloor(0)(0)+1,arrCurveFloor(0)(1),arrCurveFloor(0)(2)),Array(arrCurveFloor(0)(0),arrCurveFloor(0)(1)+1,arrCurveFloor(0)(2)))
arrPlaneFloor(1) = Rhino.PlaneFromPoints ((arrCurveFloor(1)),Array(arrCurveFloor(1)(0)+1,arrCurveFloor(1)(1),arrCurveFloor(1)(2)),Array(arrCurveFloor(1)(0),arrCurveFloor(1)(1)+1,arrCurveFloor(1)(2)))
arrPlaneFloor(2) = Rhino.PlaneFromPoints ((arrCurveFloor(2)),Array(arrCurveFloor(2)(0)+1,arrCurveFloor(2)(1),arrCurveFloor(2)(2)),Array(arrCurveFloor(2)(0),arrCurveFloor(2)(1)+1,arrCurveFloor(2)(2)))
arrPlaneFloor(3) = Rhino.PlaneFromPoints ((arrCurveFloor(3)),Array(arrCurveFloor(3)(0)+1,arrCurveFloor(3)(1),arrCurveFloor(3)(2)),Array(arrCurveFloor(3)(0),arrCurveFloor(2)(1)+1,arrCurveFloor(3)(2)))
arrPlaneFloor(4) = Rhino.PlaneFromPoints ((arrCurveFloor(4)),Array(arrCurveFloor(4)(0)+1,arrCurveFloor(4)(1),arrCurveFloor(4)(2)),Array(arrCurveFloor(4)(0),arrCurveFloor(4)(1)+1,arrCurveFloor(4)(2)))
arrPlaneFloor(5) = Rhino.PlaneFromPoints ((arrCurveFloor(5)),Array(arrCurveFloor(5)(0)+1,arrCurveFloor(5)(1),arrCurveFloor(5)(2)),Array(arrCurveFloor(5)(0),arrCurveFloor(5)(1)+1,arrCurveFloor(5)(2)))
arrPlaneFloor(6) = Rhino.PlaneFromPoints ((arrCurveFloor(6)),Array(arrCurveFloor(6)(0)+1,arrCurveFloor(6)(1),arrCurveFloor(6)(2)),Array(arrCurveFloor(6)(0),arrCurveFloor(6)(1)+1,arrCurveFloor(6)(2)))
arrPlaneFloor(7) = Rhino.PlaneFromPoints ((arrCurveFloor(7)),Array(arrCurveFloor(7)(0),arrCurveFloor(7)(1)+1,arrCurveFloor(7)(2)),Array(arrCurveFloor(7)(0),arrCurveFloor(7)(1),arrCurveFloor(7)(2)+1))
ReDim Preserve arrPtFloor(7)
arrPtFloor(0) = Rhino.AddCircle (arrPlaneFloor(0), 3)
arrPtFloor(1) = Rhino.AddCircle (arrPlaneFloor(1), 4.5)
arrPtFloor(2) = Rhino.AddCircle (arrPlaneFloor(2), 6)
arrPtFloor(3) = Rhino.AddCircle (arrPlaneFloor(3), 5)
arrPtFloor(4) = Rhino.AddCircle (arrPlaneFloor(4), 6)
arrPtFloor(5) = Rhino.AddCircle (arrPlaneFloor(5), 7.5)
arrPtFloor(6) = Rhino.AddCircle (arrPlaneFloor(6), 6)
arrPtFloor(7) = Rhino.AddCircle (arrPlaneFloor(7), 3)

Rhino.AddLoftSrf (arrPtFloor),,,1

Rhino.AddPlanarSrf Array(arrPtFloor(0))
Rhino.AddPlanarSrf Array(arrPtFloor(7))

Rhino.DeleteObjects (arrPtFloor)

ReDim Preserve arrCurveFloor2(10)
arrCurveFloor2(0)=Array(((arrPoints2(0)-arrPoints1(0))*0/20+7*Cos(18*a+0)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0/20+7*Sin(18*a+0)+arrPoints1(1),arrPoints1(2))
arrCurveFloor2(1)=Array(((arrPoints2(0)-arrPoints1(0))*0.1/20+14*Cos(18*a+0.1)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.1/20+14*Sin(18*a+0.1)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*1.215/20+arrPoints1(2))
arrCurveFloor2(2)=Array(((arrPoints2(0)-arrPoints1(0))*0.44/20+21*Cos(18*a+0.2)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*0.44/20+21*Sin(18*a+0.2)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*2.42/20+arrPoints1(2))
arrCurveFloor2(3)=Array(((arrPoints2(0)-arrPoints1(0))*1.02/20+28*Cos(18*a+0.3)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.02/20+28*Sin(18*a+0.3)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*3.6/20+arrPoints1(2))
arrCurveFloor2(4)=Array(((arrPoints2(0)-arrPoints1(0))*1.88/20+35*Cos(18*a+0.4)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*1.88/20+35*Sin(18*a+0.4)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*4.735/20+arrPoints1(2))
arrCurveFloor2(5)=Array(((arrPoints2(0)-arrPoints1(0))*2.99/20+42*Cos(18*a+0.5)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*2.99/20+42*Sin(18*a+0.5)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*5.82/20+arrPoints1(2))
arrCurveFloor2(6)=Array(((arrPoints2(0)-arrPoints1(0))*4.32/20+49*Cos(18*a+0.6)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*4.32/20+49*Sin(18*a+0.6)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*6.835/20+arrPoints1(2))
arrCurveFloor2(7)=Array(((arrPoints2(0)-arrPoints1(0))*5.82/20+49*Cos(18*a+0.7)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*5.82/20+49*Sin(18*a+0.7)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*7.79/20+arrPoints1(2))
arrCurveFloor2(8)=Array(((arrPoints2(0)-arrPoints1(0))*7.45/20+49*Cos(18*a+0.8)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*7.45/20+49*Sin(18*a+0.8)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*8.695/20+arrPoints1(2))
arrCurveFloor2(9)=Array(((arrPoints2(0)-arrPoints1(0))*9.14/20+49*Cos(18*a+0.9)+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*9.14/20+49*Sin(18*a+0.9)+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*9.57/20+arrPoints1(2))
arrCurveFloor2(10)=Array(((arrPoints2(0)-arrPoints1(0))*5.82/20+arrPoints1(0)),(arrPoints2(1)-arrPoints1(1))*5.82/20+arrPoints1(1),(arrPoints2(2)-arrPoints1(2))*9.57/20+arrPoints1(2))
ReDim Preserve arrPlaneFloor2(10)

arrPlaneFloor2(0) = Rhino.PlaneFromPoints ((arrCurveFloor2(0)),Array(arrCurveFloor2(0)(0)+1,arrCurveFloor2(0)(1),arrCurveFloor2(0)(2)),Array(arrCurveFloor2(0)(0),arrCurveFloor2(0)(1)+1,arrCurveFloor2(0)(2)))
arrPlaneFloor2(1) = Rhino.PlaneFromPoints ((arrCurveFloor2(1)),Array(arrCurveFloor2(1)(0)+1,arrCurveFloor2(1)(1),arrCurveFloor2(1)(2)),Array(arrCurveFloor2(1)(0),arrCurveFloor2(1)(1)+1,arrCurveFloor2(1)(2)))
arrPlaneFloor2(2) = Rhino.PlaneFromPoints ((arrCurveFloor2(2)),Array(arrCurveFloor2(2)(0)+1,arrCurveFloor2(2)(1),arrCurveFloor2(2)(2)),Array(arrCurveFloor2(2)(0),arrCurveFloor2(2)(1)+1,arrCurveFloor2(2)(2)))
arrPlaneFloor2(3) = Rhino.PlaneFromPoints ((arrCurveFloor2(3)),Array(arrCurveFloor2(3)(0)+1,arrCurveFloor2(3)(1),arrCurveFloor2(3)(2)),Array(arrCurveFloor2(3)(0),arrCurveFloor2(2)(1)+1,arrCurveFloor2(3)(2)))
arrPlaneFloor2(4) = Rhino.PlaneFromPoints ((arrCurveFloor2(4)),Array(arrCurveFloor2(4)(0)+1,arrCurveFloor2(4)(1),arrCurveFloor2(4)(2)),Array(arrCurveFloor2(4)(0),arrCurveFloor2(4)(1)+1,arrCurveFloor2(4)(2)))
arrPlaneFloor2(5) = Rhino.PlaneFromPoints ((arrCurveFloor2(5)),Array(arrCurveFloor2(5)(0)+1,arrCurveFloor2(5)(1),arrCurveFloor2(5)(2)),Array(arrCurveFloor2(5)(0),arrCurveFloor2(5)(1)+1,arrCurveFloor2(5)(2)))
arrPlaneFloor2(6) = Rhino.PlaneFromPoints ((arrCurveFloor2(6)),Array(arrCurveFloor2(6)(0)+1,arrCurveFloor2(6)(1),arrCurveFloor2(6)(2)),Array(arrCurveFloor2(6)(0),arrCurveFloor2(6)(1)+1,arrCurveFloor2(6)(2)))
arrPlaneFloor2(7) = Rhino.PlaneFromPoints ((arrCurveFloor2(7)),Array(arrCurveFloor2(7)(0)+1,arrCurveFloor2(7)(1),arrCurveFloor2(7)(2)),Array(arrCurveFloor2(7)(0),arrCurveFloor2(7)(1)+1,arrCurveFloor2(7)(2)))
arrPlaneFloor2(8) = Rhino.PlaneFromPoints ((arrCurveFloor2(8)),Array(arrCurveFloor2(8)(0)+1,arrCurveFloor2(8)(1),arrCurveFloor2(8)(2)),Array(arrCurveFloor2(8)(0),arrCurveFloor2(8)(1)+1,arrCurveFloor2(8)(2)))
arrPlaneFloor2(9) = Rhino.PlaneFromPoints ((arrCurveFloor2(9)),Array(arrCurveFloor2(9)(0)+1,arrCurveFloor2(9)(1),arrCurveFloor2(9)(2)),Array(arrCurveFloor2(9)(0),arrCurveFloor2(9)(1)+1,arrCurveFloor2(9)(2)))
arrPlaneFloor2(10) = Rhino.PlaneFromPoints ((arrCurveFloor2(10)),Array(arrCurveFloor2(10)(0),arrCurveFloor2(10)(1)+1,arrCurveFloor2(10)(2)),Array(arrCurveFloor2(10)(0),arrCurveFloor2(10)(1),arrCurveFloor2(10)(2)+1))
ReDim Preserve arrPtFloor2(10)
arrPtFloor2(0) = Rhino.AddCircle (arrPlaneFloor2(0), 3)
arrPtFloor2(1) = Rhino.AddCircle (arrPlaneFloor2(1), 4.5)
arrPtFloor2(2) = Rhino.AddCircle (arrPlaneFloor2(2), 6.6)
arrPtFloor2(3) = Rhino.AddCircle (arrPlaneFloor2(3), 6.9)
arrPtFloor2(4) = Rhino.AddCircle (arrPlaneFloor2(4), 7.5)
arrPtFloor2(5) = Rhino.AddCircle (arrPlaneFloor2(5), 7.5)
arrPtFloor2(6) = Rhino.AddCircle (arrPlaneFloor2(6), 6.9)
arrPtFloor2(7) = Rhino.AddCircle (arrPlaneFloor2(7), 6.6)
arrPtFloor2(8) = Rhino.AddCircle (arrPlaneFloor2(8), 6)
arrPtFloor2(9) = Rhino.AddCircle (arrPlaneFloor2(9), 4.5)
arrPtFloor2(10) = Rhino.AddCircle (arrPlaneFloor2(10), 3)

Rhino.AddLoftSrf (arrPtFloor2),,,1

Rhino.AddPlanarSrf Array(arrPtFloor2(0))
Rhino.AddPlanarSrf Array(arrPtFloor2(10))

Rhino.DeleteObjects (arrPtFloor2)

ReDim Preserve arrCurveSub1(2)
arrCurveSub1(0)=arrCurve(3)
arrCurveSub1(1)=arrCurve(4)
arrCurveSub1(2)=Array(arrCurve(4)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(4)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(4)(2)+Rnd*20)
ReDim Preserve arrCurveSub2(2)
arrCurveSub2(0)=arrCurve(4)
arrCurveSub2(1)=arrCurve(5)
arrCurveSub2(2)=Array(arrCurve(5)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(5)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(5)(2)+Rnd*25)
ReDim Preserve arrCurveSub3(2)
arrCurveSub3(0)=arrCurve(5)
arrCurveSub3(1)=arrCurve(6)
arrCurveSub3(2)=Array(arrCurve(6)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(6)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(6)(2)+Rnd*30)
ReDim Preserve arrCurveSub4(2)
arrCurveSub4(0)=arrCurve(3)
arrCurveSub4(1)=arrCurve(7)
arrCurveSub4(2)=Array(arrCurve(7)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(7)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(7)(2)+Rnd*35)
ReDim Preserve arrCurveSub5(2)
arrCurveSub5(0)=arrCurve(7)
arrCurveSub5(1)=arrCurve(8)
arrCurveSub5(2)=Array(arrCurve(8)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(8)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(8)(2)+Rnd*40)
ReDim Preserve arrCurveSub6(2)
arrCurveSub6(0)=arrCurve(8)
arrCurveSub6(1)=arrCurve(9)
arrCurveSub6(2)=Array(arrCurve(9)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(9)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(9)(2)+Rnd*45)
ReDim Preserve arrCurveSub7(2)
arrCurveSub7(0)=arrCurve(9)
arrCurveSub7(1)=arrCurve(10)
arrCurveSub7(2)=Array(arrCurve(10)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(10)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(10)(2)+Rnd*50)
ReDim Preserve arrCurveSub8(2)
arrCurveSub8(0)=arrCurve(10)
arrCurveSub8(1)=arrCurve(11)
arrCurveSub8(2)=Array(arrCurve(11)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(11)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(11)(2)+Rnd*55)
ReDim Preserve arrCurveSub9(2)
arrCurveSub9(0)=arrCurve(11)
arrCurveSub9(1)=arrCurve(12)
arrCurveSub9(2)=Array(arrCurve(12)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(12)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(12)(2)+Rnd*60)
ReDim Preserve arrCurveSub10(2)
arrCurveSub10(0)=arrCurve(12)
arrCurveSub10(1)=arrCurve(13)
arrCurveSub10(2)=Array(arrCurve(13)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(13)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(13)(2)+Rnd*65)
ReDim Preserve arrCurveSub11(2)
arrCurveSub11(0)=arrCurve(13)
arrCurveSub11(1)=arrCurve(14)
arrCurveSub11(2)=Array(arrCurve(14)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(14)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(14)(2)+Rnd*60)
ReDim Preserve arrCurveSub12(2)
arrCurveSub12(0)=arrCurve(14)
arrCurveSub12(1)=arrCurve(15)
arrCurveSub12(2)=Array(arrCurve(15)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(15)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(15)(2)+Rnd*55)
ReDim Preserve arrCurveSub13(2)
arrCurveSub13(0)=arrCurve(15)
arrCurveSub13(1)=arrCurve(16)
arrCurveSub13(2)=Array(arrCurve(16)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(16)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(16)(2)+Rnd*50)
ReDim Preserve arrCurveSub14(2)
arrCurveSub14(0)=arrCurve(16)
arrCurveSub14(1)=arrCurve(17)
arrCurveSub14(2)=Array(arrCurve(17)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(17)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(17)(2)+Rnd*45)
ReDim Preserve arrCurveSub15(2)
arrCurveSub15(0)=arrCurve(17)
arrCurveSub15(1)=arrCurve(18)
arrCurveSub15(2)=Array(arrCurve(18)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(18)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(18)(2)+Rnd*40)
ReDim Preserve arrCurveSub16(2)
arrCurveSub16(0)=arrCurve(18)
arrCurveSub16(1)=arrCurve(19)
arrCurveSub16(2)=Array(arrCurve(19)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(19)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(19)(2)+Rnd*35)
ReDim Preserve arrCurveSub17(2)
arrCurveSub17(0)=arrCurve(19)
arrCurveSub17(1)=arrCurve(20)
arrCurveSub17(2)=Array(arrCurve(20)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(20)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(20)(2)+Rnd*30)
ReDim Preserve arrCurveSub18(2)
arrCurveSub18(0)=arrCurve(20)
arrCurveSub18(1)=arrCurve(21)
arrCurveSub18(2)=Array(arrCurve(21)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(21)(1)+14*Sin(18*a+0)+Rnd*10,arrCurve(21)(2)+Rnd*25)
ReDim Preserve arrCurveSub19(2)
arrCurveSub19(0)=arrCurve(21)
arrCurveSub19(1)=arrCurve(22)
arrCurveSub19(2)=Array(arrCurve(22)(0)+14*Cos(18*a+0)+Rnd*10,arrCurve(2)(1)-14*Sin(18*a+0)+Rnd*10,arrCurve(22)(2)+Rnd*20)

ReDim Preserve arrPlaneSub1(2)
arrPlaneSub1(0)=Rhino.PlaneFromPoints ((arrCurveSub1(0)),Array(arrCurveSub1(0)(0)+1,arrCurveSub1(0)(1),arrCurveSub1(0)(2)),Array(arrCurveSub1(0)(0),arrCurveSub1(0)(1)+1,arrCurveSub1(0)(2)))
arrPlaneSub1(1)=Rhino.PlaneFromPoints ((arrCurveSub1(1)),Array(arrCurveSub1(1)(0)+1,arrCurveSub1(1)(1),arrCurveSub1(1)(2)),Array(arrCurveSub1(1)(0),arrCurveSub1(1)(1)+1,arrCurveSub1(1)(2)))
arrPlaneSub1(2)=Rhino.PlaneFromPoints ((arrCurveSub1(2)),Array(arrCurveSub1(2)(0)+1,arrCurveSub1(2)(1),arrCurveSub1(2)(2)),Array(arrCurveSub1(2)(0),arrCurveSub1(2)(1)+1,arrCurveSub1(2)(2)))
ReDim Preserve arrPlaneSub2(2)
arrPlaneSub2(0)=Rhino.PlaneFromPoints ((arrCurveSub2(0)),Array(arrCurveSub2(0)(0)+1,arrCurveSub2(0)(1),arrCurveSub2(0)(2)),Array(arrCurveSub2(0)(0),arrCurveSub2(0)(1)+1,arrCurveSub2(0)(2)))
arrPlaneSub2(1)=Rhino.PlaneFromPoints ((arrCurveSub2(1)),Array(arrCurveSub2(1)(0)+1,arrCurveSub2(1)(1),arrCurveSub2(1)(2)),Array(arrCurveSub2(1)(0),arrCurveSub2(1)(1)+1,arrCurveSub2(1)(2)))
arrPlaneSub2(2)=Rhino.PlaneFromPoints ((arrCurveSub2(2)),Array(arrCurveSub2(2)(0)+1,arrCurveSub2(2)(1),arrCurveSub2(2)(2)),Array(arrCurveSub2(2)(0),arrCurveSub2(2)(1)+1,arrCurveSub2(2)(2)))
ReDim Preserve arrPlaneSub3(2)
arrPlaneSub3(0)=Rhino.PlaneFromPoints ((arrCurveSub3(0)),Array(arrCurveSub3(0)(0)+1,arrCurveSub3(0)(1),arrCurveSub3(0)(2)),Array(arrCurveSub3(0)(0),arrCurveSub3(0)(1)+1,arrCurveSub3(0)(2)))
arrPlaneSub3(1)=Rhino.PlaneFromPoints ((arrCurveSub3(1)),Array(arrCurveSub3(1)(0)+1,arrCurveSub3(1)(1),arrCurveSub3(1)(2)),Array(arrCurveSub3(1)(0),arrCurveSub3(1)(1)+1,arrCurveSub3(1)(2)))
arrPlaneSub3(2)=Rhino.PlaneFromPoints ((arrCurveSub3(2)),Array(arrCurveSub3(2)(0)+1,arrCurveSub3(2)(1),arrCurveSub3(2)(2)),Array(arrCurveSub3(2)(0),arrCurveSub3(2)(1)+1,arrCurveSub3(2)(2)))
ReDim Preserve arrPlaneSub4(2)
arrPlaneSub4(0)=Rhino.PlaneFromPoints ((arrCurveSub4(0)),Array(arrCurveSub4(0)(0)+1,arrCurveSub4(0)(1),arrCurveSub4(0)(2)),Array(arrCurveSub4(0)(0),arrCurveSub4(0)(1)+1,arrCurveSub4(0)(2)))
arrPlaneSub4(1)=Rhino.PlaneFromPoints ((arrCurveSub4(1)),Array(arrCurveSub4(1)(0)+1,arrCurveSub4(1)(1),arrCurveSub4(1)(2)),Array(arrCurveSub4(1)(0),arrCurveSub4(1)(1)+1,arrCurveSub4(1)(2)))
arrPlaneSub4(2)=Rhino.PlaneFromPoints ((arrCurveSub4(2)),Array(arrCurveSub4(2)(0)+1,arrCurveSub4(2)(1),arrCurveSub4(2)(2)),Array(arrCurveSub4(2)(0),arrCurveSub4(2)(1)+1,arrCurveSub4(2)(2)))
ReDim Preserve arrPlaneSub5(2)
arrPlaneSub5(0)=Rhino.PlaneFromPoints ((arrCurveSub5(0)),Array(arrCurveSub5(0)(0)+1,arrCurveSub5(0)(1),arrCurveSub5(0)(2)),Array(arrCurveSub5(0)(0),arrCurveSub5(0)(1)+1,arrCurveSub5(0)(2)))
arrPlaneSub5(1)=Rhino.PlaneFromPoints ((arrCurveSub5(1)),Array(arrCurveSub5(1)(0)+1,arrCurveSub5(1)(1),arrCurveSub5(1)(2)),Array(arrCurveSub5(1)(0),arrCurveSub5(1)(1)+1,arrCurveSub5(1)(2)))
arrPlaneSub5(2)=Rhino.PlaneFromPoints ((arrCurveSub5(2)),Array(arrCurveSub5(2)(0)+1,arrCurveSub5(2)(1),arrCurveSub5(2)(2)),Array(arrCurveSub5(2)(0),arrCurveSub5(2)(1)+1,arrCurveSub5(2)(2)))
ReDim Preserve arrPlaneSub6(2)
arrPlaneSub6(0)=Rhino.PlaneFromPoints ((arrCurveSub6(0)),Array(arrCurveSub6(0)(0)+1,arrCurveSub6(0)(1),arrCurveSub6(0)(2)),Array(arrCurveSub6(0)(0),arrCurveSub6(0)(1)+1,arrCurveSub6(0)(2)))
arrPlaneSub6(1)=Rhino.PlaneFromPoints ((arrCurveSub6(1)),Array(arrCurveSub6(1)(0)+1,arrCurveSub6(1)(1),arrCurveSub6(1)(2)),Array(arrCurveSub6(1)(0),arrCurveSub6(1)(1)+1,arrCurveSub6(1)(2)))
arrPlaneSub6(2)=Rhino.PlaneFromPoints ((arrCurveSub6(2)),Array(arrCurveSub6(2)(0)+1,arrCurveSub6(2)(1),arrCurveSub6(2)(2)),Array(arrCurveSub6(2)(0),arrCurveSub6(2)(1)+1,arrCurveSub6(2)(2)))
ReDim Preserve arrPlaneSub7(2)
arrPlaneSub7(0)=Rhino.PlaneFromPoints ((arrCurveSub7(0)),Array(arrCurveSub7(0)(0)+1,arrCurveSub7(0)(1),arrCurveSub7(0)(2)),Array(arrCurveSub7(0)(0),arrCurveSub7(0)(1)+1,arrCurveSub7(0)(2)))
arrPlaneSub7(1)=Rhino.PlaneFromPoints ((arrCurveSub7(1)),Array(arrCurveSub7(1)(0)+1,arrCurveSub7(1)(1),arrCurveSub7(1)(2)),Array(arrCurveSub7(1)(0),arrCurveSub7(1)(1)+1,arrCurveSub7(1)(2)))
arrPlaneSub7(2)=Rhino.PlaneFromPoints ((arrCurveSub7(2)),Array(arrCurveSub7(2)(0)+1,arrCurveSub7(2)(1),arrCurveSub7(2)(2)),Array(arrCurveSub7(2)(0),arrCurveSub7(2)(1)+1,arrCurveSub7(2)(2)))
ReDim Preserve arrPlaneSub8(2)
arrPlaneSub8(0)=Rhino.PlaneFromPoints ((arrCurveSub8(0)),Array(arrCurveSub8(0)(0)+1,arrCurveSub8(0)(1),arrCurveSub8(0)(2)),Array(arrCurveSub8(0)(0),arrCurveSub8(0)(1)+1,arrCurveSub8(0)(2)))
arrPlaneSub8(1)=Rhino.PlaneFromPoints ((arrCurveSub8(1)),Array(arrCurveSub8(1)(0)+1,arrCurveSub8(1)(1),arrCurveSub8(1)(2)),Array(arrCurveSub8(1)(0),arrCurveSub8(1)(1)+1,arrCurveSub8(1)(2)))
arrPlaneSub8(2)=Rhino.PlaneFromPoints ((arrCurveSub8(2)),Array(arrCurveSub8(2)(0)+1,arrCurveSub8(2)(1),arrCurveSub8(2)(2)),Array(arrCurveSub8(2)(0),arrCurveSub8(2)(1)+1,arrCurveSub8(2)(2)))
ReDim Preserve arrPlaneSub9(2)
arrPlaneSub9(0)=Rhino.PlaneFromPoints ((arrCurveSub9(0)),Array(arrCurveSub9(0)(0)+1,arrCurveSub9(0)(1),arrCurveSub9(0)(2)),Array(arrCurveSub9(0)(0),arrCurveSub9(0)(1)+1,arrCurveSub9(0)(2)))
arrPlaneSub9(1)=Rhino.PlaneFromPoints ((arrCurveSub9(1)),Array(arrCurveSub9(1)(0)+1,arrCurveSub9(1)(1),arrCurveSub9(1)(2)),Array(arrCurveSub9(1)(0),arrCurveSub9(1)(1)+1,arrCurveSub9(1)(2)))
arrPlaneSub9(2)=Rhino.PlaneFromPoints ((arrCurveSub9(2)),Array(arrCurveSub9(2)(0)+1,arrCurveSub9(2)(1),arrCurveSub9(2)(2)),Array(arrCurveSub9(2)(0),arrCurveSub9(2)(1)+1,arrCurveSub9(2)(2)))
ReDim Preserve arrPlaneSub10(2)
arrPlaneSub10(0)=Rhino.PlaneFromPoints ((arrCurveSub10(0)),Array(arrCurveSub10(0)(0)+1,arrCurveSub10(0)(1),arrCurveSub10(0)(2)),Array(arrCurveSub10(0)(0),arrCurveSub10(0)(1)+1,arrCurveSub10(0)(2)))
arrPlaneSub10(1)=Rhino.PlaneFromPoints ((arrCurveSub10(1)),Array(arrCurveSub10(1)(0)+1,arrCurveSub10(1)(1),arrCurveSub10(1)(2)),Array(arrCurveSub10(1)(0),arrCurveSub10(1)(1)+1,arrCurveSub10(1)(2)))
arrPlaneSub10(2)=Rhino.PlaneFromPoints ((arrCurveSub10(2)),Array(arrCurveSub10(2)(0)+1,arrCurveSub10(2)(1),arrCurveSub10(2)(2)),Array(arrCurveSub10(2)(0),arrCurveSub10(2)(1)+1,arrCurveSub10(2)(2)))
ReDim Preserve arrPlaneSub11(2)
arrPlaneSub11(0)=Rhino.PlaneFromPoints ((arrCurveSub11(0)),Array(arrCurveSub11(0)(0)+1,arrCurveSub11(0)(1),arrCurveSub11(0)(2)),Array(arrCurveSub11(0)(0),arrCurveSub11(0)(1)+1,arrCurveSub11(0)(2)))
arrPlaneSub11(1)=Rhino.PlaneFromPoints ((arrCurveSub11(1)),Array(arrCurveSub11(1)(0)+1,arrCurveSub11(1)(1),arrCurveSub11(1)(2)),Array(arrCurveSub11(1)(0),arrCurveSub11(1)(1)+1,arrCurveSub11(1)(2)))
arrPlaneSub11(2)=Rhino.PlaneFromPoints ((arrCurveSub11(2)),Array(arrCurveSub11(2)(0)+1,arrCurveSub11(2)(1),arrCurveSub11(2)(2)),Array(arrCurveSub11(2)(0),arrCurveSub11(2)(1)+1,arrCurveSub11(2)(2)))
ReDim Preserve arrPlaneSub12(2)
arrPlaneSub12(0)=Rhino.PlaneFromPoints ((arrCurveSub12(0)),Array(arrCurveSub12(0)(0)+1,arrCurveSub12(0)(1),arrCurveSub12(0)(2)),Array(arrCurveSub12(0)(0),arrCurveSub12(0)(1)+1,arrCurveSub12(0)(2)))
arrPlaneSub12(1)=Rhino.PlaneFromPoints ((arrCurveSub12(1)),Array(arrCurveSub12(1)(0)+1,arrCurveSub12(1)(1),arrCurveSub12(1)(2)),Array(arrCurveSub12(1)(0),arrCurveSub12(1)(1)+1,arrCurveSub12(1)(2)))
arrPlaneSub12(2)=Rhino.PlaneFromPoints ((arrCurveSub12(2)),Array(arrCurveSub12(2)(0)+1,arrCurveSub12(2)(1),arrCurveSub12(2)(2)),Array(arrCurveSub12(2)(0),arrCurveSub12(2)(1)+1,arrCurveSub12(2)(2)))
ReDim Preserve arrPlaneSub13(2)
arrPlaneSub13(0)=Rhino.PlaneFromPoints ((arrCurveSub13(0)),Array(arrCurveSub13(0)(0)+1,arrCurveSub13(0)(1),arrCurveSub13(0)(2)),Array(arrCurveSub13(0)(0),arrCurveSub13(0)(1)+1,arrCurveSub13(0)(2)))
arrPlaneSub13(1)=Rhino.PlaneFromPoints ((arrCurveSub13(1)),Array(arrCurveSub13(1)(0)+1,arrCurveSub13(1)(1),arrCurveSub13(1)(2)),Array(arrCurveSub13(1)(0),arrCurveSub13(1)(1)+1,arrCurveSub13(1)(2)))
arrPlaneSub13(2)=Rhino.PlaneFromPoints ((arrCurveSub13(2)),Array(arrCurveSub13(2)(0)+1,arrCurveSub13(2)(1),arrCurveSub13(2)(2)),Array(arrCurveSub13(2)(0),arrCurveSub13(2)(1)+1,arrCurveSub13(2)(2)))
ReDim Preserve arrPlaneSub14(2)
arrPlaneSub14(0)=Rhino.PlaneFromPoints ((arrCurveSub14(0)),Array(arrCurveSub14(0)(0)+1,arrCurveSub14(0)(1),arrCurveSub14(0)(2)),Array(arrCurveSub14(0)(0),arrCurveSub14(0)(1)+1,arrCurveSub14(0)(2)))
arrPlaneSub14(1)=Rhino.PlaneFromPoints ((arrCurveSub14(1)),Array(arrCurveSub14(1)(0)+1,arrCurveSub14(1)(1),arrCurveSub14(1)(2)),Array(arrCurveSub14(1)(0),arrCurveSub14(1)(1)+1,arrCurveSub14(1)(2)))
arrPlaneSub14(2)=Rhino.PlaneFromPoints ((arrCurveSub14(2)),Array(arrCurveSub14(2)(0)+1,arrCurveSub14(2)(1),arrCurveSub14(2)(2)),Array(arrCurveSub14(2)(0),arrCurveSub14(2)(1)+1,arrCurveSub14(2)(2)))
ReDim Preserve arrPlaneSub15(2)
arrPlaneSub15(0)=Rhino.PlaneFromPoints ((arrCurveSub15(0)),Array(arrCurveSub15(0)(0)+1,arrCurveSub15(0)(1),arrCurveSub15(0)(2)),Array(arrCurveSub15(0)(0),arrCurveSub15(0)(1)+1,arrCurveSub15(0)(2)))
arrPlaneSub15(1)=Rhino.PlaneFromPoints ((arrCurveSub15(1)),Array(arrCurveSub15(1)(0)+1,arrCurveSub15(1)(1),arrCurveSub15(1)(2)),Array(arrCurveSub15(1)(0),arrCurveSub15(1)(1)+1,arrCurveSub15(1)(2)))
arrPlaneSub15(2)=Rhino.PlaneFromPoints ((arrCurveSub15(2)),Array(arrCurveSub15(2)(0)+1,arrCurveSub15(2)(1),arrCurveSub15(2)(2)),Array(arrCurveSub15(2)(0),arrCurveSub15(2)(1)+1,arrCurveSub15(2)(2)))
ReDim Preserve arrPlaneSub16(2)
arrPlaneSub16(0)=Rhino.PlaneFromPoints ((arrCurveSub16(0)),Array(arrCurveSub16(0)(0)+1,arrCurveSub16(0)(1),arrCurveSub16(0)(2)),Array(arrCurveSub16(0)(0),arrCurveSub16(0)(1)+1,arrCurveSub16(0)(2)))
arrPlaneSub16(1)=Rhino.PlaneFromPoints ((arrCurveSub16(1)),Array(arrCurveSub16(1)(0)+1,arrCurveSub16(1)(1),arrCurveSub16(1)(2)),Array(arrCurveSub16(1)(0),arrCurveSub16(1)(1)+1,arrCurveSub16(1)(2)))
arrPlaneSub16(2)=Rhino.PlaneFromPoints ((arrCurveSub16(2)),Array(arrCurveSub16(2)(0)+1,arrCurveSub16(2)(1),arrCurveSub16(2)(2)),Array(arrCurveSub16(2)(0),arrCurveSub16(2)(1)+1,arrCurveSub16(2)(2)))
ReDim Preserve arrPlaneSub17(2)
arrPlaneSub17(0)=Rhino.PlaneFromPoints ((arrCurveSub17(0)),Array(arrCurveSub17(0)(0)+1,arrCurveSub17(0)(1),arrCurveSub17(0)(2)),Array(arrCurveSub17(0)(0),arrCurveSub17(0)(1)+1,arrCurveSub17(0)(2)))
arrPlaneSub17(1)=Rhino.PlaneFromPoints ((arrCurveSub17(1)),Array(arrCurveSub17(1)(0)+1,arrCurveSub17(1)(1),arrCurveSub17(1)(2)),Array(arrCurveSub17(1)(0),arrCurveSub17(1)(1)+1,arrCurveSub17(1)(2)))
arrPlaneSub17(2)=Rhino.PlaneFromPoints ((arrCurveSub17(2)),Array(arrCurveSub17(2)(0)+1,arrCurveSub17(2)(1),arrCurveSub17(2)(2)),Array(arrCurveSub17(2)(0),arrCurveSub17(2)(1)+1,arrCurveSub17(2)(2)))
ReDim Preserve arrPlaneSub18(2)
arrPlaneSub18(0)=Rhino.PlaneFromPoints ((arrCurveSub18(0)),Array(arrCurveSub18(0)(0)+1,arrCurveSub18(0)(1),arrCurveSub18(0)(2)),Array(arrCurveSub18(0)(0),arrCurveSub18(0)(1)+1,arrCurveSub18(0)(2)))
arrPlaneSub18(1)=Rhino.PlaneFromPoints ((arrCurveSub18(1)),Array(arrCurveSub18(1)(0)+1,arrCurveSub18(1)(1),arrCurveSub18(1)(2)),Array(arrCurveSub18(1)(0),arrCurveSub18(1)(1)+1,arrCurveSub18(1)(2)))
arrPlaneSub18(2)=Rhino.PlaneFromPoints ((arrCurveSub18(2)),Array(arrCurveSub18(2)(0)+1,arrCurveSub18(2)(1),arrCurveSub18(2)(2)),Array(arrCurveSub18(2)(0),arrCurveSub18(2)(1)+1,arrCurveSub18(2)(2)))
ReDim Preserve arrPlaneSub19(2)
arrPlaneSub19(0)=Rhino.PlaneFromPoints ((arrCurveSub19(0)),Array(arrCurveSub19(0)(0)+1,arrCurveSub19(0)(1),arrCurveSub19(0)(2)),Array(arrCurveSub19(0)(0),arrCurveSub19(0)(1)+1,arrCurveSub19(0)(2)))
arrPlaneSub19(1)=Rhino.PlaneFromPoints ((arrCurveSub19(1)),Array(arrCurveSub19(1)(0)+1,arrCurveSub19(1)(1),arrCurveSub19(1)(2)),Array(arrCurveSub19(1)(0),arrCurveSub19(1)(1)+1,arrCurveSub19(1)(2)))
arrPlaneSub19(2)=Rhino.PlaneFromPoints ((arrCurveSub19(2)),Array(arrCurveSub19(2)(0)+1,arrCurveSub19(2)(1),arrCurveSub19(2)(2)),Array(arrCurveSub19(2)(0),arrCurveSub19(2)(1)+1,arrCurveSub19(2)(2)))

ReDim Preserve arrPtSub1(2)
arrPtSub1(0) = Rhino.AddCircle (arrPlaneSub1(0), 2)
arrPtSub1(1) = Rhino.AddCircle (arrPlaneSub1(1), 1)
arrPtSub1(2) = Rhino.AddCircle (arrPlaneSub1(2), 0.4)
ReDim Preserve arrPtSub2(2)
arrPtSub2(0) = Rhino.AddCircle (arrPlaneSub2(0), 2)
arrPtSub2(1) = Rhino.AddCircle (arrPlaneSub2(1), 1)
arrPtSub2(2) = Rhino.AddCircle (arrPlaneSub2(2), 0.4)
ReDim Preserve arrPtSub3(2)
arrPtSub3(0) = Rhino.AddCircle (arrPlaneSub3(0), 2)
arrPtSub3(1) = Rhino.AddCircle (arrPlaneSub3(1), 1)
arrPtSub3(2) = Rhino.AddCircle (arrPlaneSub3(2), 0.4)
ReDim Preserve arrPtSub4(2)
arrPtSub4(0) = Rhino.AddCircle (arrPlaneSub4(0), 2)
arrPtSub4(1) = Rhino.AddCircle (arrPlaneSub4(1), 1)
arrPtSub4(2) = Rhino.AddCircle (arrPlaneSub4(2), 0.4)
ReDim Preserve arrPtSub5(2)
arrPtSub5(0) = Rhino.AddCircle (arrPlaneSub5(0), 2)
arrPtSub5(1) = Rhino.AddCircle (arrPlaneSub5(1), 1)
arrPtSub5(2) = Rhino.AddCircle (arrPlaneSub5(2), 0.4)
ReDim Preserve arrPtSub6(2)
arrPtSub6(0) = Rhino.AddCircle (arrPlaneSub6(0), 2)
arrPtSub6(1) = Rhino.AddCircle (arrPlaneSub6(1), 1)
arrPtSub6(2) = Rhino.AddCircle (arrPlaneSub6(2), 0.4)
ReDim Preserve arrPtSub7(2)
arrPtSub7(0) = Rhino.AddCircle (arrPlaneSub7(0), 2)
arrPtSub7(1) = Rhino.AddCircle (arrPlaneSub7(1), 1)
arrPtSub7(2) = Rhino.AddCircle (arrPlaneSub7(2), 0.4)
ReDim Preserve arrPtSub8(2)
arrPtSub8(0) = Rhino.AddCircle (arrPlaneSub8(0), 2)
arrPtSub8(1) = Rhino.AddCircle (arrPlaneSub8(1), 1)
arrPtSub8(2) = Rhino.AddCircle (arrPlaneSub8(2), 0.4)
ReDim Preserve arrPtSub9(2)
arrPtSub9(0) = Rhino.AddCircle (arrPlaneSub9(0), 2)
arrPtSub9(1) = Rhino.AddCircle (arrPlaneSub9(1), 1)
arrPtSub9(2) = Rhino.AddCircle (arrPlaneSub9(2), 0.4)
ReDim Preserve arrPtSub10(2)
arrPtSub10(0) = Rhino.AddCircle (arrPlaneSub10(0), 2)
arrPtSub10(1) = Rhino.AddCircle (arrPlaneSub10(1), 1)
arrPtSub10(2) = Rhino.AddCircle (arrPlaneSub10(2), 0.4)
ReDim Preserve arrPtSub11(2)
arrPtSub11(0) = Rhino.AddCircle (arrPlaneSub11(0), 2)
arrPtSub11(1) = Rhino.AddCircle (arrPlaneSub11(1), 1)
arrPtSub11(2) = Rhino.AddCircle (arrPlaneSub11(2), 0.4)
ReDim Preserve arrPtSub12(2)
arrPtSub12(0) = Rhino.AddCircle (arrPlaneSub12(0), 2)
arrPtSub12(1) = Rhino.AddCircle (arrPlaneSub12(1), 1)
arrPtSub12(2) = Rhino.AddCircle (arrPlaneSub12(2), 0.4)
ReDim Preserve arrPtSub13(2)
arrPtSub13(0) = Rhino.AddCircle (arrPlaneSub13(0), 2)
arrPtSub13(1) = Rhino.AddCircle (arrPlaneSub13(1), 1)
arrPtSub13(2) = Rhino.AddCircle (arrPlaneSub13(2), 0.4)
ReDim Preserve arrPtSub14(2)
arrPtSub14(0) = Rhino.AddCircle (arrPlaneSub14(0), 2)
arrPtSub14(1) = Rhino.AddCircle (arrPlaneSub14(1), 1)
arrPtSub14(2) = Rhino.AddCircle (arrPlaneSub14(2), 0.4)
ReDim Preserve arrPtSub15(2)
arrPtSub15(0) = Rhino.AddCircle (arrPlaneSub15(0), 2)
arrPtSub15(1) = Rhino.AddCircle (arrPlaneSub15(1), 1)
arrPtSub15(2) = Rhino.AddCircle (arrPlaneSub15(2), 0.4)
ReDim Preserve arrPtSub16(2)
arrPtSub16(0) = Rhino.AddCircle (arrPlaneSub16(0), 2)
arrPtSub16(1) = Rhino.AddCircle (arrPlaneSub16(1), 1)
arrPtSub16(2) = Rhino.AddCircle (arrPlaneSub16(2), 0.4)
ReDim Preserve arrPtSub17(2)
arrPtSub17(0) = Rhino.AddCircle (arrPlaneSub17(0), 2)
arrPtSub17(1) = Rhino.AddCircle (arrPlaneSub17(1), 1)
arrPtSub17(2) = Rhino.AddCircle (arrPlaneSub17(2), 0.4)
ReDim Preserve arrPtSub18(2)
arrPtSub18(0) = Rhino.AddCircle (arrPlaneSub18(0), 2)
arrPtSub18(1) = Rhino.AddCircle (arrPlaneSub18(1), 1)
arrPtSub18(2) = Rhino.AddCircle (arrPlaneSub18(2), 0.4)
ReDim Preserve arrPtSub19(2)
arrPtSub19(0) = Rhino.AddCircle (arrPlaneSub19(0), 2)
arrPtSub19(1) = Rhino.AddCircle (arrPlaneSub19(1), 1)
arrPtSub19(2) = Rhino.AddCircle (arrPlaneSub19(2), 0.4)
Rhino.AddLoftSrf (arrPtSub1),,,1
Rhino.AddLoftSrf (arrPtSub2),,,1
Rhino.AddLoftSrf (arrPtSub3),,,1
Rhino.AddLoftSrf (arrPtSub4),,,1
Rhino.AddLoftSrf (arrPtSub5),,,1
Rhino.AddLoftSrf (arrPtSub6),,,1
Rhino.AddLoftSrf (arrPtSub7),,,1
Rhino.AddLoftSrf (arrPtSub8),,,1
Rhino.AddLoftSrf (arrPtSub9),,,1
Rhino.AddLoftSrf (arrPtSub10),,,1
Rhino.AddLoftSrf (arrPtSub11),,,1
Rhino.AddLoftSrf (arrPtSub12),,,1
Rhino.AddLoftSrf (arrPtSub13),,,1
Rhino.AddLoftSrf (arrPtSub14),,,1
Rhino.AddLoftSrf (arrPtSub15),,,1
Rhino.AddLoftSrf (arrPtSub16),,,1
Rhino.AddLoftSrf (arrPtSub17),,,1
Rhino.AddLoftSrf (arrPtSub18),,,1
Rhino.AddLoftSrf (arrPtSub19),,,1

Rhino.AddPlanarSrf Array(arrPtSub1(0))
Rhino.AddPlanarSrf Array(arrPtSub1(2))
Rhino.AddPlanarSrf Array(arrPtSub2(0))
Rhino.AddPlanarSrf Array(arrPtSub2(2))
Rhino.AddPlanarSrf Array(arrPtSub3(0))
Rhino.AddPlanarSrf Array(arrPtSub3(2))
Rhino.AddPlanarSrf Array(arrPtSub4(0))
Rhino.AddPlanarSrf Array(arrPtSub4(2))
Rhino.AddPlanarSrf Array(arrPtSub5(0))
Rhino.AddPlanarSrf Array(arrPtSub5(2))
Rhino.AddPlanarSrf Array(arrPtSub6(0))
Rhino.AddPlanarSrf Array(arrPtSub6(2))
Rhino.AddPlanarSrf Array(arrPtSub7(0))
Rhino.AddPlanarSrf Array(arrPtSub7(2))
Rhino.AddPlanarSrf Array(arrPtSub8(0))
Rhino.AddPlanarSrf Array(arrPtSub8(2))
Rhino.AddPlanarSrf Array(arrPtSub9(0))
Rhino.AddPlanarSrf Array(arrPtSub9(2))
Rhino.AddPlanarSrf Array(arrPtSub10(0))
Rhino.AddPlanarSrf Array(arrPtSub10(2))
Rhino.AddPlanarSrf Array(arrPtSub11(0))
Rhino.AddPlanarSrf Array(arrPtSub11(2))
Rhino.AddPlanarSrf Array(arrPtSub12(0))
Rhino.AddPlanarSrf Array(arrPtSub12(2))
Rhino.AddPlanarSrf Array(arrPtSub13(0))
Rhino.AddPlanarSrf Array(arrPtSub13(2))
Rhino.AddPlanarSrf Array(arrPtSub14(0))
Rhino.AddPlanarSrf Array(arrPtSub14(2))
Rhino.AddPlanarSrf Array(arrPtSub15(0))
Rhino.AddPlanarSrf Array(arrPtSub15(2))
Rhino.AddPlanarSrf Array(arrPtSub16(0))
Rhino.AddPlanarSrf Array(arrPtSub16(2))
Rhino.AddPlanarSrf Array(arrPtSub17(0))
Rhino.AddPlanarSrf Array(arrPtSub17(2))
Rhino.AddPlanarSrf Array(arrPtSub18(0))
Rhino.AddPlanarSrf Array(arrPtSub18(2))
Rhino.AddPlanarSrf Array(arrPtSub19(0))
Rhino.AddPlanarSrf Array(arrPtSub19(2))

Rhino.DeleteObjects (arrPtSub1)
Rhino.DeleteObjects (arrPtSub2)
Rhino.DeleteObjects (arrPtSub3)
Rhino.DeleteObjects (arrPtSub4)
Rhino.DeleteObjects (arrPtSub5)
Rhino.DeleteObjects (arrPtSub6)
Rhino.DeleteObjects (arrPtSub7)
Rhino.DeleteObjects (arrPtSub8)
Rhino.DeleteObjects (arrPtSub9)
Rhino.DeleteObjects (arrPtSub10)
Rhino.DeleteObjects (arrPtSub11)
Rhino.DeleteObjects (arrPtSub12)
Rhino.DeleteObjects (arrPtSub13)
Rhino.DeleteObjects (arrPtSub14)
Rhino.DeleteObjects (arrPtSub15)
Rhino.DeleteObjects (arrPtSub16)
Rhino.DeleteObjects (arrPtSub17)
Rhino.DeleteObjects (arrPtSub18)
Rhino.DeleteObjects (arrPtSub19)

ReDim Preserve arrCurveExtSub1(2)
arrCurveExtSub1(0)=arrCurveExt(0)
arrCurveExtSub1(1)=arrCurveExt(1)
arrCurveExtSub1(2)=Array(arrCurveExt(1)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(1)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(1)(2)+Rnd*20)
ReDim Preserve arrCurveExtSub2(2)
arrCurveExtSub2(0)=arrCurveExt(1)
arrCurveExtSub2(1)=arrCurveExt(2)
arrCurveExtSub2(2)=Array(arrCurveExt(2)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(2)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(2)(2)+Rnd*25)
ReDim Preserve arrCurveExtSub3(2)
arrCurveExtSub3(0)=arrCurveExt(2)
arrCurveExtSub3(1)=arrCurveExt(3)
arrCurveExtSub3(2)=Array(arrCurveExt(3)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(3)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(3)(2)+Rnd*30)
ReDim Preserve arrCurveExtSub4(2)
arrCurveExtSub4(0)=arrCurveExt(3)
arrCurveExtSub4(1)=arrCurveExt(4)
arrCurveExtSub4(2)=Array(arrCurveExt(4)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(4)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(4)(2)+Rnd*35)
ReDim Preserve arrCurveExtSub5(2)
arrCurveExtSub5(0)=arrCurveExt(4)
arrCurveExtSub5(1)=arrCurveExt(5)
arrCurveExtSub5(2)=Array(arrCurveExt(5)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(5)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(5)(2)+Rnd*40)
ReDim Preserve arrCurveExtSub6(2)
arrCurveExtSub6(0)=arrCurveExt(5)
arrCurveExtSub6(1)=arrCurveExt(6)
arrCurveExtSub6(2)=Array(arrCurveExt(6)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(6)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(6)(2)+Rnd*45)
ReDim Preserve arrCurveExtSub7(2)
arrCurveExtSub7(0)=arrCurveExt(6)
arrCurveExtSub7(1)=arrCurveExt(7)
arrCurveExtSub7(2)=Array(arrCurveExt(7)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(7)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(7)(2)+Rnd*50)
ReDim Preserve arrCurveExtSub8(2)
arrCurveExtSub8(0)=arrCurveExt(7)
arrCurveExtSub8(1)=arrCurveExt(8)
arrCurveExtSub8(2)=Array(arrCurveExt(8)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(8)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(8)(2)+Rnd*55)
ReDim Preserve arrCurveExtSub9(2)
arrCurveExtSub9(0)=arrCurveExt(8)
arrCurveExtSub9(1)=arrCurveExt(9)
arrCurveExtSub9(2)=Array(arrCurveExt(9)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(9)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(9)(2)+Rnd*60)
ReDim Preserve arrCurveExtSub10(2)
arrCurveExtSub10(0)=arrCurveExt(9)
arrCurveExtSub10(1)=arrCurveExt(10)
arrCurveExtSub10(2)=Array(arrCurveExt(10)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(10)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(10)(2)+Rnd*65)
ReDim Preserve arrCurveExtSub11(2)
arrCurveExtSub11(0)=arrCurveExt(10)
arrCurveExtSub11(1)=arrCurveExt(11)
arrCurveExtSub11(2)=Array(arrCurveExt(11)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(11)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(11)(2)+Rnd*60)
ReDim Preserve arrCurveExtSub12(2)
arrCurveExtSub12(0)=arrCurveExt(11)
arrCurveExtSub12(1)=arrCurveExt(12)
arrCurveExtSub12(2)=Array(arrCurveExt(12)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(12)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(12)(2)+Rnd*55)
ReDim Preserve arrCurveExtSub13(2)
arrCurveExtSub13(0)=arrCurveExt(12)
arrCurveExtSub13(1)=arrCurveExt(13)
arrCurveExtSub13(2)=Array(arrCurveExt(13)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(13)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(13)(2)+Rnd*50)
ReDim Preserve arrCurveExtSub14(2)
arrCurveExtSub14(0)=arrCurveExt(13)
arrCurveExtSub14(1)=arrCurveExt(14)
arrCurveExtSub14(2)=Array(arrCurveExt(14)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(14)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(14)(2)+Rnd*45)
ReDim Preserve arrCurveExtSub15(2)
arrCurveExtSub15(0)=arrCurveExt(14)
arrCurveExtSub15(1)=arrCurveExt(15)
arrCurveExtSub15(2)=Array(arrCurveExt(15)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(15)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(15)(2)+Rnd*40)
ReDim Preserve arrCurveExtSub16(2)
arrCurveExtSub16(0)=arrCurveExt(15)
arrCurveExtSub16(1)=arrCurveExt(16)
arrCurveExtSub16(2)=Array(arrCurveExt(16)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(16)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(16)(2)+Rnd*35)
ReDim Preserve arrCurveExtSub17(2)
arrCurveExtSub17(0)=arrCurveExt(16)
arrCurveExtSub17(1)=arrCurveExt(17)
arrCurveExtSub17(2)=Array(arrCurveExt(17)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(17)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(17)(2)+Rnd*30)
ReDim Preserve arrCurveExtSub18(2)
arrCurveExtSub18(0)=arrCurveExt(17)
arrCurveExtSub18(1)=arrCurveExt(18)
arrCurveExtSub18(2)=Array(arrCurveExt(18)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(18)(1)+14*Sin(18*a+0)+Rnd*10,arrCurveExt(18)(2)+Rnd*25)
ReDim Preserve arrCurveExtSub19(2)
arrCurveExtSub19(0)=arrCurveExt(18)
arrCurveExtSub19(1)=arrCurveExt(19)
arrCurveExtSub19(2)=Array(arrCurveExt(19)(0)+14*Cos(18*a+0)+Rnd*10,arrCurveExt(19)(1)-14*Sin(18*a+0)+Rnd*10,arrCurveExt(19)(2)+Rnd*20)

ReDim Preserve arrPlaneExtSub1(2)
arrPlaneExtSub1(0)=Rhino.PlaneFromPoints ((arrCurveExtSub1(0)),Array(arrCurveExtSub1(0)(0)+1,arrCurveExtSub1(0)(1),arrCurveExtSub1(0)(2)),Array(arrCurveExtSub1(0)(0),arrCurveExtSub1(0)(1)+1,arrCurveExtSub1(0)(2)))
arrPlaneExtSub1(1)=Rhino.PlaneFromPoints ((arrCurveExtSub1(1)),Array(arrCurveExtSub1(1)(0)+1,arrCurveExtSub1(1)(1),arrCurveExtSub1(1)(2)),Array(arrCurveExtSub1(1)(0),arrCurveExtSub1(1)(1)+1,arrCurveExtSub1(1)(2)))
arrPlaneExtSub1(2)=Rhino.PlaneFromPoints ((arrCurveExtSub1(2)),Array(arrCurveExtSub1(2)(0)+1,arrCurveExtSub1(2)(1),arrCurveExtSub1(2)(2)),Array(arrCurveExtSub1(2)(0),arrCurveExtSub1(2)(1)+1,arrCurveExtSub1(2)(2)))
ReDim Preserve arrPlaneExtSub2(2)
arrPlaneExtSub2(0)=Rhino.PlaneFromPoints ((arrCurveExtSub2(0)),Array(arrCurveExtSub2(0)(0)+1,arrCurveExtSub2(0)(1),arrCurveExtSub2(0)(2)),Array(arrCurveExtSub2(0)(0),arrCurveExtSub2(0)(1)+1,arrCurveExtSub2(0)(2)))
arrPlaneExtSub2(1)=Rhino.PlaneFromPoints ((arrCurveExtSub2(1)),Array(arrCurveExtSub2(1)(0)+1,arrCurveExtSub2(1)(1),arrCurveExtSub2(1)(2)),Array(arrCurveExtSub2(1)(0),arrCurveExtSub2(1)(1)+1,arrCurveExtSub2(1)(2)))
arrPlaneExtSub2(2)=Rhino.PlaneFromPoints ((arrCurveExtSub2(2)),Array(arrCurveExtSub2(2)(0)+1,arrCurveExtSub2(2)(1),arrCurveExtSub2(2)(2)),Array(arrCurveExtSub2(2)(0),arrCurveExtSub2(2)(1)+1,arrCurveExtSub2(2)(2)))
ReDim Preserve arrPlaneExtSub3(2)
arrPlaneExtSub3(0)=Rhino.PlaneFromPoints ((arrCurveExtSub3(0)),Array(arrCurveExtSub3(0)(0)+1,arrCurveExtSub3(0)(1),arrCurveExtSub3(0)(2)),Array(arrCurveExtSub3(0)(0),arrCurveExtSub3(0)(1)+1,arrCurveExtSub3(0)(2)))
arrPlaneExtSub3(1)=Rhino.PlaneFromPoints ((arrCurveExtSub3(1)),Array(arrCurveExtSub3(1)(0)+1,arrCurveExtSub3(1)(1),arrCurveExtSub3(1)(2)),Array(arrCurveExtSub3(1)(0),arrCurveExtSub3(1)(1)+1,arrCurveExtSub3(1)(2)))
arrPlaneExtSub3(2)=Rhino.PlaneFromPoints ((arrCurveExtSub3(2)),Array(arrCurveExtSub3(2)(0)+1,arrCurveExtSub3(2)(1),arrCurveExtSub3(2)(2)),Array(arrCurveExtSub3(2)(0),arrCurveExtSub3(2)(1)+1,arrCurveExtSub3(2)(2)))
ReDim Preserve arrPlaneExtSub4(2)
arrPlaneExtSub4(0)=Rhino.PlaneFromPoints ((arrCurveExtSub4(0)),Array(arrCurveExtSub4(0)(0)+1,arrCurveExtSub4(0)(1),arrCurveExtSub4(0)(2)),Array(arrCurveExtSub4(0)(0),arrCurveExtSub4(0)(1)+1,arrCurveExtSub4(0)(2)))
arrPlaneExtSub4(1)=Rhino.PlaneFromPoints ((arrCurveExtSub4(1)),Array(arrCurveExtSub4(1)(0)+1,arrCurveExtSub4(1)(1),arrCurveExtSub4(1)(2)),Array(arrCurveExtSub4(1)(0),arrCurveExtSub4(1)(1)+1,arrCurveExtSub4(1)(2)))
arrPlaneExtSub4(2)=Rhino.PlaneFromPoints ((arrCurveExtSub4(2)),Array(arrCurveExtSub4(2)(0)+1,arrCurveExtSub4(2)(1),arrCurveExtSub4(2)(2)),Array(arrCurveExtSub4(2)(0),arrCurveExtSub4(2)(1)+1,arrCurveExtSub4(2)(2)))
ReDim Preserve arrPlaneExtSub5(2)
arrPlaneExtSub5(0)=Rhino.PlaneFromPoints ((arrCurveExtSub5(0)),Array(arrCurveExtSub5(0)(0)+1,arrCurveExtSub5(0)(1),arrCurveExtSub5(0)(2)),Array(arrCurveExtSub5(0)(0),arrCurveExtSub5(0)(1)+1,arrCurveExtSub5(0)(2)))
arrPlaneExtSub5(1)=Rhino.PlaneFromPoints ((arrCurveExtSub5(1)),Array(arrCurveExtSub5(1)(0)+1,arrCurveExtSub5(1)(1),arrCurveExtSub5(1)(2)),Array(arrCurveExtSub5(1)(0),arrCurveExtSub5(1)(1)+1,arrCurveExtSub5(1)(2)))
arrPlaneExtSub5(2)=Rhino.PlaneFromPoints ((arrCurveExtSub5(2)),Array(arrCurveExtSub5(2)(0)+1,arrCurveExtSub5(2)(1),arrCurveExtSub5(2)(2)),Array(arrCurveExtSub5(2)(0),arrCurveExtSub5(2)(1)+1,arrCurveExtSub5(2)(2)))
ReDim Preserve arrPlaneExtSub6(2)
arrPlaneExtSub6(0)=Rhino.PlaneFromPoints ((arrCurveExtSub6(0)),Array(arrCurveExtSub6(0)(0)+1,arrCurveExtSub6(0)(1),arrCurveExtSub6(0)(2)),Array(arrCurveExtSub6(0)(0),arrCurveExtSub6(0)(1)+1,arrCurveExtSub6(0)(2)))
arrPlaneExtSub6(1)=Rhino.PlaneFromPoints ((arrCurveExtSub6(1)),Array(arrCurveExtSub6(1)(0)+1,arrCurveExtSub6(1)(1),arrCurveExtSub6(1)(2)),Array(arrCurveExtSub6(1)(0),arrCurveExtSub6(1)(1)+1,arrCurveExtSub6(1)(2)))
arrPlaneExtSub6(2)=Rhino.PlaneFromPoints ((arrCurveExtSub6(2)),Array(arrCurveExtSub6(2)(0)+1,arrCurveExtSub6(2)(1),arrCurveExtSub6(2)(2)),Array(arrCurveExtSub6(2)(0),arrCurveExtSub6(2)(1)+1,arrCurveExtSub6(2)(2)))
ReDim Preserve arrPlaneExtSub7(2)
arrPlaneExtSub7(0)=Rhino.PlaneFromPoints ((arrCurveExtSub7(0)),Array(arrCurveExtSub7(0)(0)+1,arrCurveExtSub7(0)(1),arrCurveExtSub7(0)(2)),Array(arrCurveExtSub7(0)(0),arrCurveExtSub7(0)(1)+1,arrCurveExtSub7(0)(2)))
arrPlaneExtSub7(1)=Rhino.PlaneFromPoints ((arrCurveExtSub7(1)),Array(arrCurveExtSub7(1)(0)+1,arrCurveExtSub7(1)(1),arrCurveExtSub7(1)(2)),Array(arrCurveExtSub7(1)(0),arrCurveExtSub7(1)(1)+1,arrCurveExtSub7(1)(2)))
arrPlaneExtSub7(2)=Rhino.PlaneFromPoints ((arrCurveExtSub7(2)),Array(arrCurveExtSub7(2)(0)+1,arrCurveExtSub7(2)(1),arrCurveExtSub7(2)(2)),Array(arrCurveExtSub7(2)(0),arrCurveExtSub7(2)(1)+1,arrCurveExtSub7(2)(2)))
ReDim Preserve arrPlaneExtSub8(2)
arrPlaneExtSub8(0)=Rhino.PlaneFromPoints ((arrCurveExtSub8(0)),Array(arrCurveExtSub8(0)(0)+1,arrCurveExtSub8(0)(1),arrCurveExtSub8(0)(2)),Array(arrCurveExtSub8(0)(0),arrCurveExtSub8(0)(1)+1,arrCurveExtSub8(0)(2)))
arrPlaneExtSub8(1)=Rhino.PlaneFromPoints ((arrCurveExtSub8(1)),Array(arrCurveExtSub8(1)(0)+1,arrCurveExtSub8(1)(1),arrCurveExtSub8(1)(2)),Array(arrCurveExtSub8(1)(0),arrCurveExtSub8(1)(1)+1,arrCurveExtSub8(1)(2)))
arrPlaneExtSub8(2)=Rhino.PlaneFromPoints ((arrCurveExtSub8(2)),Array(arrCurveExtSub8(2)(0)+1,arrCurveExtSub8(2)(1),arrCurveExtSub8(2)(2)),Array(arrCurveExtSub8(2)(0),arrCurveExtSub8(2)(1)+1,arrCurveExtSub8(2)(2)))
ReDim Preserve arrPlaneExtSub9(2)
arrPlaneExtSub9(0)=Rhino.PlaneFromPoints ((arrCurveExtSub9(0)),Array(arrCurveExtSub9(0)(0)+1,arrCurveExtSub9(0)(1),arrCurveExtSub9(0)(2)),Array(arrCurveExtSub9(0)(0),arrCurveExtSub9(0)(1)+1,arrCurveExtSub9(0)(2)))
arrPlaneExtSub9(1)=Rhino.PlaneFromPoints ((arrCurveExtSub9(1)),Array(arrCurveExtSub9(1)(0)+1,arrCurveExtSub9(1)(1),arrCurveExtSub9(1)(2)),Array(arrCurveExtSub9(1)(0),arrCurveExtSub9(1)(1)+1,arrCurveExtSub9(1)(2)))
arrPlaneExtSub9(2)=Rhino.PlaneFromPoints ((arrCurveExtSub9(2)),Array(arrCurveExtSub9(2)(0)+1,arrCurveExtSub9(2)(1),arrCurveExtSub9(2)(2)),Array(arrCurveExtSub9(2)(0),arrCurveExtSub9(2)(1)+1,arrCurveExtSub9(2)(2)))
ReDim Preserve arrPlaneExtSub10(2)
arrPlaneExtSub10(0)=Rhino.PlaneFromPoints ((arrCurveExtSub10(0)),Array(arrCurveExtSub10(0)(0)+1,arrCurveExtSub10(0)(1),arrCurveExtSub10(0)(2)),Array(arrCurveExtSub10(0)(0),arrCurveExtSub10(0)(1)+1,arrCurveExtSub10(0)(2)))
arrPlaneExtSub10(1)=Rhino.PlaneFromPoints ((arrCurveExtSub10(1)),Array(arrCurveExtSub10(1)(0)+1,arrCurveExtSub10(1)(1),arrCurveExtSub10(1)(2)),Array(arrCurveExtSub10(1)(0),arrCurveExtSub10(1)(1)+1,arrCurveExtSub10(1)(2)))
arrPlaneExtSub10(2)=Rhino.PlaneFromPoints ((arrCurveExtSub10(2)),Array(arrCurveExtSub10(2)(0)+1,arrCurveExtSub10(2)(1),arrCurveExtSub10(2)(2)),Array(arrCurveExtSub10(2)(0),arrCurveExtSub10(2)(1)+1,arrCurveExtSub10(2)(2)))
ReDim Preserve arrPlaneExtSub11(2)
arrPlaneExtSub11(0)=Rhino.PlaneFromPoints ((arrCurveExtSub11(0)),Array(arrCurveExtSub11(0)(0)+1,arrCurveExtSub11(0)(1),arrCurveExtSub11(0)(2)),Array(arrCurveExtSub11(0)(0),arrCurveExtSub11(0)(1)+1,arrCurveExtSub11(0)(2)))
arrPlaneExtSub11(1)=Rhino.PlaneFromPoints ((arrCurveExtSub11(1)),Array(arrCurveExtSub11(1)(0)+1,arrCurveExtSub11(1)(1),arrCurveExtSub11(1)(2)),Array(arrCurveExtSub11(1)(0),arrCurveExtSub11(1)(1)+1,arrCurveExtSub11(1)(2)))
arrPlaneExtSub11(2)=Rhino.PlaneFromPoints ((arrCurveExtSub11(2)),Array(arrCurveExtSub11(2)(0)+1,arrCurveExtSub11(2)(1),arrCurveExtSub11(2)(2)),Array(arrCurveExtSub11(2)(0),arrCurveExtSub11(2)(1)+1,arrCurveExtSub11(2)(2)))
ReDim Preserve arrPlaneExtSub12(2)
arrPlaneExtSub12(0)=Rhino.PlaneFromPoints ((arrCurveExtSub12(0)),Array(arrCurveExtSub12(0)(0)+1,arrCurveExtSub12(0)(1),arrCurveExtSub12(0)(2)),Array(arrCurveExtSub12(0)(0),arrCurveExtSub12(0)(1)+1,arrCurveExtSub12(0)(2)))
arrPlaneExtSub12(1)=Rhino.PlaneFromPoints ((arrCurveExtSub12(1)),Array(arrCurveExtSub12(1)(0)+1,arrCurveExtSub12(1)(1),arrCurveExtSub12(1)(2)),Array(arrCurveExtSub12(1)(0),arrCurveExtSub12(1)(1)+1,arrCurveExtSub12(1)(2)))
arrPlaneExtSub12(2)=Rhino.PlaneFromPoints ((arrCurveExtSub12(2)),Array(arrCurveExtSub12(2)(0)+1,arrCurveExtSub12(2)(1),arrCurveExtSub12(2)(2)),Array(arrCurveExtSub12(2)(0),arrCurveExtSub12(2)(1)+1,arrCurveExtSub12(2)(2)))
ReDim Preserve arrPlaneExtSub13(2)
arrPlaneExtSub13(0)=Rhino.PlaneFromPoints ((arrCurveExtSub13(0)),Array(arrCurveExtSub13(0)(0)+1,arrCurveExtSub13(0)(1),arrCurveExtSub13(0)(2)),Array(arrCurveExtSub13(0)(0),arrCurveExtSub13(0)(1)+1,arrCurveExtSub13(0)(2)))
arrPlaneExtSub13(1)=Rhino.PlaneFromPoints ((arrCurveExtSub13(1)),Array(arrCurveExtSub13(1)(0)+1,arrCurveExtSub13(1)(1),arrCurveExtSub13(1)(2)),Array(arrCurveExtSub13(1)(0),arrCurveExtSub13(1)(1)+1,arrCurveExtSub13(1)(2)))
arrPlaneExtSub13(2)=Rhino.PlaneFromPoints ((arrCurveExtSub13(2)),Array(arrCurveExtSub13(2)(0)+1,arrCurveExtSub13(2)(1),arrCurveExtSub13(2)(2)),Array(arrCurveExtSub13(2)(0),arrCurveExtSub13(2)(1)+1,arrCurveExtSub13(2)(2)))
ReDim Preserve arrPlaneExtSub14(2)
arrPlaneExtSub14(0)=Rhino.PlaneFromPoints ((arrCurveExtSub14(0)),Array(arrCurveExtSub14(0)(0)+1,arrCurveExtSub14(0)(1),arrCurveExtSub14(0)(2)),Array(arrCurveExtSub14(0)(0),arrCurveExtSub14(0)(1)+1,arrCurveExtSub14(0)(2)))
arrPlaneExtSub14(1)=Rhino.PlaneFromPoints ((arrCurveExtSub14(1)),Array(arrCurveExtSub14(1)(0)+1,arrCurveExtSub14(1)(1),arrCurveExtSub14(1)(2)),Array(arrCurveExtSub14(1)(0),arrCurveExtSub14(1)(1)+1,arrCurveExtSub14(1)(2)))
arrPlaneExtSub14(2)=Rhino.PlaneFromPoints ((arrCurveExtSub14(2)),Array(arrCurveExtSub14(2)(0)+1,arrCurveExtSub14(2)(1),arrCurveExtSub14(2)(2)),Array(arrCurveExtSub14(2)(0),arrCurveExtSub14(2)(1)+1,arrCurveExtSub14(2)(2)))
ReDim Preserve arrPlaneExtSub15(2)
arrPlaneExtSub15(0)=Rhino.PlaneFromPoints ((arrCurveExtSub15(0)),Array(arrCurveExtSub15(0)(0)+1,arrCurveExtSub15(0)(1),arrCurveExtSub15(0)(2)),Array(arrCurveExtSub15(0)(0),arrCurveExtSub15(0)(1)+1,arrCurveExtSub15(0)(2)))
arrPlaneExtSub15(1)=Rhino.PlaneFromPoints ((arrCurveExtSub15(1)),Array(arrCurveExtSub15(1)(0)+1,arrCurveExtSub15(1)(1),arrCurveExtSub15(1)(2)),Array(arrCurveExtSub15(1)(0),arrCurveExtSub15(1)(1)+1,arrCurveExtSub15(1)(2)))
arrPlaneExtSub15(2)=Rhino.PlaneFromPoints ((arrCurveExtSub15(2)),Array(arrCurveExtSub15(2)(0)+1,arrCurveExtSub15(2)(1),arrCurveExtSub15(2)(2)),Array(arrCurveExtSub15(2)(0),arrCurveExtSub15(2)(1)+1,arrCurveExtSub15(2)(2)))
ReDim Preserve arrPlaneExtSub16(2)
arrPlaneExtSub16(0)=Rhino.PlaneFromPoints ((arrCurveExtSub16(0)),Array(arrCurveExtSub16(0)(0)+1,arrCurveExtSub16(0)(1),arrCurveExtSub16(0)(2)),Array(arrCurveExtSub16(0)(0),arrCurveExtSub16(0)(1)+1,arrCurveExtSub16(0)(2)))
arrPlaneExtSub16(1)=Rhino.PlaneFromPoints ((arrCurveExtSub16(1)),Array(arrCurveExtSub16(1)(0)+1,arrCurveExtSub16(1)(1),arrCurveExtSub16(1)(2)),Array(arrCurveExtSub16(1)(0),arrCurveExtSub16(1)(1)+1,arrCurveExtSub16(1)(2)))
arrPlaneExtSub16(2)=Rhino.PlaneFromPoints ((arrCurveExtSub16(2)),Array(arrCurveExtSub16(2)(0)+1,arrCurveExtSub16(2)(1),arrCurveExtSub16(2)(2)),Array(arrCurveExtSub16(2)(0),arrCurveExtSub16(2)(1)+1,arrCurveExtSub16(2)(2)))
ReDim Preserve arrPlaneExtSub17(2)
arrPlaneExtSub17(0)=Rhino.PlaneFromPoints ((arrCurveExtSub17(0)),Array(arrCurveExtSub17(0)(0)+1,arrCurveExtSub17(0)(1),arrCurveExtSub17(0)(2)),Array(arrCurveExtSub17(0)(0),arrCurveExtSub17(0)(1)+1,arrCurveExtSub17(0)(2)))
arrPlaneExtSub17(1)=Rhino.PlaneFromPoints ((arrCurveExtSub17(1)),Array(arrCurveExtSub17(1)(0)+1,arrCurveExtSub17(1)(1),arrCurveExtSub17(1)(2)),Array(arrCurveExtSub17(1)(0),arrCurveExtSub17(1)(1)+1,arrCurveExtSub17(1)(2)))
arrPlaneExtSub17(2)=Rhino.PlaneFromPoints ((arrCurveExtSub17(2)),Array(arrCurveExtSub17(2)(0)+1,arrCurveExtSub17(2)(1),arrCurveExtSub17(2)(2)),Array(arrCurveExtSub17(2)(0),arrCurveExtSub17(2)(1)+1,arrCurveExtSub17(2)(2)))
ReDim Preserve arrPlaneExtSub18(2)
arrPlaneExtSub18(0)=Rhino.PlaneFromPoints ((arrCurveExtSub18(0)),Array(arrCurveExtSub18(0)(0)+1,arrCurveExtSub18(0)(1),arrCurveExtSub18(0)(2)),Array(arrCurveExtSub18(0)(0),arrCurveExtSub18(0)(1)+1,arrCurveExtSub18(0)(2)))
arrPlaneExtSub18(1)=Rhino.PlaneFromPoints ((arrCurveExtSub18(1)),Array(arrCurveExtSub18(1)(0)+1,arrCurveExtSub18(1)(1),arrCurveExtSub18(1)(2)),Array(arrCurveExtSub18(1)(0),arrCurveExtSub18(1)(1)+1,arrCurveExtSub18(1)(2)))
arrPlaneExtSub18(2)=Rhino.PlaneFromPoints ((arrCurveExtSub18(2)),Array(arrCurveExtSub18(2)(0)+1,arrCurveExtSub18(2)(1),arrCurveExtSub18(2)(2)),Array(arrCurveExtSub18(2)(0),arrCurveExtSub18(2)(1)+1,arrCurveExtSub18(2)(2)))
ReDim Preserve arrPlaneExtSub19(2)
arrPlaneExtSub19(0)=Rhino.PlaneFromPoints ((arrCurveExtSub19(0)),Array(arrCurveExtSub19(0)(0)+1,arrCurveExtSub19(0)(1),arrCurveExtSub19(0)(2)),Array(arrCurveExtSub19(0)(0),arrCurveExtSub19(0)(1)+1,arrCurveExtSub19(0)(2)))
arrPlaneExtSub19(1)=Rhino.PlaneFromPoints ((arrCurveExtSub19(1)),Array(arrCurveExtSub19(1)(0)+1,arrCurveExtSub19(1)(1),arrCurveExtSub19(1)(2)),Array(arrCurveExtSub19(1)(0),arrCurveExtSub19(1)(1)+1,arrCurveExtSub19(1)(2)))
arrPlaneExtSub19(2)=Rhino.PlaneFromPoints ((arrCurveExtSub19(2)),Array(arrCurveExtSub19(2)(0)+1,arrCurveExtSub19(2)(1),arrCurveExtSub19(2)(2)),Array(arrCurveExtSub19(2)(0),arrCurveExtSub19(2)(1)+1,arrCurveExtSub19(2)(2)))

ReDim Preserve arrPtExtSub1(2)
arrPtExtSub1(0) = Rhino.AddCircle (arrPlaneExtSub1(0), 1)
arrPtExtSub1(1) = Rhino.AddCircle (arrPlaneExtSub1(1), 0.5)
arrPtExtSub1(2) = Rhino.AddCircle (arrPlaneExtSub1(2), 0.2)
ReDim Preserve arrPtExtSub2(2)
arrPtExtSub2(0) = Rhino.AddCircle (arrPlaneExtSub2(0), 1)
arrPtExtSub2(1) = Rhino.AddCircle (arrPlaneExtSub2(1), 0.5)
arrPtExtSub2(2) = Rhino.AddCircle (arrPlaneExtSub2(2), 0.2)
ReDim Preserve arrPtExtSub3(2)
arrPtExtSub3(0) = Rhino.AddCircle (arrPlaneExtSub3(0), 1)
arrPtExtSub3(1) = Rhino.AddCircle (arrPlaneExtSub3(1), 0.5)
arrPtExtSub3(2) = Rhino.AddCircle (arrPlaneExtSub3(2), 0.2)
ReDim Preserve arrPtExtSub4(2)
arrPtExtSub4(0) = Rhino.AddCircle (arrPlaneExtSub4(0), 1)
arrPtExtSub4(1) = Rhino.AddCircle (arrPlaneExtSub4(1), 0.5)
arrPtExtSub4(2) = Rhino.AddCircle (arrPlaneExtSub4(2), 0.2)
ReDim Preserve arrPtExtSub5(2)
arrPtExtSub5(0) = Rhino.AddCircle (arrPlaneExtSub5(0), 1)
arrPtExtSub5(1) = Rhino.AddCircle (arrPlaneExtSub5(1), 0.5)
arrPtExtSub5(2) = Rhino.AddCircle (arrPlaneExtSub5(2), 0.2)
ReDim Preserve arrPtExtSub6(2)
arrPtExtSub6(0) = Rhino.AddCircle (arrPlaneExtSub6(0), 1)
arrPtExtSub6(1) = Rhino.AddCircle (arrPlaneExtSub6(1), 0.5)
arrPtExtSub6(2) = Rhino.AddCircle (arrPlaneExtSub6(2), 0.2)
ReDim Preserve arrPtExtSub7(2)
arrPtExtSub7(0) = Rhino.AddCircle (arrPlaneExtSub7(0), 1)
arrPtExtSub7(1) = Rhino.AddCircle (arrPlaneExtSub7(1), 0.5)
arrPtExtSub7(2) = Rhino.AddCircle (arrPlaneExtSub7(2), 0.2)
ReDim Preserve arrPtExtSub8(2)
arrPtExtSub8(0) = Rhino.AddCircle (arrPlaneExtSub8(0), 1)
arrPtExtSub8(1) = Rhino.AddCircle (arrPlaneExtSub8(1), 0.5)
arrPtExtSub8(2) = Rhino.AddCircle (arrPlaneExtSub8(2), 0.2)
ReDim Preserve arrPtExtSub9(2)
arrPtExtSub9(0) = Rhino.AddCircle (arrPlaneExtSub9(0), 1)
arrPtExtSub9(1) = Rhino.AddCircle (arrPlaneExtSub9(1), 0.5)
arrPtExtSub9(2) = Rhino.AddCircle (arrPlaneExtSub9(2), 0.2)
ReDim Preserve arrPtExtSub10(2)
arrPtExtSub10(0) = Rhino.AddCircle (arrPlaneExtSub10(0), 1)
arrPtExtSub10(1) = Rhino.AddCircle (arrPlaneExtSub10(1), 0.5)
arrPtExtSub10(2) = Rhino.AddCircle (arrPlaneExtSub10(2), 0.2)
ReDim Preserve arrPtExtSub11(2)
arrPtExtSub11(0) = Rhino.AddCircle (arrPlaneExtSub11(0), 1)
arrPtExtSub11(1) = Rhino.AddCircle (arrPlaneExtSub11(1), 0.5)
arrPtExtSub11(2) = Rhino.AddCircle (arrPlaneExtSub11(2), 0.2)
ReDim Preserve arrPtExtSub12(2)
arrPtExtSub12(0) = Rhino.AddCircle (arrPlaneExtSub12(0), 1)
arrPtExtSub12(1) = Rhino.AddCircle (arrPlaneExtSub12(1), 0.5)
arrPtExtSub12(2) = Rhino.AddCircle (arrPlaneExtSub12(2), 0.2)
ReDim Preserve arrPtExtSub13(2)
arrPtExtSub13(0) = Rhino.AddCircle (arrPlaneExtSub13(0), 1)
arrPtExtSub13(1) = Rhino.AddCircle (arrPlaneExtSub13(1), 0.5)
arrPtExtSub13(2) = Rhino.AddCircle (arrPlaneExtSub13(2), 0.2)
ReDim Preserve arrPtExtSub14(2)
arrPtExtSub14(0) = Rhino.AddCircle (arrPlaneExtSub14(0), 1)
arrPtExtSub14(1) = Rhino.AddCircle (arrPlaneExtSub14(1), 0.5)
arrPtExtSub14(2) = Rhino.AddCircle (arrPlaneExtSub14(2), 0.2)
ReDim Preserve arrPtExtSub15(2)
arrPtExtSub15(0) = Rhino.AddCircle (arrPlaneExtSub15(0), 1)
arrPtExtSub15(1) = Rhino.AddCircle (arrPlaneExtSub15(1), 0.5)
arrPtExtSub15(2) = Rhino.AddCircle (arrPlaneExtSub15(2), 0.2)
ReDim Preserve arrPtExtSub16(2)
arrPtExtSub16(0) = Rhino.AddCircle (arrPlaneExtSub16(0), 1)
arrPtExtSub16(1) = Rhino.AddCircle (arrPlaneExtSub16(1), 0.5)
arrPtExtSub16(2) = Rhino.AddCircle (arrPlaneExtSub16(2), 0.2)
ReDim Preserve arrPtExtSub17(2)
arrPtExtSub17(0) = Rhino.AddCircle (arrPlaneExtSub17(0), 1)
arrPtExtSub17(1) = Rhino.AddCircle (arrPlaneExtSub17(1), 0.5)
arrPtExtSub17(2) = Rhino.AddCircle (arrPlaneExtSub17(2), 0.2)
ReDim Preserve arrPtExtSub18(2)
arrPtExtSub18(0) = Rhino.AddCircle (arrPlaneExtSub18(0), 1)
arrPtExtSub18(1) = Rhino.AddCircle (arrPlaneExtSub18(1), 0.5)
arrPtExtSub18(2) = Rhino.AddCircle (arrPlaneExtSub18(2), 0.2)
ReDim Preserve arrPtExtSub19(2)
arrPtExtSub19(0) = Rhino.AddCircle (arrPlaneExtSub19(0), 1)
arrPtExtSub19(1) = Rhino.AddCircle (arrPlaneExtSub19(1), 0.5)
arrPtExtSub19(2) = Rhino.AddCircle (arrPlaneExtSub19(2), 0.2)
Rhino.AddLoftSrf (arrPtExtSub1),,,1
Rhino.AddLoftSrf (arrPtExtSub2),,,1
Rhino.AddLoftSrf (arrPtExtSub3),,,1
Rhino.AddLoftSrf (arrPtExtSub4),,,1
Rhino.AddLoftSrf (arrPtExtSub5),,,1
Rhino.AddLoftSrf (arrPtExtSub6),,,1
Rhino.AddLoftSrf (arrPtExtSub7),,,1
Rhino.AddLoftSrf (arrPtExtSub8),,,1
Rhino.AddLoftSrf (arrPtExtSub9),,,1
Rhino.AddLoftSrf (arrPtExtSub10),,,1
Rhino.AddLoftSrf (arrPtExtSub11),,,1
Rhino.AddLoftSrf (arrPtExtSub12),,,1
Rhino.AddLoftSrf (arrPtExtSub13),,,1
Rhino.AddLoftSrf (arrPtExtSub14),,,1
Rhino.AddLoftSrf (arrPtExtSub15),,,1
Rhino.AddLoftSrf (arrPtExtSub16),,,1
Rhino.AddLoftSrf (arrPtExtSub17),,,1
Rhino.AddLoftSrf (arrPtExtSub18),,,1
Rhino.AddLoftSrf (arrPtExtSub19),,,1

Rhino.AddPlanarSrf Array(arrPtExtSub1(0))
Rhino.AddPlanarSrf Array(arrPtExtSub1(2))
Rhino.AddPlanarSrf Array(arrPtExtSub2(0))
Rhino.AddPlanarSrf Array(arrPtExtSub2(2))
Rhino.AddPlanarSrf Array(arrPtExtSub3(0))
Rhino.AddPlanarSrf Array(arrPtExtSub3(2))
Rhino.AddPlanarSrf Array(arrPtExtSub4(0))
Rhino.AddPlanarSrf Array(arrPtExtSub4(2))
Rhino.AddPlanarSrf Array(arrPtExtSub5(0))
Rhino.AddPlanarSrf Array(arrPtExtSub5(2))
Rhino.AddPlanarSrf Array(arrPtExtSub6(0))
Rhino.AddPlanarSrf Array(arrPtExtSub6(2))
Rhino.AddPlanarSrf Array(arrPtExtSub7(0))
Rhino.AddPlanarSrf Array(arrPtExtSub7(2))
Rhino.AddPlanarSrf Array(arrPtExtSub8(0))
Rhino.AddPlanarSrf Array(arrPtExtSub8(2))
Rhino.AddPlanarSrf Array(arrPtExtSub9(0))
Rhino.AddPlanarSrf Array(arrPtExtSub9(2))
Rhino.AddPlanarSrf Array(arrPtExtSub10(0))
Rhino.AddPlanarSrf Array(arrPtExtSub10(2))
Rhino.AddPlanarSrf Array(arrPtExtSub11(0))
Rhino.AddPlanarSrf Array(arrPtExtSub11(2))
Rhino.AddPlanarSrf Array(arrPtExtSub12(0))
Rhino.AddPlanarSrf Array(arrPtExtSub12(2))
Rhino.AddPlanarSrf Array(arrPtExtSub13(0))
Rhino.AddPlanarSrf Array(arrPtExtSub13(2))
Rhino.AddPlanarSrf Array(arrPtExtSub14(0))
Rhino.AddPlanarSrf Array(arrPtExtSub14(2))
Rhino.AddPlanarSrf Array(arrPtExtSub15(0))
Rhino.AddPlanarSrf Array(arrPtExtSub15(2))
Rhino.AddPlanarSrf Array(arrPtExtSub16(0))
Rhino.AddPlanarSrf Array(arrPtExtSub16(2))
Rhino.AddPlanarSrf Array(arrPtExtSub17(0))
Rhino.AddPlanarSrf Array(arrPtExtSub17(2))
Rhino.AddPlanarSrf Array(arrPtExtSub18(0))
Rhino.AddPlanarSrf Array(arrPtExtSub18(2))
Rhino.AddPlanarSrf Array(arrPtExtSub19(0))
Rhino.AddPlanarSrf Array(arrPtExtSub19(2))

Rhino.DeleteObjects (arrPtExtSub1)
Rhino.DeleteObjects (arrPtExtSub2)
Rhino.DeleteObjects (arrPtExtSub3)
Rhino.DeleteObjects (arrPtExtSub4)
Rhino.DeleteObjects (arrPtExtSub5)
Rhino.DeleteObjects (arrPtExtSub6)
Rhino.DeleteObjects (arrPtExtSub7)
Rhino.DeleteObjects (arrPtExtSub8)
Rhino.DeleteObjects (arrPtExtSub9)
Rhino.DeleteObjects (arrPtExtSub10)
Rhino.DeleteObjects (arrPtExtSub11)
Rhino.DeleteObjects (arrPtExtSub12)
Rhino.DeleteObjects (arrPtExtSub13)
Rhino.DeleteObjects (arrPtExtSub14)
Rhino.DeleteObjects (arrPtExtSub15)
Rhino.DeleteObjects (arrPtExtSub16)
Rhino.DeleteObjects (arrPtExtSub17)
Rhino.DeleteObjects (arrPtExtSub18)
Rhino.DeleteObjects (arrPtExtSub19)

Next
End If
End If

End Sub

 

 

 

 

 

Array_Material

skin

Option Explicit

Call loftCurve
Sub loftCurve()
   
 Dim crvObjects : crvObjects = Rhino.GetObjects(“Pick curve(s)”, 4)
 If IsNull(crvObjects) Then Exit Sub
 
 Dim minR : minR = 3
 Dim maxR : maxR = 3
 
 Dim crvCurvature, crvTangent, crv,pt, ptparam,Wigglez
 Dim crvDomain
 Dim crvLength
 Dim intSamples, dist, mid
 Dim t, Radius, i, r
 Dim WinD,j,n,d,closestpt, winpt, Endpt, k, stp,plane
 Dim sphere,WorldXY,wigglex,wiggley
 Dim Elip,divs,newdivs(),NewLine,p,vect
 Dim toppt,botpt,matsVector,NegmatsVector,Meat,negcrvTangent,dough,Newpt
 ’Call rhino.enableRedraw(False)

 

 For i = 0 To Ubound(crvObjects)
  Rhino.EnableRedraw(False)

  crvDomain = Rhino.CurveDomain(crvObjects(i)) 
  crvLength = Rhino.CurveLength(crvObjects(i))
  dist= Rhino.CurveLength (crvObjects(i))
  Endpt = Rhino.CurveEndPoint (crvObjects(i))
  ’Rhino.AddPoint Endpt
 
  crv = crvObjects(i)
  pt= Rhino.CurveStartPoint (crv)
  
  ’Endpt = Rhino.CurveEndPoint (crv)
  
  stp = 0
  If dist < 1 Then
   pt = Rhino.CurveMidPoint (crvObjects(i))
   For j=0 To Ubound (crvObjects)
    If j<>i Then
     closestpt= Rhino.CurveClosestPoint (crvObjects(j),pt)
     closestpt = Rhino.EvaluateCurve (crvObjects(j),closestpt)
     d=Rhino.Distance (pt, closestpt)
     If n=0 Then
      winD= d
      winpt = closestpt
      n=n+1
     Else
      If d<winD Then
       winD= d 
       winpt = closestpt
      End If
     End If
    End If
   Next
   r=winD
   Rhino.Addsphere pt, r
  Else
   Do
    n=0
    ptparam = Rhino.CurveClosestPoint (crv,pt)
    pt = Rhino.EvaluateCurve (crv,ptparam)
   
    If abs (ptparam – crvDomain(1)) < .01 Then
     stp = 1
    End If
    crvTangent = Rhino.CurveTangent (crv,ptparam)
    plane = Rhino.PlaneFromNormal (pt,crvTangent)
    For j=0 To Ubound (crvObjects)
     If j<>i Then
      closestpt= Rhino.CurveClosestPoint (crvObjects(j),pt)
      closestpt = Rhino.EvaluateCurve (crvObjects(j),closestpt)
      d=Rhino.Distance (pt, closestpt)
      If n=0 Then
       winD= d
       winpt = closestpt
       n=n+1
      Else
       If d<winD Then
        winD= d 
        winpt = closestpt
       End If
      End If
     End If
    Next
    r=winD*0.7
    
    If r > 2 Then
     
     r = 2
    End If
    If r < .4 Then
     r = .4
     
    End If

    
    Wigglez = plane(3)
    Wigglez = Rhino.VectorUnitize (Wigglez)
    Wigglez = Rhino.VectorScale (Wigglez, random(-.3*r,.3*r))
    
    wigglex = plane(1)
    wigglex = Rhino.VectorUnitize (wigglex)
    wigglex = Rhino.VectorScale (wigglex,random(-.8*r,0.8*r))
    
    wiggley = plane(2)
    wiggley = Rhino.VectorUnitize (wiggley)
    wiggley = Rhino.VectorScale (wiggley,random(-.8*r,0.8*r))
    
    Newpt = Rhino.PointAdd(pt,Wigglez)
    Newpt = Rhino.PointAdd(pt,wigglex)
    Newpt = Rhino.PointAdd(pt,wiggley)
    plane = Rhino.MovePlane (plane,Newpt)
    Elip = Rhino.AddEllipse (plane, random(r,1.5*r),random(r,1.5*r))
    divs = Rhino.DivideCurve (Elip, 6)
    For p=0 To Ubound (divs)
     
     ReDim Preserve newDivs (p)
     vect= Rhino.VectorCreate(Newpt,divs(p))
     vect=Rhino.VectorScale (vect,random(-.6,.6))
     
     newdivs(p) = Rhino.PointAdd (divs(p),vect)
     newdivs(p) = Rhino.PointAdd (newdivs(p),Wigglez)
    Next
    ReDim Preserve newDivs(p)
    newDivs(p) = newDivs(0)
    NewLine = Rhino.AddInterpCurve (newDivs)
    Rhino.RebuildCurve NewLine
    crvTangent = Rhino.VectorUnitize (crvTangent)
    crvTangent = Rhino.VectorScale (crvTangent,random(.7*r,r))
    toppt = Rhino.PointAdd (Newpt,crvTangent)
    negcrvTangent = Rhino.VectorReverse (crvTangent)
    ’negcrvTangent = Rhino.VectorScale (crvTangent,.5)
    botpt = Rhino.PointAdd (Newpt,negcrvTangent)
    matsVector = Rhino.VectorCreate (Newpt,newdivs(0))
    NegmatsVector = Rhino.VectorReverse (matsVector)
    NegmatsVector = Rhino.VectorScale (NegmatsVector, 0.8)
    Meat = Rhino.AddInterpCurveEx (array(toppt,newdivs(0),botpt),,,,NegmatsVector,matsVector)
    dough = Rhino.AddRailRevSrf (Meat,NewLine,array(toppt,botpt))
    Rhino.DeleteObjects array(NewLine,Meat,Elip)
    
    
    
    
    
    
    
    Rhino.RotateObject dough ,pt,random(-20,20),wigglex
    Rhino.RotateObject dough ,pt,random(-20,20),wiggley
    If stp =1 Then
     Exit Do
    End If
    crvTangent = Rhino.VectorUnitize (crvTangent)
    crvTangent = Rhino.VectorScale (crvTangent, r*0.4)
    pt= Rhino.PointAdd (pt, crvTangent)
   
  
   Loop
  End If
  Rhino.EnableRedraw(True)
 Next
  
  
 ’================================================================================================
 ’Call rhino.enableRedraw(True)
 ’================================================================================================
 

End Sub

Function random(min,max)
 Randomize
 random = (max-min) * Rnd + min
End Function

Function random(min,max)
 Randomize
 random = (max-min) * Rnd + min
End Function

 

--------------------------------------

Pages of code RVB-Processing / Back