
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>cwwang.com &#187; Parametric Modeling</title>
	<atom:link href="http://cwwang.com/category/parametric-modeling/feed/" rel="self" type="application/rss+xml" />
	<link>http://cwwang.com</link>
	<description>Che-Wei Wang</description>
	<lastBuildDate>Thu, 08 Jul 2010 15:02:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Align to Point Rhinoscript</title>
		<link>http://cwwang.com/2008/03/15/align-to-point-rhinoscript/</link>
		<comments>http://cwwang.com/2008/03/15/align-to-point-rhinoscript/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 19:54:46 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Comp Form]]></category>
		<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Rhinoscript]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/03/15/align-to-point-rhinoscript/</guid>
		<description><![CDATA[A basic Rhinoscript to rotate surfaces to align their normal to a point. Option Explicit 'Script written by Che-Wei Wang 'Script version Friday, March 07, 2008 10:55:15 AM Call Main() Sub Main() 'select srfs to rotate Dim arrSurfaces:arrSurfaces=Rhino.GetObjects("select surfaces to rotate") 'select point Dim point:point=Rhino.GetPoint("select light source point") 'calcuate vector from point to each srf [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/rotatesurfacescript.jpg" title="rotatesurfacescript.jpg" rel="lightbox[677]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/rotatesurfacescript.thumbnail.jpg" width="128" height="60" alt="rotatesurfacescript.jpg" class="imageframe" /></a></p>
<p>A basic Rhinoscript to rotate surfaces to align their normal to a point.<br />
<span id="more-677"></span></p>
<pre><code>Option Explicit
'Script written by Che-Wei Wang
'Script version Friday, March 07, 2008 10:55:15 AM

Call Main()
Sub Main()
	'select srfs to rotate
	Dim arrSurfaces:arrSurfaces=Rhino.GetObjects("select surfaces to rotate")

	'select point
	Dim point:point=Rhino.GetPoint("select light source point")

	'calcuate vector from point to each srf
	Dim srf
	For Each srf In arrSurfaces
		'find center of each srf
		Dim arrCentroid:arrCentroid=Rhino.SurfaceAreaCentroid(srf)
		'arrCentroid(0) is the center point
		Dim lightVector:lightVector=Rhino.VectorCreate( point,arrCentroid(0) )		

		'calculate normal to srf
		Dim srfNormal:srfNormal=Rhino.SurfaceNormal( srf, Array(0,0) )
		'normalize vectors
		lightVector=Rhino.VectorUnitize(lightVector)
		srfNormal=Rhino.VectorUnitize(srfNormal)

		'calcuate dot product and convert to radians
		Dim Angle:Angle=acos(Rhino.VectorDotProduct( lightVector,srfNormal)) 

		'calculate rotation axis
		Dim rotAxis:rotAxis=Rhino.VectorCrossProduct(lightVector, srfNormal )

		'rotate srf by that angle
		Call Rhino.RotateObject(srf,arrCentroid(0),360-Rhino.toDegrees(angle),rotAxis)

	Next	

End Sub</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/03/15/align-to-point-rhinoscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Branching RhinoScript</title>
		<link>http://cwwang.com/2008/03/15/basic-branching-rhinoscript/</link>
		<comments>http://cwwang.com/2008/03/15/basic-branching-rhinoscript/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 19:41:58 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Comp Form]]></category>
		<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Rhinoscript]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[Work in Progress]]></category>

		<guid isPermaLink="false">http://cwwang.com/2008/03/15/basic-branching-rhinoscript/</guid>
		<description><![CDATA[Option Explicit 'Script written by Che-Wei Wang 'Script version Friday, March 14, 2008 11:38:10 AM Call Main() Sub Main() ReDim arrStart(0) 'set startpoint arrStart(0)= array(0,0,0) 'call drawBraches Function with initial settings(arrStart startPostition, L initialLength, number of branches, number of generations) Call drawBranches(arrStart, 2, 2, 6) End Sub Function drawBranches( arrStart(), L, nBranches, generations) ReDim arrEndPoints(nBranches) [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/branching.jpg" title="branching.jpg" rel="lightbox[674]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/branching.thumbnail.jpg" width="128" height="103" alt="branching.jpg" class="imageframe" /></a><br />
<span id="more-674"></span></p>
<pre><code>Option Explicit
'Script written by Che-Wei Wang
'Script version Friday, March 14, 2008 11:38:10 AM

Call Main()
Sub Main()

	ReDim arrStart(0)
	'set startpoint
	arrStart(0)= array(0,0,0)
	'call drawBraches Function with initial settings(arrStart startPostition, L initialLength, number of branches, number of generations)
	Call drawBranches(arrStart, 2, 2, 6)

End Sub

Function drawBranches( arrStart(), L, nBranches, generations)
	ReDim arrEndPoints(nBranches)
	Dim k,j
	Dim arrEnd, strobject, branchCount
	'reset branch count
	branchCount=0
	'for each start point
	For k = 0 To uBound(arrStart)
		'draw branches
		For j=0 To nBranches-1
			'endpoint based on startpoint
			arrEnd=array(arrStart(k)(0),arrStart(k)(1)+L,arrStart(k)(2)+rnd*L)
			'add line
			strObject=rhino.addline(arrStart(k), arrEnd)
			'rotate line randomly between -30 and 30
			Call rhino.RotateObject(strObject, arrStart(k), rnd*60-30)	 		

			'save each branches endpoint in an array
			ReDim Preserve arrEndPoints(branchCount)
			arrEndPoints(branchCount)=	Rhino.CurveEndPoint(strObject)
			'keep a count of the number of branches drawn
			branchCount=branchCount+1								     		

		Next
	Next

	'exit loop if generations=0
	If generations&gt;0 Then
		'recursive call with endpoints as startpoints, modified length, number of branches, and generation count-1
		Call drawBranches(arrEndPoints, l*.85, nBranches , generations-1)
	End If				

End Function</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2008/03/15/basic-branching-rhinoscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grass Type</title>
		<link>http://cwwang.com/2007/10/28/grass/</link>
		<comments>http://cwwang.com/2007/10/28/grass/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 19:32:02 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Comp Form]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/10/28/grass/</guid>
		<description><![CDATA[Grass Type is a virtual grass mat. Mouse movements send waves of wind across the grass, erasing the imprinted text which then slowly reappears over time as the wind dies down. (developed with Tim Stutts) Download grasstextapp.zip GrassTypeAdobe.app.zip (for Macs written in C and openGL). Installation]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-2.png" title="grasspicture-2.png" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-2.thumbnail.png" alt="grasspicture-2.png" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-5.png" title="grasspicture-5.png" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-5.thumbnail.png" alt="grasspicture-5.png" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-6.png" title="grasspicture-6.png" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-6.thumbnail.png" alt="grasspicture-6.png" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-4.png" title="grasspicture-4.png" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/grasspicture-4.thumbnail.png" alt="grasspicture-4.png" class="imageframe" height="96" width="128" /></a></p>
<p>Grass Type is a virtual grass mat. Mouse movements send waves of wind across the grass, erasing the imprinted text which then slowly reappears over time as the wind dies down. (developed with <a href="http://timstutts.com">Tim Stutts</a>)</p>
<p>Download <strike>grasstextapp.zip</strike> <a href="http://cwwang.com/wordpress/wp-content/uploads/GrassTypeAdobe.app.zip" title="GrassTypeAdobe.app.zip">GrassTypeAdobe.app.zip</a> (for Macs written in C and openGL).</p>
<p><span id="more-371"></span><strong>Installation</strong><br />
<a href="http://cwwang.com/wordpress/wp-content/uploads/dsc00056.jpg" title="dsc00056.jpg" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/dsc00056.thumbnail.jpg" alt="dsc00056.jpg" class="imageframe" height="85" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/dsc00057.jpg" title="dsc00057.jpg" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/dsc00057.thumbnail.jpg" alt="dsc00057.jpg" class="imageframe" height="85" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/img_0563.jpg" title="img_0563.jpg" rel="lightbox[371]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/img_0563.thumbnail.jpg" alt="img_0563.jpg" class="imageframe" height="96" width="128" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/10/28/grass/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Phylo Pattern Generator</title>
		<link>http://cwwang.com/2007/10/13/phylo-pattern-generator/</link>
		<comments>http://cwwang.com/2007/10/13/phylo-pattern-generator/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 05:59:22 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/10/13/phylo-pattern-generator/</guid>
		<description><![CDATA[phylotaxis applet]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/phylo3screenshot_1.png" title="phylo3screenshot_1.png" rel="lightbox[341]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/phylo3screenshot_1.thumbnail.png" alt="phylo3screenshot_1.png" class="imageframe" height="133" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/Phyllotaxis3/applet/index.html">phylotaxis applet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/10/13/phylo-pattern-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attractor Topography</title>
		<link>http://cwwang.com/2007/10/13/attractor-topography/</link>
		<comments>http://cwwang.com/2007/10/13/attractor-topography/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 05:48:56 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[2D Graphics]]></category>
		<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/10/13/attractor-topography/</guid>
		<description><![CDATA[attractor topography applet]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/1072.jpeg" title="1072.jpeg" rel="lightbox[340]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/1072.thumbnail.jpeg" alt="1072.jpeg" class="imageframe" height="128" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/1784.jpeg" title="1784.jpeg" rel="lightbox[340]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/1784.thumbnail.jpeg" alt="1784.jpeg" class="imageframe" height="128" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/3253.jpeg" title="3253.jpeg" rel="lightbox[340]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/3253.thumbnail.jpeg" alt="3253.jpeg" class="imageframe" height="128" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/Attractor_topography02/applet/index.html">attractor topography applet </a></p>
]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/10/13/attractor-topography/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seroussi Pavillion</title>
		<link>http://cwwang.com/2007/04/19/seroussi-pavillion/</link>
		<comments>http://cwwang.com/2007/04/19/seroussi-pavillion/#comments</comments>
		<pubDate>Thu, 19 Apr 2007 16:38:53 +0000</pubDate>
		<dc:creator>che-wei wang</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Parametric Modeling]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://cwwang.com/wordpress/2007/04/19/seroussi-pavillion/</guid>
		<description><![CDATA[Here are some images from a collaboration with biothing. My focus was on developing the outer tiling module. The facted skylight is modulated with intersecting sin wave functions in relation to nodes of interest distributed across the site. Rhinoscript 'component surface array 'cw wang'modified from 'skin panel prototype 'joshua vermillion Dim sourceSurface, uDiv, vDiv, height, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_001.jpg" title="biothing_roof_001.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_001.thumbnail.jpg" alt="biothing_roof_001.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_0021.jpg" title="biothing_roof_0021.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_0021.thumbnail.jpg" alt="biothing_roof_0021.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_003.jpg" title="biothing_roof_003.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_003.thumbnail.jpg" alt="biothing_roof_003.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_004.jpg" title="biothing_roof_004.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_004.thumbnail.jpg" alt="biothing_roof_004.jpg" class="imageframe" height="96" width="128" /></a></p>
<p>Here are some images from a collaboration with <a href="http://biothing.org/wiki/doku.php?id=seroussi">biothing</a>.  My focus was on developing the outer tiling module.  The facted skylight is modulated with intersecting sin wave functions in relation to nodes of interest distributed across the site.</p>
<p><span id="more-404"></span></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_005.jpg" title="biothing_roof_005.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/biothing_roof_005.thumbnail.jpg" alt="biothing_roof_005.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/electric-line-charge-with-components-03-v3maxwell-r01.jpg" title="electric-line-charge-with-components-03-v3maxwell-r01.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/electric-line-charge-with-components-03-v3maxwell-r01.thumbnail.jpg" alt="electric-line-charge-with-components-03-v3maxwell-r01.jpg" class="imageframe" height="96" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/img_0211.jpg" title="img_0211.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/img_0211.thumbnail.jpg" alt="img_0211.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/img_0212.jpg" title="img_0212.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/img_0212.thumbnail.jpg" alt="img_0212.jpg" class="imageframe" height="96" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r07-gf-pink.jpg" title="seroussi-house-r07-gf-pink.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r07-gf-pink.thumbnail.jpg" alt="seroussi-house-r07-gf-pink.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r08-gf-pink.jpg" title="seroussi-house-r08-gf-pink.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r08-gf-pink.thumbnail.jpg" alt="seroussi-house-r08-gf-pink.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r09-gf-pink.jpg" title="seroussi-house-r09-gf-pink.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r09-gf-pink.thumbnail.jpg" alt="seroussi-house-r09-gf-pink.jpg" class="imageframe" height="96" width="128" /></a><a href="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r10-gf-pink.jpg" title="seroussi-house-r10-gf-pink.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/seroussi-house-r10-gf-pink.thumbnail.jpg" alt="seroussi-house-r10-gf-pink.jpg" class="imageframe" height="96" width="128" /></a></p>
<p><a href="http://cwwang.com/wordpress/wp-content/uploads/roofplan.jpg" aiotarget="false" aiotitle="roofplan.jpg" rel="lightbox[404]" rel="lightbox"><img src="http://cwwang.com/wordpress/wp-content/uploads/roofplan.thumbnail.jpg" alt="roofplan.jpg" class="imageframe" height="190" width="128" /></a></p>
<p>Rhinoscript</p>
<pre><code>
'component surface array

'cw wang</code>'modified from

'skin panel prototype

'joshua vermillion

Dim sourceSurface, uDiv, vDiv, height, grid

Dim uStep, vStep

Dim uVal, vVal

Dim width

Dim depth

Dim  ap1,ap2,ap3,ap4,ap5

Dim  ap1n,ap2n,ap3n,ap4n,ap5n

Dim yTilt

Dim xTilt

Dim xTmin

Dim xTmax

Dim yTmin

Dim yTmax

Dim yStep

Dim offset

Dim splitWidth

Dim parentLayer

Dim midCurve

Dim midSurface

Dim componentColor : componentColor = RGB(125,125,125)

Dim underCocoon

Dim overCocoon

Dim court

Dim sinMult

Dim locator

Dim locatorMidDist

Sub panel

Dim i, j ,k

Dim sourceCurves

 'Prompt user for input data

 'sourceSurface = Rhino.GetObject("Select a surface to populate", 8,, True)

 parentLayer = Rhino.GetString("Enter layer number",1)

 sourceCurves = Rhino.GetObjects("Select curves", 4,, True)

Dim componentType : componentType =  Rhino.ListBox(Array("Exterior","Mesh"),"Select Component Type")

Dim vertBool	: vertBool = Rhino.GetBoolean("Build vertical?", Array("Build", "horizontal", "vertical"),Array(False))

 Dim louvres : louvres = Rhino.GetBoolean("Build courtyard louvres?", Array("Build", "no", "yes"),Array(False))

 locator= Rhino.GetPoint("select locator point")

'uDiv = Rhino.GetInteger("Enter the number of divisions in the U direction", 1, 1)

 uDiv = 1

 If componentType = "Mesh"  Then

 	vDiv = Rhino.GetInteger("Enter the number of divisions in the V direction", 5, 1)

 	'	height = Rhino.GetReal("Enter a height multiplier ", 2)

 	height=2

 	'		xTmin =  Rhino.GetReal("Enter x tilt minimum(0-1)", .7)

 	'		xTmax =  Rhino.GetReal("Enter x tilt maximum(0-1)", .8)

 	'

 	'		yTmin =  Rhino.GetReal("Enter Y tilt minimum(0-1)", .4)

 	'		yTmax =  Rhino.GetReal("Enter Y tilt maximum(0-1)", .45)

 	'

 	xTmin = .7

 	xTmax =   .8

yTmin = .4

 	yTmax =.45

End If

If componentType = "Exterior"  Then

 	vDiv = Rhino.GetInteger("Enter the number of divisions in the V direction", 60, 1)

 	'vDiv=60

 	'height = Rhino.GetReal("Enter a height multiplier ", .2)

 	'sinMult = Rhino.GetReal("Enter a Sin multiplier ", 3)

 	sinMult =3

'splitWidth = Rhino.GetReal("Enter split width", 15)

 	splitWidth =15

 	'xTmin =  Rhino.GetReal("Enter x tilt minimum(0-1)", .1)

 	'xTmax =  Rhino.GetReal("Enter x tilt maximum(0-1)", .9)

 	xTmin=.1

 	xTmax=.9

 	'yTmin =  Rhino.GetReal("Enter Y tilt minimum(0-1)", .3)

 	'yTmax =  Rhino.GetReal("Enter Y tilt maximum(0-1)", .9)

 	yTmin=.2

 	yTmax=.9

 	'offset =  Rhino.GetReal("Enter component offset (0-1)", .05)

 	offset=.02

 	height =.1

End If

If componentType = "Transition"  Then

 	vDiv = Rhino.GetInteger("Enter the number of divisions in the V direction", 80, 1)

 	height = Rhino.GetReal("Enter a height multiplier ", .02)

splitWidth = Rhino.GetReal("Enter split width", 30)

 	'xTmin =  Rhino.GetReal("Enter x tilt minimum(0-1)", .1)

 	'xTmax =  Rhino.GetReal("Enter x tilt maximum(0-1)", .9)

 	xTmin=.2

 	xTmax=.5

 	'yTmin =  Rhino.GetReal("Enter Y tilt minimum(0-1)", .3)

 	'yTmax =  Rhino.GetReal("Enter Y tilt maximum(0-1)", .9)

 	yTmin=.9

 	yTmax=.9

 	'offset =  Rhino.GetReal("Enter component offset (0-1)", .05)

 	offset=.1

 End If

 If componentType = "Wall"  Then

 	vDiv = Rhino.GetInteger("Enter the number of divisions in the V direction", 60, 1)

 	height = Rhino.GetReal("Enter a height multiplier ", .4)

xTmin =  Rhino.GetReal("Enter x tilt minimum(0-1)", .1)

 	xTmax =  Rhino.GetReal("Enter x tilt maximum(0-1)", .8)

yTmin =  Rhino.GetReal("Enter Y tilt minimum(0-1)", .1)

 	yTmax =  Rhino.GetReal("Enter Y tilt maximum(0-1)", .8)

splitWidth = Rhino.GetReal("Enter split width", 8)

 	offset =  Rhino.GetReal("Enter component offset (0-1)", .05)

 End If

'Dim flip : flip = Rhino.GetBoolean("Flip U and V?", Array("Flip","U,V", "V,U"),Array(False))

 '	Dim showDraw : showDraw =  Rhino.GetBoolean("Show or Hide construction?", Array("Construction","Hide", "Show"), Array(True))

'loft curves

If vertBool(0)=True	 Then

 	ReDim sourceSurface(UBound(sourceCurves)-2)

Dim a: a=0

 	For i=0 To UBound(sourceSurface)

Dim scArrV : scArrV = Array(sourceCurves(i),sourceCurves(i+2))

 		CheckLayerParent "construction"

 		sourceSurface(i)  = Rhino.AddEdgeSrf(scArrV)

 		'sourceSurface(i)  =Rhino.AddLoftSrf (scArrV ,  ,  , 3 , 1 )

 		Rhino.Command "SelNone"

 		Rhino.LastCreatedObjects  True

 		Rhino.Command "Reparameterize 0 1 0 1 "

a=a+2

Next

Else

 	ReDim sourceSurface(UBound(sourceCurves)-1)

 	For i=0 To 	UBound(sourceSurface )

 		Dim scArr : scArr = Array(sourceCurves(i),sourceCurves(i+1))

CheckLayerParent "construction"

 		sourceSurface(i)  = Rhino.AddEdgeSrf(scArr)

Rhino.Command "SelNone"

 		Rhino.LastCreatedObjects  True

 		Rhino.Command "Reparameterize 0 1 0 1 "

Next

 End If

'	If cocoonBool(0) = True Then

 '

 '		For i=0 To UBound(sourceCurves)-1

 '			CheckLayerParent "construction"

 '			Dim sourceSurfaceM : sourceSurfaceM  = Rhino.AddEdgeSrf(Array(sourceCurves(1),sourceCurves(3)))

 '

 '			Rhino.Command "SelNone"

 '			Rhino.LastCreatedObjects  True

 '			Rhino.Command "Reparameterize 0 1 0 1 "

 '

 '			'		Dim arrDomU :	arrDomU = Rhino.SurfaceDomain(sourceSurfaceM, 0)

 '			'		Dim u0 :	u0 = arrDomU(0)+.5

 '			'		Dim u1 :	u1 = arrDomU(1)-.5

 '			'		Dim arrDomV:	arrDomV = Rhino.SurfaceDomain(sourceSurfaceM, 1)

 '			'		Dim v0:v0 = arrDomV(0)

 '			'		Dim v1: v1 = arrDomV(1)

 '			'		CheckLayerParent "construction"

 '			'		midCurve=Rhino.AddInterpCrvOnSrfUV(sourceSurfaceM,Array(Array(u0,v0), Array(u1,v1)))

 '			'

 '

 '			'

 '

 '

 '			'		For j=0 To 	UBound(midCurve)-1

 '			'			CheckLayerParent "construction"

 '			'			midSurface(j)  = Rhino.AddEdgeSrf(Array(midCurve(j),midCurve(j+1)))

 '			'			Rhino.Command "SelNone"

 '			'			Rhino.LastCreatedObjects  True

 '			'			Rhino.Command "Reparameterize 0 1 0 1 "

 '			'		Next

 '

 '			End If

ReDim ap1<sup>1</sup>

 ReDim ap2<sup>2</sup>

 ReDim ap3<sup>3</sup>

 ReDim ap4<sup>4</sup>

 ReDim ap5<sup>5</sup>

ReDim ap1n<sup>6</sup>

 ReDim ap2n<sup>7</sup>

 ReDim ap3n<sup>8</sup>

 ReDim ap4n<sup>9</sup>

 ReDim ap5n<sup>10</sup>

ReDim underCocoon<sup>11</sup>

 ReDim overCocoon<sup>12</sup>

'Redimension the arrays that will hold all the values of U and V to the number of tiles in each direction

 ReDim uVal(uDiv)

 ReDim vVal(vDiv)

'Find the step value, i.e. the distance between tiles in each direction. (note: this is not the euclidian distance, it is the distance measured in UV space)

 uStep = 1/uDiv

 vStep = 1/vDiv

'Fill the arrays with the actual values of U and V at each step

 For i = 0 To uDiv

 	uVal(i) = i * uStep

 	'Rhino.Print "uVal(" &amp; i &amp; "):" &amp; uVal(i)

 Next

For i = 0 To vDiv

 	vVal(i) = i * vStep

'Rhino.Print "vVal(" &amp; i &amp; "):" &amp; vVal(i)

 Next

'Disable Rhino from redrawing the views during the tile construction to speed things up

 '	If showDraw(0) = False Then

 '		Rhino.EnableRedraw vbFalse

 '		Rhino.Print "Populating component..."

 '	End If

'Start looping through each u and v division and create the tile within

If componentType = "Wall"  Then

 	Dim UB : UB=	 UBound(sourceSurface)/2

Else

 	UB=	 UBound(sourceSurface)

 End If

For k = 0 To UB

 	yStep = 0

 	xStep = 0

For i = 0 To uDiv-1

 		For j = 0 To vDiv-1

'Find the 3D coordinate for each of the 4 corners of the tile using the UV coordinates as input

 			Dim topLeft :topLeft=	Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)))

 			Dim topRight : topRight = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+1, vVal(j)))

 			Dim bottomLeft : bottomLeft = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j+1)))

width =  Rhino.Distance(topLeft,topRight)

 			depth =  Rhino.Distance(topLeft,bottomLeft)

Dim curveMid:CurveMid=Rhino.EvaluateSurface(sourceSurface(k),Array(uVal(uDiv/2), vVal(vDiv/2)))

 			locatorMidDist=Rhino.Distance(Array(curveMid(0),curveMid(1),curveMid(2)),locator)

If componentType = "Wall"  Then

 				Dim top :top=	Rhino.EvaluateSurface(sourceSurface(k*2), Array(uVal(i), vVal(j)))

 				Dim bottom : bottom = Rhino.EvaluateSurface(sourceSurface(k*2+1),Array(uVal(i), vVal(j)))

 				height=Rhino.Distance(top,bottom)

 				wallComponent i,j,k*2,sourceSurface

End If

If componentType = "Mesh"  Then

meshComponent i,j,k,sourceSurface

End If

'					For m = 0 To 1

 			'						height=height*-1

 			'

If componentType = "Exterior" Or componentType="Transition"  Then

If width &gt;splitWidth Then

 					For p=0 To 1

 						uVal(0)=p/2

 						uVal(1)=1/2

 						extComponent i,j,k

 					Next

 				End If

If width<splitwidth></splitwidth>

If louvres(0)=True   Then

 						louvreComponent i,j,k

 						louvres(0)=False

 					Else

uVal(0)=0

 						uVal(1)=1

 						extComponent i,j,k

End If

Else

 					If width <splitwidth>

 						uVal(0)=0

 						uVal(1)=1

 						extComponent i,j,k

 					End If</splitwidth>

End If

 			End If

Next

 	Next

 Next

Rhino.DeleteObjects (sourceSurface)

Dim YN2:YN2= Rhino.MessageBox ("Delete construction lines?"  , 4)

 If YN2 =6 Then

 	Rhino.PurgeLayer ("construction")

 	'			Rhino.DeleteObjects(underCocoon(0,RandomNumber(0,UBound(underCocoon))))

 	'			Rhino.DeleteObjects(overCocoon(0,RandomNumber(0,UBound(overCocoon))))

 End If

End Sub

panel

Function cocoonComponent (i,j,k,surfaceA)

 checkLayerParent(parentLayer)

yTilt = Sin(j/vDiv)

If yTilt&gt;yTmax Then

 	yTilt = yTmax

 End If

 If yTilt<ytmin></ytmin>

yTilt = yTmin

 End If

xTilt = Sin(j/vDiv)

If xTilt&gt;xTmax Then

 	xTilt = xTmax

 End If

If xTilt<xtmin>

 	xTilt = xTmin

 End If</xtmin>

Dim overC : overC = RGB(125,125,125)

Dim a0 : a0 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i), vVal(j)))

 Dim c0 : c0 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i)+uVal(1), vVal(j)))

 Dim c2 : c2 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i)+uVal(1), vVal(j+1)))

 Dim a2 : a2 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i), vVal(j+1)))

Dim b1 : b1 = Rhino.SurfaceCurvature(surfaceA(k), Array(uVal(i)+(uVal(1)*.5), vVal(j) + vVal(1)*(1-xTilt)))

 ap1(i,j) = offsetCalc(b1, height*.1)

 Dim bb1 : bb1 = Rhino.SurfaceCurvature(surfaceA(k), Array(uVal(i)+(uVal(1)*.5), vVal(j)+vVal(1)*xTilt ))

 ap2(i,j) = offsetCalc(bb1, height*.1)

ap3(i,j) = offsetCalc(b1, height/2)

 ap4(i,j) = offsetCalc(bb1, height/2)

Dim a0B : a0B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i), vVal(j)))

 Dim c0B : c0B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i)+uVal(1), vVal(j)))

 Dim c2B : c2B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i)+uVal(1), vVal(j+1)))

 Dim a2B : a2B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i), vVal(j+1)))

Dim b1B : b1B = Rhino.SurfaceCurvature(surfaceA	(k+1), Array(uVal(i)+(uVal(1)*.5), vVal(j) + vVal(1)*(1-xTilt)))

 ap1n(i,j) = offsetCalc(b1B, -height*.1)

Dim bb1B : bb1B = Rhino.SurfaceCurvature(surfaceA(k+1), Array(uVal(i)+(uVal(1)*.5), vVal(j)+vVal(1)*xTilt))

 ap2n(i,j) = offsetCalc(bb1B, -height*.1)

'based on curvature

 'ap1(i,j) = offsetCalc(cb2, height*cb2(7)*10)

 'ap2(i,j) = offsetCalc(cb4, height*cb4(7)*10)

'constant height

 'ap1(i,j) = offsetCalc(cb2, height)

 'ap2(i,j) = offsetCalc(cb4, height)

'based on width height

 'xTilt=.1

'	ap2(i,j) = offsetCalc(c0, height*(1-yTilt))

 '	ap3(i,j) = offsetCalc(d0, height*xTilt)

 '	ap4(i,j) = offsetCalc(e0, height*(1-yTilt))

 '	ap5(i,j) = offsetCalc(f0, height*yTilt)

 '

 '	ap1n(i,j) = offsetCalc(b1, height*yTilt)

 '	ap2n(i,j) = offsetCalc(c1, height*(1-yTilt))

 '	ap3n(i,j) = offsetCalc(d1, height)

 '	ap4n(i,j) = offsetCalc(e1, height*(1-yTilt))

 '	ap5n(i,j) = offsetCalc(f1, height*yTilt)

CheckLayerParent "construction"

 'Dim a2ap1c0 : a2ap1c0 = Rhino.AddArc3Pt(a2,c0,ap1(i,j))

 'Dim c4ap4e2 : c4ap4e2 = Rhino.AddArc3Pt(c4,e2,ap4(i,j))

 'Dim a0ap1ap2b3 : a0ap1ap2b3 = Rhino.AddNurbsCurve (Array(a0,ap1(i,j),ap2(i,j),b3),Array(-1,-.5,0,.5,1) ,2,Array(100,1,1,100))

 'Dim a0nap1fnap2fnb3n : a0nap1fnap2fnb3n = Rhino.AddNurbsCurve (Array(a0n,ap1fn(i,j),ap2fn(i,j),b3n),Array(-1,-.5,0,.5,1) ,2,Array(100,1,1,100))

'Dim a2ap1c0 : a2ap1c0 = Rhino.AddEllipse3Pt (a2,c0,ap1(i,j))

 'Dim c4ap4e2 : c4ap4e2 = Rhino.AddEllipse3Pt (c4,e2,ap4(i,j))

'	Dim a0a1: a0a1 = Rhino.AddLine(a0,a1)

'horiz

 'top

 Dim a0ap1c0 : a0ap1c0 = Rhino.AddNurbsCurve (Array(a0,ap1(i,j),c0),Array(0,0,1,1) ,2,Array(100,100,100))

 'bottom

 Dim a0Bap1nc0B : a0Bap1nc0B = Rhino.AddNurbsCurve (Array(a0B,ap1n(i,j),c0B),Array(0,0,1,1) ,2,Array(100,100,100))

 'vert

 'left

 Dim a0ap3a0B :  a0ap3a0B = 	Rhino.AddNurbsCurve (Array(a0,ap3(i,j),a0B),Array(0,0,1,1) ,2,Array(100,100,100))

 'right

 Dim c0ap3c0B :  c0ap3c0B = 	Rhino.AddNurbsCurve (Array(c0,ap3(i,j),c0B),Array(0,0,1,1) ,2,Array(100,100,100))

'horiz

 'top

 Dim a2ap2c2 : a2ap2c2 = Rhino.AddNurbsCurve (Array(a2,ap2(i,j),c2),Array(0,0,1,1) ,2,Array(100,100,100))

 'bottom

 Dim a2Bap2nc2B : a2Bap2nc2B = Rhino.AddNurbsCurve (Array(a2B,ap2n(i,j),c2B),Array(0,0,1,1) ,2,Array(100,100,100))

'vert

 'left

 Dim a2ap4a2B :  a2ap4a2B = 	Rhino.AddNurbsCurve (Array(a2,ap4(i,j),a2B),Array(0,0,1,1) ,2,Array(100,100,100))

 'right

 Dim c2ap4c2B :  c2ap4c2B = 	Rhino.AddNurbsCurve (Array(c2,ap4(i,j),c2B),Array(0,0,1,1) ,2,Array(100,100,100))

CheckLayer"Cocoon Component" , overC

 'overCocoon(i,j)=Rhino.AddLoftSrf(Array(a0a1,ap1ap1n,ap2ap2n,ap3ap3n))

'underCocoon(i,j)=Rhino.AddLoftSrf(Array(ap3ap3n,ap4ap4n,ap5ap5n,g0g1))

'	Rhino.AddEdgeSrf(Array(a0ap1c0, a0Bap1nc0B,a0ap3a0B, c0ap3c0B))

 '	Rhino.AddEdgeSrf(Array(a2ap2c2, a2Bap2nc2B,a2ap4a2B, c2ap4c2B))

 '	edgeSurface a0ap1c0,  a2ap2c2

 '	edgeSurface a0Bap1nc0B,  a2Bap2nc2B

 '	edgeSurface a0ap3a0B,  a2ap4a2B

 '	edgeSurface c0ap3c0B,  c2ap4c2B

'Rhino.AddLoftSrf Array(	a0ap3a0B, c0ap3c0B,c2ap4c2B,a2ap4a2B),,,,,,True

 edgeSurface  a0ap1c0, a2ap4a2B

edgeSurface   a2Bap2nc2B, c0ap3c0B

End Function

Function meshComponent (i,j,k,surface)

checkLayerParent(parentLayer)

yTilt = Sin(j/vDiv)

If yTilt&gt;yTmax Then

 	yTilt = yTmax

 End If

 If yTilt<ytmin></ytmin>

yTilt = yTmin

 End If

xTilt = Sin(1-j/vDiv)

If xTilt&gt;xTmax Then

 	xTilt = xTmax

 End If

If xTilt<xtmin></xtmin>

xTilt = xTmin

 End If

Dim overC : overC = RGB(125,125,125)

Dim a0 : a0 = Rhino.EvaluateSurface(surface(k), Array(uVal(i), vVal(j)))

 Dim g0 : g0 = Rhino.EvaluateSurface(surface(k), Array(uVal(i)+uVal(1), vVal(j)))

 Dim g1 : g1 = Rhino.EvaluateSurface(surface(k), Array(uVal(i)+uVal(1), vVal(j+1)))

 Dim a1 : a1 = Rhino.EvaluateSurface(surface(k), Array(uVal(i), vVal(j+1)))

Dim b0 : b0 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.05), vVal(j)))

 Dim c0 : c0 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*yTilt), vVal(j)+vVal(1)*xTilt))

Dim d0 : d0 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.5), vVal(j)))

 Dim e0 : e0 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*(1-yTilt)), vVal(j)+vVal(1)*xTilt))

Dim f0 : f0 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.95), vVal(j)))

Dim b1 : b1 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.05), vVal(j+1)))

 Dim c1 : c1 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*yTilt), vVal(j+1)-vVal(1)*xTilt))

Dim d1 : d1 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.5), vVal(j+1)))

 Dim e1 : e1 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*(1-yTilt)), vVal(j+1)-vVal(1)*xTilt))

Dim f1 : f1 = Rhino.SurfaceCurvature(surface(k), Array(uVal(i)+(uVal(1)*.95), vVal(j+1)))

ap1(i,j) = offsetCalc(b0, height*yTilt)

 ap2(i,j) = offsetCalc(c0, height*(1-yTilt))

 ap3(i,j) = offsetCalc(d0, height)

 ap4(i,j) = offsetCalc(e0, height*(1-yTilt))

 ap5(i,j) = offsetCalc(f0, height*yTilt)

ap1n(i,j) = offsetCalc(b1, height*yTilt)

 ap2n(i,j) = offsetCalc(c1, height*(1-yTilt))

 ap3n(i,j) = offsetCalc(d1, height)

 ap4n(i,j) = offsetCalc(e1, height*(1-yTilt))

 ap5n(i,j) = offsetCalc(f1, height*yTilt)

CheckLayerParent "construction"

Dim a0a1: a0a1 = Rhino.AddLine(a0,a1)

 Dim ap1ap1n:ap1ap1n = Rhino.AddLine(ap1(i,j),ap1n(i,j))

 Dim ap2ap2n:ap2ap2n = Rhino.AddLine(ap2(i,j),ap2n(i,j))

 Dim ap3ap3n:ap3ap3n = Rhino.AddLine(ap3(i,j),ap3n(i,j))

 Dim ap4ap4n:ap4ap4n = Rhino.AddLine(ap4(i,j),ap4n(i,j))

 Dim ap5ap5n:ap5ap5n = Rhino.AddLine(ap5(i,j),ap5n(i,j))

 Dim g0g1:g0g1 = Rhino.AddLine(g0,g1)

CheckLayer"Cocoon Component" , overC

 overCocoon(i,j)=Rhino.AddLoftSrf(Array(a0a1,ap1ap1n,ap2ap2n,ap3ap3n))

 underCocoon(i,j)=Rhino.AddLoftSrf(Array(ap3ap3n,ap4ap4n,ap5ap5n,g0g1))

End Function

Function wallComponent(i,j,k,surfaceA)

checkLayerParent(parentLayer)

yTilt = Sin(j/vDiv)

If yTilt&gt;yTmax Then

 	yTilt = yTmax

 End If

 If yTilt<ytmin></ytmin>

yTilt = yTmin

 End If

xTilt = Sin(j/vDiv)

If xTilt&gt;xTmax Then

 	xTilt = xTmax

 End If

If xTilt<xtmin>

 	xTilt = xTmin

 End If</xtmin>

wallComponent

Dim overC : overC = RGB(125,125,125)

Dim a0 : a0 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i), vVal(j)))

 Dim c0 : c0 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i)+uVal(1), vVal(j)))

 Dim c2 : c2 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i)+uVal(1), vVal(j+1)))

 Dim a2 : a2 = Rhino.EvaluateSurface(surfaceA(k), Array(uVal(i), vVal(j+1)))

Dim b1 : b1 = Rhino.SurfaceCurvature(surfaceA(k), Array(uVal(i)+(uVal(1)*.5), vVal(j) + vVal(1)*(1-xTilt)))

 ap1(i,j) = offsetCalc(b1, height*.1)

 Dim bb1 : bb1 = Rhino.SurfaceCurvature(surfaceA(k), Array(uVal(i)+(uVal(1)*.5), vVal(j)+vVal(1)*xTilt ))

 ap2(i,j) = offsetCalc(bb1, height*.1)

ap3(i,j) = offsetCalc(b1, height/2)

 ap4(i,j) = offsetCalc(bb1, height/2)

Dim a0B : a0B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i), vVal(j)))

 Dim c0B : c0B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i)+uVal(1), vVal(j)))

 Dim c2B : c2B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i)+uVal(1), vVal(j+1)))

 Dim a2B : a2B = Rhino.EvaluateSurface(surfaceA(k+1), Array(uVal(i), vVal(j+1)))

Dim b1B : b1B = Rhino.SurfaceCurvature(surfaceA	(k+1), Array(uVal(i)+(uVal(1)*.5), vVal(j) + vVal(1)*(1-xTilt)))

 ap1n(i,j) = offsetCalc(b1B, -height*.1)

Dim bb1B : bb1B = Rhino.SurfaceCurvature(surfaceA(k+1), Array(uVal(i)+(uVal(1)*.5), vVal(j)+vVal(1)*xTilt))

 ap2n(i,j) = offsetCalc(bb1B, -height*.1)

CheckLayerParent "construction"

'horiz

 'top

 Dim a0ap1c0 : a0ap1c0 = Rhino.AddNurbsCurve (Array(a0,ap1(i,j),c0),Array(0,0,1,1) ,2,Array(100,100,100))

 'bottom

 Dim a0Bap1nc0B : a0Bap1nc0B = Rhino.AddNurbsCurve (Array(a0B,ap1n(i,j),c0B),Array(0,0,1,1) ,2,Array(100,100,100))

 'vert

 'left

 Dim a0ap3a0B :  a0ap3a0B = 	Rhino.AddNurbsCurve (Array(a0,ap3(i,j),a0B),Array(0,0,1,1) ,2,Array(100,100,100))

 'right

 Dim c0ap3c0B :  c0ap3c0B = 	Rhino.AddNurbsCurve (Array(c0,ap3(i,j),c0B),Array(0,0,1,1) ,2,Array(100,100,100))

'horiz

 'top

 Dim a2ap2c2 : a2ap2c2 = Rhino.AddNurbsCurve (Array(a2,ap2(i,j),c2),Array(0,0,1,1) ,2,Array(100,100,100))

 'bottom

 Dim a2Bap2nc2B : a2Bap2nc2B = Rhino.AddNurbsCurve (Array(a2B,ap2n(i,j),c2B),Array(0,0,1,1) ,2,Array(100,100,100))

'vert

 'left

 Dim a2ap4a2B :  a2ap4a2B = 	Rhino.AddNurbsCurve (Array(a2,ap4(i,j),a2B),Array(0,0,1,1) ,2,Array(100,100,100))

 'right

 Dim c2ap4c2B :  c2ap4c2B = 	Rhino.AddNurbsCurve (Array(c2,ap4(i,j),c2B),Array(0,0,1,1) ,2,Array(100,100,100))

CheckLayer"Cocoon Component" , overC

edgeSurface  a0ap1c0, a2ap4a2B

 edgeSurface   a2Bap2nc2B, c0ap3c0B

End Function

Function extComponent (i,j,k)

 checkLayerParent(parentLayer)

Dim ySin:ySin = Abs(Sin(sinMult*j/vDiv))

 Dim xSin:xSin = Abs(Sin(sinMult*j/vDiv))

Dim glassColor : glassColor = RGB(127,255,191 )

 Dim a0 : a0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)))

Dim dist : dist=Rhino.Distance(Array(a0(0),a0(1),a0(2)),locator)

Dim arrNormal:arrNormal = Rhino.SurfaceNormal(sourceSurface(k), Array(uVal(i), vVal(j)))

 CheckLayerParent "construction"

Rhino.addline Array(0,0,0),arrNormal

 Rhino.addline a0,locator

 Dim angle:angle=Rhino.Angle2(Array(a0,locator),Array(Array(0,0,0),arrNormal))

 'xTilt=1- locatorMidDist/dist

 'yTilt=1-locatorMidDist/dist

xTilt=angle(0)/30

 yTilt=angle(0)/30

 Rhino.Print "x"&amp; xTilt

 Rhino.Print "y"&amp; yTilt

If yTilt&gt;yTmax Then

 	yTilt = yTmax

 End If

 If yTilt<ytmin>

 	yTilt = yTmin

 End If</ytmin>

If xTilt&gt;xTmax Then

 	xTilt = xTmax

 End If

If xTilt<xtmin>

 	xTilt = xTmin

 End If</xtmin>

Dim f0 : f0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(j)))

 Dim a5 : a5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)+ vVal(1)))

Dim c0 : c0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(xTilt)), vVal(j)))

 Dim e0 : e0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-offset)), vVal(j)))

Dim a1 : a1 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)+vVal(1)*(offset)))

Dim a2 : a2 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)+vVal(1)*(yTilt)))

 Dim b2 : b2 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(offset)) , vVal(j)+vVal(1)*(yTilt)))

Dim b5 : b5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(offset)) , vVal(j)+vVal(1)))

 Dim d5 : d5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-xTilt)) , vVal(j)+vVal(1)))

Dim e3 : e3 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-offset)), vVal(j)+vVal(1)*(1-yTilt)))

 Dim f3 : f3 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(j)+vVal(1)*(1-yTilt)))

 Dim f4 : f4 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(j)+vVal(1)*(1-offset)))

Dim f5 : f5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(j)+vVal(1)))

Dim cc1 : cc1 = Rhino.SurfaceCurvature(sourceSurface(k), Array(uVal(i)+(uVal(1)*(xTilt)), vVal(j)+(vVal(1)*offset)))

 Dim cd4 : cd4 = Rhino.SurfaceCurvature(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-xTilt)), vVal(j)+vVal(1)*(1-offset)))

'based on width height

height=xTilt/10

 ap1(i,j) = offsetCalc(cc1,  width*height)

 ap2(i,j) = offsetCalc(cd4,  width*height)

Dim arrVertices(15)

 arrVertices(0) = a0

 arrVertices(1) = c0

 arrVertices(2) = e0

 arrVertices(3) = f0

 arrVertices(4) = a1

 arrVertices(5) = ap1(i,j)

 arrVertices(6) = a2

 arrVertices(7) =b2

 arrVertices(8) =e3

 arrVertices(9) =f3

 arrVertices(10) =ap2(i,j)

 arrVertices(11) =f4

 arrVertices(12) =a5

 arrVertices(13) =b5

 arrVertices(14) =d5

 arrVertices(15) =f5

Dim arrFaceVertices(7)

 arrFaceVertices(0) = Array(0,1,5,4)

 arrFaceVertices(1) = Array(1,2,8,5)

 arrFaceVertices(2) = Array(2,3,9,8)

 arrFaceVertices(3) = Array(4,5,7,6)

 arrFaceVertices(4) = Array(8,9,11,10)

 arrFaceVertices(5) = Array(6,7,13,12)

 arrFaceVertices(6) = Array(7,10,14,13)

 arrFaceVertices(7) = Array(10,11,15,14)

CheckLayer"Component" , componentColor

 Rhino.AddMesh arrVertices, arrFaceVertices

Dim arrGlassVertices(1)

 arrGlassVertices		(0) = Array(5,8,10,10)

 arrGlassVertices(1) = Array(5,7,10,10)

CheckLayer"Component Glass" , glassColor

 Rhino.AddMesh arrVertices, arrGlassVertices

End Function

Function louvreComponent (i,j,k)

 checkLayerParent(parentLayer)

yTilt = Sin(5*j/vDiv)

If yTilt&gt;yTmax Then

 	yTilt = yTmax

 End If

 If yTilt<ytmin></ytmin>

yTilt = yTmin

 End If

xTilt = Sin(5*j/vDiv)

If xTilt&gt;xTmax Then

 	xTilt = xTmax

 End If

If xTilt<xtmin>

 	xTilt = xTmin

 End If</xtmin>

Dim glassColor : glassColor = RGB(127,255,191 )

 Dim a0 : a0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)))

 Dim f0 : f0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(j)))

 Dim a5 : a5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(vDiv)))

Dim c0 : c0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(xTilt)), vVal(j)))

 Dim e0 : e0 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-offset)), vVal(j)))

Dim a1 : a1 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)+vVal(1)*(offset)))

Dim a2 : a2 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i), vVal(j)+vVal(1)*(yTilt)))

 Dim b2 : b2 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(offset)) , vVal(j)+vVal(1)*(yTilt)))

Dim b5 : b5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(offset)) , vVal(vDiv)))

 Dim d5 : d5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-xTilt)) , vVal(vDiv)))

Dim e3 : e3 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-offset)), vVal(vDiv-1)+vVal(1)*(-yTilt)))

 Dim f3 : f3 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(vDiv)+vVal(1)*(-yTilt)))

 Dim f4 : f4 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(vDiv)+vVal(1)*(-offset)))

Dim f5 : f5 = Rhino.EvaluateSurface(sourceSurface(k), Array(uVal(i)+uVal(1), vVal(vDiv)))

Dim cc1 : cc1 = Rhino.SurfaceCurvature(sourceSurface(k), Array(uVal(i)+(uVal(1)*(xTilt)), vVal(j)+(vVal(1)*offset)))

 Dim cd4 : cd4 = Rhino.SurfaceCurvature(sourceSurface(k), Array(uVal(i)+(uVal(1)*(1-xTilt)), vVal(vDiv)+vVal(1)*(-offset)))

'based on width height

ap1(i,j) = offsetCalc(cc1,  height*2)

 ap2(i,j) = offsetCalc(cd4,  height*2)

CheckLayerParent "construction"

 Dim a0c0 : a0c0 = Rhino.AddLine(a0 , c0)

 Dim a1ap1 : a1ap1 = Rhino.AddLine(a1, ap1(i,j))

 Dim c0ap1 : c0ap1 = Rhino.AddLine(c0, ap1(i,j))

 Dim a0a1 : a0a1 = Rhino.AddLine(a0 , a1)

 Dim a2b2 : a2b2 = Rhino.AddLine(a2 , b2)

 Dim a2a5 : a2a5 = Rhino.AddLine(a2 ,a5)

 Dim b2b5 : b2b5 = Rhino.AddLine(b2 , b5)

 Dim d5ap2 : d5ap2= Rhino.AddLine(d5,ap2(i,j))

 Dim b2ap2 : b2ap2  = Rhino.AddLine(b2,ap2(i,j))

 Dim b5d5 : b5d5 =  Rhino.AddLine(b5 , d5)

 CheckLayer"Component" , componentColor

 edgeSurface a0c0,a1ap1

 edgeSurface a1ap1,a2b2

 edgeSurface a2a5,b2b5

 edgeSurface b2ap2,b5d5

 CheckLayerParent "construction"

 Dim d5f5 : d5f5 = Rhino.AddLine(d5 , f5)

 Dim e3f3 : e3f3 = Rhino.AddLine(e3 , f3)

 Dim e0f0 : e0f0 = Rhino.AddLine(e0 , f0)

 Dim e0e3 : e0e3 = Rhino.AddLine(e0 , e3)

 Dim f0f3 : f0f3 = Rhino.AddLine(f0 , f3)

 Dim c0e0 : c0e0 = Rhino.AddLine(c0 , e0)

 Dim f4ap2 : f4ap2 = Rhino.AddLine(f4 , ap2(i,j))

 Dim e3ap1 : e3ap1 = Rhino.AddLine( ap1(i,j), e3)

 CheckLayer"Component" , componentColo

 edgeSurface f4ap2,e3f3

 edgeSurface e0e3,f0f3

 edgeSurface f4ap2,d5f5

 edgeSurface c0e0,e3ap1

 CheckLayerParent "construction"

 Dim ap1ap2 : ap1ap2 = Rhino.AddLine(ap1(i,j) , ap2(i,j))

 Dim e3ap2 : e3ap2 = Rhino.AddLine( ap2(i,j), e3)

 Dim b2ap1 : b2ap1  = Rhino.AddLine(b2,ap1(i,j))

 CheckLayer "Component Glass",glassColor

 Rhino.AddPlanarSrf(Array(ap1ap2,e3ap2,e3ap1))

 Rhino.AddPlanarSrf(Array(ap1ap2,b2ap2,b2ap1))

End Function

Function edgeSurface(edge1,edge2)

Dim f : f = Rhino.CurveDirectionsMatch(edge1,edge2)

 Dim rEdge

If f = False Then

 	rEdge=	Rhino.ReverseCurve(edge2)

 End If

 Rhino.AddEdgeSrf(Array(edge1, edge2 ))

End Function

Function RandomNumber(nMin, nMax)

 RandomNumber = vbNull

 If Not IsNumeric(nMin) Then Exit Function

 If Not IsNumeric(nMax) Then Exit Function

 If nMin &gt;= nMax Then Exit Function

 Randomize

 RandomNumber = Int((nMax - nMin + 1) * Rnd + nMin)

End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 	'This fucntion finds the coordinate of a point normal to, and at a <height> from, a point on the surface

Function offsetCalc(oData, height)

 Dim vscaled

 vscaled = VectorScale(oData(1),height)

 offsetCalc = VectorAdd(vscaled,oData(0))

End Function</height>

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 	'function by RMA, "vectors.rvb"

Function VectorAdd(v1, v2)

VectorAdd = Null

 'If Not IsArray(v1) Or (UBound(v1) &lt;&gt; 2) Then Exit Function

 'If Not IsArray(v2) Or (UBound(v2) &lt;&gt; 2) Then Exit Function

 VectorAdd = Array(v1(0) + v2(0), v1(1) + v2(1), v1(2) + v2(2))

End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 	'function by RMA, "vectors.rvb"

Function VectorScale(v, d)

VectorScale = Null

 'If Not IsArray(v) Or (UBound(v) &lt;&gt; 2) Then Exit Function

 'If Not IsNumeric(d) Then Exit Function

 VectorScale = Array(v(0) * d, v(1) * d, v(2) * d)

End Function

'--------------------------------------------------------------------------------------------------------------------

 	'This function checks if the current layer is <layername> and if it isn't, makes it so. If the layer <layername> doesn't

 	'     exist then it creates it with the name <layername>.

Function CheckLayerParent(layername)

 If Rhino.IsLayer(layername) Then

 	Rhino.CurrentLayer(layername)</layername></layername></layername>

Else

 	Rhino.AddLayer layername,RGB(Cint(parentLayer*5),125,125)

 	Rhino.CurrentLayer(layername)

 End If

End Function

Function CheckLayer(layername,color)

 If Rhino.IsLayerChildOf(parentLayer, layername+"_"+parentLayer) Then

 	Rhino.CurrentLayer(layername+"_"+parentLayer)

Else

 	Rhino.AddLayer layername+"_"+parentLayer,color,,,parentLayer

 	Rhino.CurrentLayer(layername+"_"+parentLayer)

 End If

End Function

Function mesh()

 Rhino.Command "SelNone"

 Rhino.Command "Sellast"

 Rhino.Command "_mesh           Enter"

End Function</pre>
<ol class="footnotes"><li id="footnote_0_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_1_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_2_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_3_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_4_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_5_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_6_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_7_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_8_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_9_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_10_404" class="footnote">uDiv-1),(vDiv-1</li><li id="footnote_11_404" class="footnote">uDiv-1),(vDiv-1</li></ol>]]></content:encoded>
			<wfw:commentRss>http://cwwang.com/2007/04/19/seroussi-pavillion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
