<?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>neoarchaic &#187; Fabrication Scripts</title>
	<atom:link href="http://neoarchaic.net/category/resources/fabrication-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://neoarchaic.net</link>
	<description>a pool of resources</description>
	<lastBuildDate>Sat, 28 Apr 2012 04:07:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Rib Maker</title>
		<link>http://neoarchaic.net/2010/03/rib-maker/</link>
		<comments>http://neoarchaic.net/2010/03/rib-maker/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 00:22:30 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=122</guid>
		<description><![CDATA[Well, I finally made one. Ive been putting it off for a while, because so many of them already exist, but it provided the opportunity to look at information sorting in a more streamlined pattern. This Rib fabrication Rhino script allows the user to select a surface, input the row and column count, specify the rib dimensions, then sit back, have a coffee and let the computer do the work.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^122#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_1', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_1'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_rib_00.jpg' rel='shadowbox[album-122];player=img;' title='fab_rib_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_rib_00-128x128.jpg" class="attachment-thumbnail" alt="fab_rib_00" title="fab_rib_00" /></a>
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_rib_01.jpg' rel='shadowbox[album-122];player=img;' title='fab_rib_01'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_rib_01-128x128.jpg" class="attachment-thumbnail" alt="fab_rib_01" title="fab_rib_01" /></a>

				</div>
				
</p>
<hr />
<p><span style="font-size: smaller; ">Well, I finally made one. Ive been putting it off for a while, because so many of them already exist, but it provided the opportunity to look at information sorting in a more streamlined pattern. This Rib fabrication Rhino script allows the user to select a surface, input the row and column count, specify the rib dimensions, then sit back, have a coffee and let the computer do the work.</span></p>
<hr />
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform:&nbsp;</span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
</p></div>
</div>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Adapted from concepts provided Andrew Payne of Lift Architects
'http://www.liftarchitects.com/
'Script adapted by &lt;Neoarchaic Studio&gt;
'Script version Thursday, April 02, 2009 12:47:23 AM

Call Main()
Sub Main()
	Dim surface, arrValue
	surface = Rhino.GetObject(&quot;Select Surface&quot;,8,True)
	If isNull(surface) Then Exit Sub
	Call reparameterize(surface)

	arrValue = Rhino.PropertyListBox(array(&quot;Columns&quot;,&quot;Rows&quot;,&quot;Rib Height&quot;,&quot;Rib Width&quot;,&quot;Tile Spacing&quot;,&quot;textHeight&quot;),array(10,10,1,0.2,1,0.25))
	If isNull(arrValue) Then Exit Sub

	Call Rhino.EnableRedraw(False)
	Dim bBox: bBox = Rhino.BoundingBox(surface)
	Dim dist: dist = Rhino.Distance(bBox(0),bBox(4))

	Dim grid, ribs, draw
	grid = projectGrid(surface,CInt(arrValue(0)),CInt(arrValue(1)))
	ribs = makeRib(grid,CDbl(arrValue(2)),CDbl(arrValue(3)),dist)
	draw = makeDrawing(ribs(1),CDbl(arrValue(4)),CDbl(arrValue(5)))
	Call Rhino.DeleteObjects(grid(0))
	Call Rhino.DeleteObjects(grid(1))

	Call Rhino.EnableRedraw(True)
End Sub
Function projectGrid(surface,cols,rows)
	projectGrid = Null
	Dim i,j,k,r,s
	Dim bBox, order, edge(3)
	Dim tCrv,crv(1),pCrv(),arrCrv,dom(1), cStp(1)

	bBox = Rhino.BoundingBox(surface)
	order = array(4,5,7,6,4,7,5,6)

	r=0
	For i = 0 To 3 Step 1
		edge(i) = Rhino.AddLine(bBox(order(r)),bBox(order(r+1)))
		r = r+2
	Next
	order = array(cols,rows)
	r=0
	For i = 0 To 1 Step 1
		s=0
		dom(0) = Rhino.CurveDomain(edge(r))
		dom(1) = Rhino.CurveDomain(edge(r+1))
		cStp(0) = (dom(0)(1)-dom(0)(0))/order(i)
		cStp(1) = (dom(1)(1)-dom(1)(0))/order(i)
		For j = 0 To order(i)-1 Step 1
			tCrv = Rhino.AddLine(Rhino.EvaluateCurve(edge(r),dom(0)(0)+cStp(0)*0.5+cStp(0)*j),Rhino.EvaluateCurve(edge(r+1),dom(1)(0)+cStp(1)*0.5+cStp(1)*j))
			arrCrv = Rhino.ProjectCurveToSurface(tCrv,surface,Rhino.VectorReverse(Rhino.WorldXYPlane()(3)))
			Call Rhino.DeleteObject(tCrv)
			For k = 0 To uBound(arrCrv) Step 1
				ReDim Preserve pCrv(s)
				pCrv(s) = arrCrv(k)
				s = s+1
			Next
		Next
		crv(i) = pCrv
		r=r+2
	Next
	Call Rhino.DeleteObjects(edge)
	projectGrid = crv
End Function
Function makeRib(curves,height,width,zHeight)
	makeRib = Null
	Dim i,j,k,r
	Dim intersect, tPt
	Dim arrObject()
	Dim blnBlock, xVal, yVal, zVal, tPts(7)

	xVal = array(-width*0.5,-width*0.5,width*0.5,width*0.5)
	yVal = array(-width*0.5,width*0.5,width*0.5,-width*0.5)
	zVal = array(0,height*2+zHeight)
	r=0
	For i = 0 To 1 Step 1
		For j = 0 To 3 Step 1
			tPts(r) = array(xVal(j),yVal(j),zVal(i))
			r=r+1
		Next
	Next
	blnBlock = Rhino.AddBox(tPts)

	r=0
	For i = 0 To uBound(curves(0)) Step 1
		For j = 0 To uBound(curves(1)) Step 1
			intersect = Rhino.CurveCurveIntersection(curves(0)(i),curves(1)(j))
			If isNull(intersect) Then
			Else
				ReDim Preserve arrObject(r)
				tPt = intersect(0,1)
				arrObject(r) = Rhino.CopyObject(blnBlock,array(0,0,0),tPt)
				r=r+1
			End If
		Next
	Next

	Dim tRib, rib(), tCurve()
	Dim ribSet(1), cutRibs(1),tLine(1),ribCurve(1)

	tLine(0) = Rhino.AddLine(array(0,0,0), array(width,0,0))
	tLine(1) = Rhino.AddLine(array(0,0,0), array(0,width,0))

	For i = 0 To 1 Step 1
		ReDim rib(uBOund(curves(i)))
		For j = 0 To uBOund(curves(i)) Step 1
			Call Rhino.AddTextDot(i &amp; &quot;-&quot; &amp; j,Rhino.CurveEndPoint(curves(i)(j)))
			tRib = Rhino.ExtrudeCurveStraight(curves(i)(j),array(0,0,0),array(0,0,height))
			Call Rhino.MoveObject(tRib,Rhino.CurveEndPoint(tLine(i)),Rhino.CurveMidPoint(tLine(i)))
			rib(j) = Rhino.ExtrudeSurface(tRib,tLine(i))
			Call Rhino.DeleteObject(tRib)
		Next
		ribSet(i) = rib
	Next

	For i = 0 To 1 Step 1
		ReDim tCurve(uBound(ribSet(i)))
		If i = 0 Then
			Call Rhino.MoveObjects(arrObject,array(0,0,0),array(0,0,height*0.5))
		Else
			Call Rhino.MoveObjects(arrObject,array(0,0,0),array(0,0,-height*2-zHeight))
		End If
		cutRibs(i) = Rhino.BooleanDifference(ribSet(i),arrObject,False)
		For j = 0 To ubound(cutRibs(i)) Step 1
			tCurve(j) = Rhino.ProjectCurveToSurface(curves(i)(j),cutRibs(i)(j),Rhino.VectorReverse(Rhino.WorldXYPlane()(3)))(0)
		Next
		ribCurve(i) = tCurve
		Call Rhino.DeleteObjects(ribSet(i))
	Next

	Call Rhino.DeleteObjects(arrObject)
	Call Rhino.DeleteObjects(tLine)
	Call Rhino.DeleteObject(blnBlock)
	makeRib = array(cutRibs,ribCurve)
End Function
Function makeDrawing(arrCrvs,spacing,tHeight)
	makeDrawing = Null
	Dim i,j
	Dim cPlane, wPlane, bBox, tObject(), objects()
	ReDim objects(uBOund(arrCrvs))

	Dim pPt, tPt
	Dim xPos, yPos, tPos, ySet()

	For i = 0 To uBound(arrCrvs) Step 1
		ReDim tObject(uBound(arrCrvs(i)))
		For j = 0 To uBound(arrCrvs(i)) Step 1
			cPlane = Rhino.CurvePlane(arrCrvs(i)(j))
			wPlane = Rhino.WorldXYPlane()
			tObject(j) = Rhino.OrientObject(arrCrvs(i)(j),array(cPlane(0),Rhino.PointAdd(cPlane(0),cPlane(1)),Rhino.PointAdd(cPlane(0),cPlane(2))),array(wPlane(0),wPlane(1),wPlane(2)))
			bBox = Rhino.BoundingBox(tObject(j))
			Call Rhino.MoveObject(tObject(j),bBox(0),array(0,0,0))
		Next
		objects(i) = tObject
	Next
	yPos = 0
	For i = 0 To uBound(arrCrvs) Step 1
		tPos = 0
		xPos = 0
		ReDim ySet(uBound(arrCrvs(i)))
		For j = 0 To uBound(arrCrvs(i)) Step 1
			bBox = Rhino.BoundingBox(objects(i)(j))
			pPt = array(xPos,yPos,0)
			If j &gt; 0 Then
				tPos = xPos
				xPos = tPos+Rhino.Distance(bBox(0),bBox(1))+spacing
			Else
				xPos = bBox(1)(0)+spacing
			End If
			Call Rhino.MoveObject(objects(i)(j),bBox(0),pPt)
			Call Rhino.AddText(i &amp; &quot;-&quot; &amp; j,Rhino.CurveStartPoint(objects(i)(j)),tHeight)
			ySet(j) = bBox(2)(1)
		Next
		yPos = Rhino.Max(ySet)+spacing
	Next
End Function
Function reparameterize(strCurveID)
	If Rhino.IsCurve(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
	If Rhino.IsSurface(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/rib-maker/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Expanded Surface</title>
		<link>http://neoarchaic.net/2010/03/expanded-surface/</link>
		<comments>http://neoarchaic.net/2010/03/expanded-surface/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 00:11:22 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=108</guid>
		<description><![CDATA[The expanded surface is the final release of the unfolded surface series at this time. This version generates an expanded surface which provides higher structural rigidity as well as aesthetic texture. This script includes a function to find the triangular inpoint from a series of 3 different points.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^108#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_2', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_2'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_expandedsrf_00.jpg' rel='shadowbox[album-108];player=img;' title='fab_expandedsrf_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_expandedsrf_00-128x128.jpg" class="attachment-thumbnail" alt="fab_expandedsrf_00" title="fab_expandedsrf_00" /></a>

				</div>
				
</p>
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<hr />
<p><span style="font-size: smaller; "><span style="font-family: Arial; ">The expanded surface is the final release of the unfolded surface series at this time. This version generates an expanded surface which provides higher structural rigidity as well as aesthetic texture. This script includes a function to find the triangular inpoint from a series of 3 different points.</span></span></p>
<hr />
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform:&nbsp;</span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
</p></div>
</div>
<p>&nbsp;&nbsp;</p>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Script copyrighted by &lt;Neoarchaic Design&gt;
'Script version Monday, May 26, 2008 1:43:26 PM

Call Main()
Sub Main()
	Dim surf
	surf = Rhino.GetObject(&quot;select surface&quot;,8)
	If isNull(surf) Then Exit Sub
	Call reparameterize(surf)

	Dim arrItems, arrValues, arrResults
	arrItems = array(&quot;Cell_Colums&quot;,&quot;Cell_Rows&quot;,&quot;Offset&quot;,&quot;Scale_btw_0-1&quot;,&quot;tabHeight&quot;,&quot;cutTemplate&quot;,&quot;surfaces&quot;,&quot;imageScale&quot;,&quot;imageOculi&quot;)
	arrValues= array(10,10,1,0.4,1,True,True,False,True)
	arrResults = Rhino.PropertyListBox (arrItems, arrValues ,,&quot;Volume Parameters&quot;)
	Dim scale, oculi

	If CBool(arrResults(7)) = True Then
		scale = arrImageSample(CInt(arrResults(0))*2+1, CInt(arrResults(1))*2+1)(6)
	Else
		scale = arrayValue(CInt(arrResults(0))*2+1, CInt(arrResults(1))*2+1,CDbl(arrResults(2)))
	End If
	If CBool(arrResults(8)) = True Then
		oculi = arrImageSample(CInt(arrResults(0))*2, CInt(arrResults(1))*2)(6)
	Else
		oculi = arrayValue(CInt(arrResults(0))*2, CInt(arrResults(1))*2,CDbl(arrResults(3)))
	End If

	Dim tri, cut(2)
	Call Rhino.EnableRedraw(False)
	tri = TriangulateSurface(surf,CInt(arrResults(0))*2,CInt(arrResults(1))*2,CDbl(arrResults(2)),scale)
	If CBool(arrResults(6)) = True Then
		Call SurfaceMe(tri(0),oculi,CDbl(arrResults(3)),&quot;surfaces_out&quot;)
		Call SurfaceMe(tri(1),oculi,CDbl(arrResults(3)),&quot;surfaces_in&quot;)
		Call SurfaceMe(tri(2),oculi,CDbl(arrResults(3)),&quot;surfaces_center&quot;)
	End If

	If CBool(arrResults(5)) = True Then
		cut(0) = UnfoldMe(tri(0),0,CDbl(arrResults(4)),oculi,CDbl(arrResults(3)),&quot;A&quot;)
		cut(1) = UnfoldMe(tri(1),cut(0)+5,CDbl(arrResults(4)),oculi,CDbl(arrResults(3)),&quot;B&quot;)
		cut(2) = UnfoldMe(tri(2),cut(1)+5,CDbl(arrResults(4)),oculi,CDbl(arrResults(3)),&quot;C&quot;)
	End If

	Call Rhino.EnableRedraw(True)

End Sub
Function TriangulateSurface(surface,cols,rows,offset,arrOffset)
	TriangulateSurface = Null
	Dim i,j
	Dim uDom,vDom,uStep,vStep
	uDom = Rhino.SurfaceDomain(surface,0)(1): uStep = uDom/cols
	vDom = Rhino.SurfaceDomain(surface,1)(1): VStep = vDom/rows

	ReDim uv(rows),pt(rows),ptA(rows),ptB(rows),uvSet(cols),ptSet(cols),ptSetA(cols),ptSetB(cols)
	'plot point grid
	For i = 0 To cols Step 1
		For j = 0 To rows Step 1
			uv(j) = array(i*uStep,j*vStep)
			ptB(j) = Rhino.EvaluateSurface(surface,uv(j))
			If arrOffset(i)(j) &lt; .1 Then
				arrOffset(i)(j) = .1
			End If

			If i Mod(2) Then
				If j Mod(2) Then
					pt(j) = Rhino.EvaluateSurface(surface,uv(j))
					ptA(j)= pt(j)
				Else
					pt(j) = Rhino.EvaluateSurface(surface,uv(j))
					ptA(j)= pt(j)
					pt(j) = Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),offset*arrOffset(i)(j)))
					ptA(j)= Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),-offset*arrOffset(i)(j)))
				End If
			Else
				If j Mod(2) Then
					pt(j) = Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),offset*arrOffset(i)(j)))
					ptA(j)= Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),-offset*arrOffset(i)(j)))
				Else
					pt(j) = Rhino.EvaluateSurface(surface,uv(j))
					ptA(j)= pt(j)
				End If
			End If
	Next
	uvSet(i) = uv
	ptSet(i) = pt
	ptSetA(i)= ptA
	ptSetB(i)= ptB

	Next
	TriangulateSurface = array(ptSet,ptSetA,ptSetB)
End Function
Function SurfaceMe(ptSet,scale,minVal,objLayer)
	SurfaceMe = Null
	If Rhino.IsLayer(objLayer) = False Then
		Call Rhino.AddLayer(objLayer,RGB(0,0,255))
	End If

	Dim i,j
	Dim cols, rows
	Dim pts(1)
	cols = uBound(ptSet)
	rows = uBound(ptSet(0))

	Dim srfA(),srfB(),cPt(1)
	ReDim srfA(rows-1),srfB(rows-1)
	ReDim s(cols-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			If scale(i)(j) &gt; 0.9 Then
				If i Mod(2) Then
					If j Mod(2) Then
						srfA(j) = Rhino.AddSrfPt(array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j)))
						srfB(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j)))
					Else
						srfA(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j)))
						srfB(j) = Rhino.AddSrfPt(array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j)))
					End If
				Else
					If j Mod(2) Then
						srfA(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j)))
						srfB(j) = Rhino.AddSrfPt(array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j)))
					Else
						srfA(j) = Rhino.AddSrfPt(array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j)))
						srfB(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j)))
					End If
				End If
				Call Rhino.ObjectLayer(srfA(j),objLayer)
				Call Rhino.ObjectLayer(srfB(j),objLayer)
			Else
				If scale(i)(j) &lt; minVal Then
					scale(i)(j) = minVal
				End If
				If i Mod(2) Then
					If j Mod(2) Then
						pts(0) = array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j))
						pts(1) = array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j))
						cPt(0) = incenter(pts(0)(0),pts(0)(1),pts(0)(2))
						cPt(1) = incenter(pts(1)(0),pts(1)(1),pts(1)(2))
						srfA(j)= innerSurf(cPt(0),pts(0),scale(i)(j))
						srfB(j)= innerSurf(cPt(1),pts(1),scale(i)(j))
					Else
						pts(0) = array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j))
						pts(1) = array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j))
						cPt(0) = incenter(pts(0)(0),pts(0)(1),pts(0)(2))
						cPt(1) = incenter(pts(1)(0),pts(1)(1),pts(1)(2))
						srfA(j)= innerSurf(cPt(0),pts(0),scale(i)(j))
						srfB(j)= innerSurf(cPt(1),pts(1),scale(i)(j))
					End If
				Else
					If j Mod(2) Then
						pts(0) = array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j))
						pts(1) = array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j))
						cPt(0) = incenter(pts(0)(0),pts(0)(1),pts(0)(2))
						cPt(1) = incenter(pts(1)(0),pts(1)(1),pts(1)(2))
						srfA(j)= innerSurf(cPt(0),pts(0),scale(i)(j))
						srfB(j)= innerSurf(cPt(1),pts(1),scale(i)(j))
					Else
						pts(0) = array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j))
						pts(1) = array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j))
						cPt(0) = incenter(pts(0)(0),pts(0)(1),pts(0)(2))
						cPt(1) = incenter(pts(1)(0),pts(1)(1),pts(1)(2))
						srfA(j)= innerSurf(cPt(0),pts(0),scale(i)(j))
						srfB(j)= innerSurf(cPt(1),pts(1),scale(i)(j))
					End If
				End If
				Call Rhino.ObjectLayer(srfA(j)(1),objLayer)
				Call Rhino.ObjectLayer(srfB(j)(1),objLayer)
			End If
		Next
		s(i) = array(srfA,srfB)
	Next
	SurfaceMe = s
End Function
Function UnfoldMe(ptSet,y,tabHeight,scale,minVal,prefix)
	UnfoldMe= Null
	If Rhino.IsLayer(&quot;cuts&quot;) = False Then
		Call Rhino.AddLayer(&quot;cuts&quot;,RGB(255,0,0))
	End If
	If Rhino.IsLayer(&quot;scores&quot;) = False Then
		Call Rhino.AddLayer(&quot;scores&quot;,RGB(0,0,0))
	End If

	Dim i,j,r
	Dim cols, rows, wrldCS
	cols = uBound(ptSet)
	rows = uBound(ptSet(0))
	wrldCS = Rhino.WorldXYPlane()
	Dim oriPt(), angX(), ptA(), ptB(), ptC(),pts(),minX(),maxX(),mn(),mx()
	ReDim oriPt(rows-1), angX(rows-1), ptA(rows-1), ptB(rows-1), ptC(rows-1),minX(rows-1),maxX(rows-1),mn(cols-1),mx(cols-1),pts(cols-1)

	Dim angA(),angB(),angC(),disA(),disB(),disC(),s(),a(),d()
	ReDim angA(rows-1),angB(rows-1),angC(rows-1),disA(rows-1),disB(rows-1),disC(rows-1)
	ReDim a(cols-1), d(cols-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			If i Mod(2) Then
				If j Mod(2) Then
					angA(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j+1)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i)(j),ptSet(i+1)(j))
					disB(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
					disC(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
				Else
					angA(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i+1)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j+1)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i)(j))
					disB(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
					disC(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
				End If
			Else
				If j Mod(2) Then
					angA(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i+1)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j+1)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i)(j))
					disB(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
					disC(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
				Else
					angA(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j+1)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i)(j),ptSet(i+1)(j))
					disB(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
					disC(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
				End If
			End If
		Next
		a(i) = array(angA,angB,angC)
		d(i) = array(disA,disB,disC)
	Next

	For i = 0 To cols-1 Step 1
		r=0
		For j = 0 To rows-1 Step 1
			If j = 0 Then
				oriPt(j) = array(0,y,0)
				angX(j) = 0
			Else
				oriPt(j) = ptB(j-1)
				If ptB(j-1)(1) &gt; ptC(j-1)(1) Then
					angX(j) = -Rhino.Angle2(array(ptB(j-1),Rhino.PointAdd(ptB(j-1),wrldCS(1))),array(ptB(j-1),ptC(j-1)))(0)
				Else
					angX(j) = Rhino.Angle2(array(ptB(j-1),Rhino.PointAdd(ptB(j-1),wrldCS(1))),array(ptB(j-1),ptC(j-1)))(0)
				End If
			End If
			If i Mod(2) Then
				r = j+1
			Else
				r = j
			End If
			If r Mod(2) Then
				ptA(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j),wrldCS(3)),d(i)(0)(j)))
				ptB(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+a(i)(1)(j)+a(i)(2)(j),wrldCS(3)),d(i)(2)(j)))
				ptC(j) = Rhino.PointAdd(ptA(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+180-a(i)(0)(j),wrldCS(3)),d(i)(1)(j)))
			Else
				ptA(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j),wrldCS(3)),d(i)(0)(j)))
				ptB(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+a(i)(0)(j),wrldCS(3)),d(i)(1)(j)))
				ptC(j) = Rhino.PointAdd(ptA(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+180-a(i)(1)(j)-a(i)(2)(j),wrldCS(3)),d(i)(2)(j)))
			End If
			minX(j) = Rhino.Min(array(ptA(j)(0),ptB(j)(0),ptC(j)(0)))
			maxX(j) = Rhino.Max(array(ptA(j)(0),ptB(j)(0),ptC(j)(0)))
			r=r+1
		Next
		mn(i) = Rhino.Min(minX)
		If mn(i) &gt; 0 Then
			mn(i) = 0
		Else
			mn(i) = abs(mn(i))
		End If
		mx(i) = abs(Rhino.Max(maxX))
		pts(i) = array(oriPt,ptA,ptB,ptC)
	Next
	Dim ptX, k,u
	Dim points(3),yVal(3),dblY
	ReDim yMax(rows-1), yM(cols-1)
	Dim edge(),edgeA(), edgeB(), span()
	ReDim edge(cols-1),edgeA(rows-1), edgeB(rows-1), span(rows*2)
	Dim cPt(1), oculi(1)
	r=0
	For i = 0 To cols-1 Step 1
		k=0
		If i &gt; 0 Then
			r = r+mx(i-1)+mn(i)+tabHeight*2
		End If
		For j = 0 To rows-1 Step 1
			ptX	= array(r,0,0)
			For u = 0 To 3 Step 1
				points(u) = Rhino.PointAdd(ptX,pts(i)(u)(j))
			Next
			If j Mod(2) Then
				span(k) = Rhino.AddLine(points(0),points(3))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			Else
				span(k) = Rhino.AddLine(points(1),points(2))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			End If
			If j = 0 Then
				span(k) = Rhino.AddLine(points(0),points(1))
				Call Rhino.ObjectLayer(span(k),&quot;cuts&quot;)
				k=k+1
			End If
			If j = rows-1 Then
				span(k) = Rhino.AddLine(points(2),points(3))
				Call Rhino.ObjectLayer(span(k),&quot;cuts&quot;)
				k=k+1
			Else
				span(k) = Rhino.AddLine(points(2),points(3))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			End If

			If scale(i)(j) &lt;= .9 Then
				If scale(i)(j) &lt; minVal Then
					scale(i)(j) = minVal
				End If
				If j Mod(2) Then
					cPt(0) = incenter(points(0),points(2),points(3))
					cPt(1) = incenter(points(0),points(1),points(3))
					oculi(0) = innerEdge(cPt(0),array(points(0),points(2),points(3)),scale(i)(j))
					oculi(1) = innerEdge(cPt(1),array(points(0),points(1),points(3)),scale(i)(j))
				Else
					cPt(0) = incenter(points(0),points(1),points(2))
					cPt(1) = incenter(points(2),points(1),points(3))
					oculi(0) = innerEdge(cPt(0),array(points(0),points(1),points(2)),scale(i)(j))
					oculi(1) = innerEdge(cPt(1),array(points(2),points(1),points(3)),scale(i)(j))
				End If

				Call Rhino.ObjectLayer(oculi(0)(1),&quot;cuts&quot;)
				Call Rhino.ObjectLayer(oculi(1)(1),&quot;cuts&quot;)
			End If

			edgeA(j) = Rhino.AddLine(points(0),points(2))
			Call Rhino.ObjectLayer(edgeA(j),&quot;scores&quot;)
			edgeB(j) = Rhino.AddLine(points(1),points(3))
			Call Rhino.ObjectLayer(edgeB(j),&quot;scores&quot;)
			For u = 0 To 3 Step 1
				yVal(u) = points(u)(1)
			Next
			yMax(j) = Rhino.Max(yVal)
		Next
		edge(i) = array(edgeA,edgeB)
		yM(i) = Rhino.Max(yMax)
	Next
	dblY = Rhino.Max(yM)
	Dim tabA(), tabB(), lblA(), lblB()
	ReDim tabA(rows-1), tabB(rows-1), lblA(rows-1), lblB(rows-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			tabA(j) = tabMaker(edge(i)(0)(j),-90,tabHeight)
			tabB(j) = tabMaker(edge(i)(1)(j),90,tabHeight)
			Call Rhino.ObjectLayer(tabA(j),&quot;cuts&quot;)
			Call Rhino.ObjectLayer(tabB(j),&quot;cuts&quot;)

			If i = cols-1 Then
				lblB(j) = labelMaker(edge(i)(1)(j),CStr(prefix) &amp; &quot;.&quot; &amp; cols-1 &amp; &quot;.&quot; &amp; j,tabHeight*.3,0,True)
			Else
				lblB(j) = labelMaker(edge(i)(1)(j),CStr(prefix) &amp; &quot;.&quot; &amp; i+1 &amp; &quot;.&quot; &amp; j,tabHeight*.3,0,True)
			End If
			lblA(j) = labelMaker(edge(i)(0)(j),CStr(prefix) &amp; &quot;.&quot; &amp; i &amp; &quot;.&quot; &amp; j,tabHeight*.3,180,True)
	Next
	Next
	UnfoldMe = dblY
End Function
Function tabMaker(curve,rotVal,scale)
	tabMaker = Null
	Dim tabLN(1), tabPT(2),crvDom, wrldCS, i
	crvDom = Rhino.CurveDomain(curve)
	wrldCS = Rhino.WorldXYPlane()
	tabPT(0) = Rhino.CurveStartPoint(curve)
	tabPT(2) = Rhino.CurveEndPoint(curve)
	tabPT(1) = 	Rhino.PointAdd(Rhino.EvaluateCurve(curve,crvDom(1)*.5),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorRotate(Rhino.VectorCreate(Rhino.EvaluateCurve(curve,crvDom(1)*.4),tabPT(2)),rotVal,wrldCS(3))),scale))
	For i = 0 To 1 Step 1
		tabLN(i) = Rhino.AddLine(tabPT(i),tabPT(i+1))
	Next
	tabMaker = tabLN
End Function
Function labelMaker(curve,title,size,angle,blnAlign)
	labelMaker = Null
	Dim txt, wrldCS
	If Rhino.IsLayer(&quot;numbering&quot;) = False Then
		Call Rhino.AddLayer(&quot;numbering&quot;,RGB(0,255,0))
	End If
	wrldCS = Rhino.WorldXYPlane()
	txt = Rhino.AddText(title,Rhino.CurveMidPoint(curve),size)
	If blnAlign = True Then
		Call Rhino.TextObjectPlane(txt,array(Rhino.CurveMidPoint(curve),Rhino.VectorCreate(Rhino.CurveMidPoint(curve),Rhino.CurveEndPoint(curve)),Rhino.VectorRotate(Rhino.VectorCreate(Rhino.CurveMidPoint(curve),Rhino.CurveEndPoint(curve)),90,wrldCS(3)),wrldCS(3)))
		Call Rhino.RotateObject(txt,Rhino.CurveMidPoint(curve),angle,wrldCS(3))
	End If
	Call Rhino.ObjectLayer(txt,&quot;numbering&quot;)
	labelMaker = txt
End Function
Function reparameterize(strObjectID)
	If Rhino.IsCurve(strObjectID) = True Then
		Call rhino.SelectObject(strObjectID)
		Call rhino.Command(&quot;reparameterize 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
	If Rhino.IsSurface(strObjectID) = True Then
		Call rhino.SelectObject(strObjectID)
		Call rhino.Command(&quot;reparameterize 0 1 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
End Function
Function incenter(ptA,ptB,ptC)
	incenter = Null
	Dim A,B,C
	Dim x,y,z

	A = Rhino.Distance(PtB,ptC)
	B = Rhino.Distance(PtA,ptC)
	C = Rhino.Distance(ptA,ptB)

	x = (ptA(0)*A + ptB(0)*B + ptC(0)*C) / (A + B + C)
	y = (ptA(1)*A + ptB(1)*B + ptC(1)*C) / (A + B + C)
	z = (ptA(2)*A + ptB(2)*B + ptC(2)*C) / (A + B + C)
	incenter = array(x,y,z)
End Function
Function innerEdge(cent,arrPoints,scale)
	innerEdge = Null
	Dim i, count
	count = uBound(arrPoints)
	Dim dist,pt(), edge()
	ReDim pt(count), edge(count)
	For i = 0 To count Step 1
		dist = Rhino.Distance(cent,arrPoints(i))
		pt(i)= Rhino.PointAdd(arrPoints(i),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorCreate(cent,arrPoints(i))),dist*scale))
	Next
	For i = 0 To count Step 1
		If i = 0 Then
			edge(i) = Rhino.AddLine(pt(count),pt(0))
		Else
			edge(i) = Rhino.AddLine(pt(i),pt(i-1))
		End If
	Next

	innerEdge = array(pt, edge)
End Function
Function innerSurf(cent,arrPoints,scale)
	innerSurf = Null
	Dim i, count
	count = uBound(arrPoints)
	Dim dist,pt(), srf()
	ReDim pt(count), srf(count)
	For i = 0 To count Step 1
		dist = Rhino.Distance(cent,arrPoints(i))
		pt(i)= Rhino.PointAdd(arrPoints(i),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorCreate(cent,arrPoints(i))),dist*scale))
	Next
	For i = 0 To count Step 1
		If i = 0 Then
			srf(i) = Rhino.AddSrfPt(array(pt(count),pt(0),arrPoints(0),arrPoints(count)))
		Else
			srf(i) = Rhino.AddSrfPt(array(pt(i),pt(i-1),arrPoints(i-1),arrPoints(i)))
		End If
	Next

	innerSurf = array(pt, srf)
End Function
Function arrImageSample(cols, rows)
	arrImageSample = Null
	'Instantiate the RhPicture Object
	Dim RhPicture : Set RhPicture = Rhino.GetPlugInObject(&quot;RhPicture&quot;)
	If IsNull(RhPicture) Then Exit Function

	'Load an arbitrary image
	If Not RhPicture.LoadImage() Then
		Call Rhino.Print(&quot;Image not loaded&quot;)
		Exit Function
	End If

	'Get the width and height
	Dim w : w = RhPicture.Width()
	Dim h : h = RhPicture.Height()

	If IsNull(w) Or IsNull(h) Then
		Call Rhino.Print(&quot;No valid image data&quot;)
		Exit Function
	End If

	Dim x, y, i,j
	Dim r, g, b, a, hu, s, u
	ReDim r(rows), g(rows), b(rows), a(rows), hu(rows), s(rows), u(rows)
	Dim rValSet, gValSet, bValSet, aValSet, hValSet, sValSet, uValSet
	ReDim rValSet(cols), gValSet(cols), bValSet(cols), aValSet(cols), hValSet(cols), sValSet(cols), uValSet(cols)

	'Sample Image returning all values between zero and one
	For i = 0 To cols Step 1
		For j = 0 To rows Step 1
			x = int(w/cols)*i
			y = int(h/rows)*j

			If x&gt;w Then
				x = w
			End If

			If y&gt;h Then
				y = h
			End If

			r(j) = RhPicture.Red(x,y)/255
			g(j) = RhPicture.Green(x,y)/255
			b(j) = RhPicture.Blue(x,y)/255
			a(j) = RhPicture.Alpha(x,y)/255
			hu(j) = RhPicture.Hue(x,y)/360
			s(j) = RhPicture.Saturation(x,y)
			u(j) = RhPicture.Luminance(x,y)

		Next
		rValSet(i) = r
		gValSet(i) = g
		bValSet(i) = b
		aValSet(i) = a
		hValSet(i) = hu
		sValSet(i) = s
		uValSet(i) = u
	Next
	Set RhPicture = Nothing
	' image outputs (0)red(1)green(2)blue(3)alpha(4)hue(5)saturation(6)luminance
	arrImageSample = array(rValSet,gValSet,bValSet,aValSet,hValSet,sValSet,uValSet)
End Function
Function arrayValue(cols,rows,value)
	arrayValue = Null
	Dim i,j
	ReDim val(rows), arrVal(cols)
	For i = 0 To cols Step 1
		For j = 0 To rows Step 1
			val(j) = value
		Next
		arrVal(i) = val
	Next
	arrayValue = arrVal
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/expanded-surface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ripple Unfold</title>
		<link>http://neoarchaic.net/2010/03/ripple-unfold/</link>
		<comments>http://neoarchaic.net/2010/03/ripple-unfold/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 00:05:20 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=104</guid>
		<description><![CDATA[This fabrication script presents a simple tool to evaluate a surface with a triangular pattern and unfold this pattern in a series of bands. These bands are tabbed an numbered for easy assembly. This script is the first and simplest step in a series of rhinoscripts which will attempt to provide rigid structural skins with a simple triangulation technique.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^104#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_3', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_3'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_ripple_00.jpg' rel='shadowbox[album-104];player=img;' title='fab_ripple_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_ripple_00-128x128.jpg" class="attachment-thumbnail" alt="fab_ripple_00" title="fab_ripple_00" /></a>

				</div>
				
</p>
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<hr />
<p><span style="font-size: smaller; "><span style="font-family: Arial; ">This fabrication script presents a simple tool to evaluate a surface with a triangular pattern and unfold this pattern in a series of bands. These bands are tabbed an numbered for easy assembly. This script is the first and simplest step in a series of rhinoscripts which will attempt to provide rigid structural skins with a simple triangulation technique.</span></span></p>
<hr />
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform:&nbsp;</span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
</p></div>
<p>&nbsp;</p>
</div>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Script copyrighted by &lt;Neoarchaic Design&gt;
'Script version Monday, May 26, 2008 1:43:26 PM

Call Main()
Sub Main()
	Dim surf
	surf = Rhino.GetObject(&quot;select surface&quot;,8)
	If isNull(surf) Then Exit Sub
	Call reparameterize(surf)

	Dim arrItems, arrValues, arrResults
	arrItems = array(&quot;Colums&quot;,&quot;Rows&quot;,&quot;Offset&quot;,&quot;tabHeight&quot;,&quot;ripple&quot;,&quot;cutTemplate&quot;,&quot;surfaces&quot;)
	arrValues= array(20,20,2,1,False,True,True)
	arrResults = Rhino.PropertyListBox (arrItems, arrValues ,,&quot;Volume Parameters&quot;)
	Dim tri
	Call Rhino.EnableRedraw(False)
	tri = TriangulateSurface(surf,CDbl(arrResults(0)),CDbl(arrResults(1)),CDbl(arrResults(2)),array(CBool(arrResults(4))))
	If CBool(arrResults(6)) = True Then
		Call SurfaceMe(tri,RGB(255,0,0))
	End If

	If CBool(arrResults(5)) = True Then
		Call UnfoldMe(tri,CDbl(arrResults(3)))
	End If

	Call Rhino.EnableRedraw(True)

End Sub
Function TriangulateSurface(surface,cols,rows,offset,arrBln)
	TriangulateSurface = Null
	Dim i,j
	Dim uDom,vDom,uStep,vStep
	uDom = Rhino.SurfaceDomain(surface,0)(1): uStep = uDom/cols
	vDom = Rhino.SurfaceDomain(surface,1)(1): VStep = vDom/rows

	ReDim uv(rows),pt(rows),uvSet(cols),ptSet(cols)
	'plot point grid
	For i = 0 To cols Step 1
		For j = 0 To rows Step 1
			uv(j) = array(i*uStep,j*vStep)
			If i Mod(2) Then
				If j Mod(2) Then
					pt(j) = Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),offset))

				Else
					pt(j) = Rhino.EvaluateSurface(surface,uv(j))
				End If
			Else
				If j Mod(2) Then
					pt(j) = Rhino.EvaluateSurface(surface,uv(j))
				Else
					If arrBln(0) = True Then
						pt(j) = Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),-offset))
					Else
						pt(j) = Rhino.PointAdd(Rhino.EvaluateSurface(surface,uv(j)),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.SurfaceNormal(surface,uv(j))),offset))
					End If
				End If
			End If
		Next
		uvSet(i) = uv
		ptSet(i) = pt
	Next
	TriangulateSurface = ptSet
End Function
Function SurfaceMe(ptSet,objClr)
	SurfaceMe = Null
	If Rhino.IsLayer(&quot;surfaces&quot;) = False Then
		Call Rhino.AddLayer(&quot;surfaces&quot;,RGB(0,0,255))
	End If

	Dim i,j
	Dim cols, rows
	cols = uBound(ptSet)
	rows = uBound(ptSet(0))

	Dim srfA(),srfB()
	ReDim srfA(rows-1),srfB(rows-1)
	ReDim s(cols-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			If i Mod(2) Then
				If j Mod(2) Then
					srfA(j) = Rhino.AddSrfPt(array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j)))
					srfB(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j)))
				Else
					srfA(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j)))
					srfB(j) = Rhino.AddSrfPt(array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j)))
				End If
			Else
				If j Mod(2) Then
					srfA(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j),ptSet(i+1)(j+1),ptSet(i)(j)))
					srfB(j) = Rhino.AddSrfPt(array(ptSet(i)(j+1),ptSet(i+1)(j+1),ptSet(i)(j)))
				Else
					srfA(j) = Rhino.AddSrfPt(array(ptSet(i)(j),ptSet(i)(j+1),ptSet(i+1)(j)))
					srfB(j) = Rhino.AddSrfPt(array(ptSet(i+1)(j+1),ptSet(i)(j+1),ptSet(i+1)(j)))
				End If
			End If
			Call Rhino.ObjectColor(srfA(j),objClr)
			Call Rhino.ObjectColor(srfB(j),objClr)
			Call Rhino.ObjectLayer(srfA(j),&quot;surfaces&quot;)
			Call Rhino.ObjectLayer(srfB(j),&quot;surfaces&quot;)
		Next
		s(i) = array(srfA,srfB)
	Next
	SurfaceMe = s
End Function
Function UnfoldMe(ptSet,tabHeight)
	UnfoldMe= Null
	If Rhino.IsLayer(&quot;cuts&quot;) = False Then
		Call Rhino.AddLayer(&quot;cuts&quot;,RGB(255,0,0))
	End If
	If Rhino.IsLayer(&quot;scores&quot;) = False Then
		Call Rhino.AddLayer(&quot;scores&quot;,RGB(0,0,0))
	End If

	Dim i,j,r
	Dim cols, rows, wrldCS
	cols = uBound(ptSet)
	rows = uBound(ptSet(0))
	wrldCS = Rhino.WorldXYPlane()
	Dim oriPt(), angX(), ptA(), ptB(), ptC(),pts(),minX(),maxX(),mn(),mx()
	ReDim oriPt(rows-1), angX(rows-1), ptA(rows-1), ptB(rows-1), ptC(rows-1),minX(rows-1),maxX(rows-1),mn(cols-1),mx(cols-1),pts(cols-1)

	Dim angA(),angB(),angC(),disA(),disB(),disC(),s(),a(),d()
	ReDim angA(rows-1),angB(rows-1),angC(rows-1),disA(rows-1),disB(rows-1),disC(rows-1)
	ReDim a(cols-1), d(cols-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			If i Mod(2) Then
				If j Mod(2) Then
					angA(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j+1)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i)(j),ptSet(i+1)(j))
					disB(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
					disC(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
				Else
					angA(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i+1)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j+1)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i)(j))
					disB(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
					disC(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
				End If
			Else
				If j Mod(2) Then
					angA(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i+1)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j+1)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i)(j))
					disB(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
					disC(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
				Else
					angA(j) = Rhino.angle2(array(ptSet(i)(j),ptSet(i+1)(j)),array(ptSet(i)(j),ptSet(i)(j+1)))(0)
					angB(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j)),array(ptSet(i+1)(j),ptSet(i)(j+1)))(0)
					angC(j) = Rhino.angle2(array(ptSet(i+1)(j),ptSet(i)(j+1)),array(ptSet(i+1)(j),ptSet(i+1)(j+1)))(0)
					disA(j) = Rhino.Distance(ptSet(i)(j),ptSet(i+1)(j))
					disB(j) = Rhino.Distance(ptSet(i)(j),ptSet(i)(j+1))
					disC(j) = Rhino.Distance(ptSet(i+1)(j),ptSet(i+1)(j+1))
				End If
			End If
		Next
		a(i) = array(angA,angB,angC)
		d(i) = array(disA,disB,disC)
	Next

	For i = 0 To cols-1 Step 1
		r=0
		For j = 0 To rows-1 Step 1
			If j = 0 Then
				oriPt(j) = array(0,0,0)
				angX(j) = 0
			Else
				oriPt(j) = ptB(j-1)
				If ptB(j-1)(1) &gt; ptC(j-1)(1) Then
					angX(j) = -Rhino.Angle2(array(ptB(j-1),Rhino.PointAdd(ptB(j-1),wrldCS(1))),array(ptB(j-1),ptC(j-1)))(0)
				Else
					angX(j) = Rhino.Angle2(array(ptB(j-1),Rhino.PointAdd(ptB(j-1),wrldCS(1))),array(ptB(j-1),ptC(j-1)))(0)
				End If
			End If
			If i Mod(2) Then
				r = j+1
			Else
				r = j
			End If
			If r Mod(2) Then
				ptA(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j),wrldCS(3)),d(i)(0)(j)))
				ptB(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+a(i)(1)(j)+a(i)(2)(j),wrldCS(3)),d(i)(2)(j)))
				ptC(j) = Rhino.PointAdd(ptA(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+180-a(i)(0)(j),wrldCS(3)),d(i)(1)(j)))
			Else
				ptA(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j),wrldCS(3)),d(i)(0)(j)))
				ptB(j) = Rhino.PointAdd(oriPt(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+a(i)(0)(j),wrldCS(3)),d(i)(1)(j)))
				ptC(j) = Rhino.PointAdd(ptA(j),Rhino.VectorScale(Rhino.VectorRotate(wrldCS(1),angX(j)+180-a(i)(1)(j)-a(i)(2)(j),wrldCS(3)),d(i)(2)(j)))
			End If
			minX(j) = Rhino.Min(array(ptA(j)(0),ptB(j)(0),ptC(j)(0)))
			maxX(j) = Rhino.Max(array(ptA(j)(0),ptB(j)(0),ptC(j)(0)))
			r=r+1
		Next
		mn(i) = Rhino.Min(minX)
		If mn(i) &gt; 0 Then
			mn(i) = 0
		Else
			mn(i) = abs(mn(i))
		End If
		mx(i) = abs(Rhino.Max(maxX))
		pts(i) = array(oriPt,ptA,ptB,ptC)
	Next
	Dim ptX, k
	Dim edge(),edgeA(), edgeB(), span()
	ReDim edge(cols-1),edgeA(rows-1), edgeB(rows-1), span(rows*2)
	r=0
	For i = 0 To cols-1 Step 1
		k=0
		If i &gt; 0 Then
			r = r+mx(i-1)+mn(i)+tabHeight*2
		End If
		For j = 0 To rows-1 Step 1
			ptX	= array(r,0,0)
			If j Mod(2) Then
				span(k) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(0)(j)),Rhino.PointAdd(ptX,pts(i)(3)(j)))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			Else
				span(k) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(1)(j)),Rhino.PointAdd(ptX,pts(i)(2)(j)))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			End If
			If j = 0 Then
				span(k) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(0)(j)),Rhino.PointAdd(ptX,pts(i)(1)(j)))
				Call Rhino.ObjectLayer(span(k),&quot;cuts&quot;)
				k=k+1
			End If
			If j = rows-1 Then
				span(k) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(2)(j)),Rhino.PointAdd(ptX,pts(i)(3)(j)))
				Call Rhino.ObjectLayer(span(k),&quot;cuts&quot;)
				k=k+1
			Else
				span(k) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(2)(j)),Rhino.PointAdd(ptX,pts(i)(3)(j)))
				Call Rhino.ObjectLayer(span(k),&quot;scores&quot;)
				k=k+1
			End If
			edgeA(j) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(0)(j)),Rhino.PointAdd(ptX,pts(i)(2)(j)))
			Call Rhino.ObjectLayer(edgeA(j),&quot;scores&quot;)
			edgeB(j) = Rhino.AddLine(Rhino.PointAdd(ptX,pts(i)(1)(j)),Rhino.PointAdd(ptX,pts(i)(3)(j)))
			Call Rhino.ObjectLayer(edgeB(j),&quot;scores&quot;)
		Next
		edge(i) = array(edgeA,edgeB)
	Next

	Dim tabA(), tabB(), lblA(), lblB()
	ReDim tabA(rows-1), tabB(rows-1), lblA(rows-1), lblB(rows-1)
	For i = 0 To cols-1 Step 1
		For j = 0 To rows-1 Step 1
			tabA(j) = tabMaker(edge(i)(0)(j),-90,tabHeight)
			tabB(j) = tabMaker(edge(i)(1)(j),90,tabHeight)
			Call Rhino.ObjectLayer(tabA(j),&quot;cuts&quot;)
			Call Rhino.ObjectLayer(tabB(j),&quot;cuts&quot;)

			If i = cols-1 Then
				lblB(j) = labelMaker(edge(i)(1)(j),cols-1 &amp; &quot;.&quot; &amp; j,tabHeight*.25,0,True)
			Else
				lblB(j) = labelMaker(edge(i)(1)(j),i+1 &amp; &quot;.&quot; &amp; j,tabHeight*.25,0,True)
			End If
			lblA(j) = labelMaker(edge(i)(0)(j),i &amp; &quot;.&quot; &amp; j,tabHeight*.25,180,True)
	Next
	Next
End Function
Function tabMaker(curve,rotVal,scale)
	tabMaker = Null
	Dim tabLN(1), tabPT(2),crvDom, wrldCS, i
	crvDom = Rhino.CurveDomain(curve)
	wrldCS = Rhino.WorldXYPlane()
	tabPT(0) = Rhino.CurveStartPoint(curve)
	tabPT(2) = Rhino.CurveEndPoint(curve)
	tabPT(1) = 	Rhino.PointAdd(Rhino.EvaluateCurve(curve,crvDom(1)*.5),Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorRotate(Rhino.VectorCreate(Rhino.EvaluateCurve(curve,crvDom(1)*.4),tabPT(2)),rotVal,wrldCS(3))),scale))
	For i = 0 To 1 Step 1
		tabLN(i) = Rhino.AddLine(tabPT(i),tabPT(i+1))
	Next
	tabMaker = tabLN
End Function
Function labelMaker(curve,title,size,angle,blnAlign)
	labelMaker = Null
	Dim txt, wrldCS
	If Rhino.IsLayer(&quot;numbering&quot;) = False Then
		Call Rhino.AddLayer(&quot;numbering&quot;,RGB(0,255,0))
	End If
	wrldCS = Rhino.WorldXYPlane()
	txt = Rhino.AddText(title,Rhino.CurveMidPoint(curve),size)
	If blnAlign = True Then
		Call Rhino.TextObjectPlane(txt,array(Rhino.CurveMidPoint(curve),Rhino.VectorCreate(Rhino.CurveMidPoint(curve),Rhino.CurveEndPoint(curve)),Rhino.VectorRotate(Rhino.VectorCreate(Rhino.CurveMidPoint(curve),Rhino.CurveEndPoint(curve)),90,wrldCS(3)),wrldCS(3)))
		Call Rhino.RotateObject(txt,Rhino.CurveMidPoint(curve),angle,wrldCS(3))
	End If
	Call Rhino.ObjectLayer(txt,&quot;numbering&quot;)
	labelMaker = txt
End Function
Function reparameterize(strObjectID)
	If Rhino.IsCurve(strObjectID) = True Then
		Call rhino.SelectObject(strObjectID)
		Call rhino.Command(&quot;reparameterize 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
	If Rhino.IsSurface(strObjectID) = True Then
		Call rhino.SelectObject(strObjectID)
		Call rhino.Command(&quot;reparameterize 0 1 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/ripple-unfold/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Triangulate Strips</title>
		<link>http://neoarchaic.net/2010/03/triangulate-strips/</link>
		<comments>http://neoarchaic.net/2010/03/triangulate-strips/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 00:01:11 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=100</guid>
		<description><![CDATA[This simple triangulation fabrication script takes a single surface and evaluates it at a user specified density.  The script then creates a flattened set of strip templates for printing/lasercutting which are numbered for easy assembly.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^100#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_4', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_4'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_strips_00.jpg' rel='shadowbox[album-100];player=img;' title='fab_strips_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_strips_00-128x128.jpg" class="attachment-thumbnail" alt="fab_strips_00" title="fab_strips_00" /></a>

				</div>
				
</p>
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<hr />
<p><span style="font-size: smaller; "><span style="font-family: Arial; ">This simple triangulation fabrication script takes a single surface and evaluates it at a user specified density. &nbsp;The script then creates a flattened set of strip templates for printing/lasercutting which are numbered for easy assembly.</span></span></p>
<hr />
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform:&nbsp;</span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
</div>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Script copyrighted by &lt;Neoarchaic Studio&gt;
'Script version Saturday, March 07, 2009 6:11:13 PM

Call Main()
Sub Main()
	Dim surface, arrValue
	Dim cols, rows, dept, spac
	surface = Rhino.GetObject(&quot;Select Surface&quot;,8,True)
	If isnull(surface) Then Exit Sub

	arrValue = Rhino.PropertyListBox(array(&quot;Columns&quot;,&quot;Rows&quot;,&quot;TabHeight&quot;,&quot;Spacing&quot;),array(10,10,2,2),&quot;Surface Parameters&quot;,&quot;Input Parameters&quot;)
	If isNull(arrValue) Then Exit Sub

	cols = CDbl(arrValue(0))
	rows = CDbl(arrValue(1))
	dept = CDbl(arrValue(2))
	spac = CDbl(arrValue(3))

	Call reparameterize(surface)
	Call Rhino.EnableRedraw(False)

	Dim triangles, cuts, tile, tabs, tri, strip
	triangles = triangulate(surface,cols,rows)
	cuts = reOrient(triangles)
	tri = drawTriangle(triangles)
	strip = makeStrips(cuts)
	tile = tileObject(strip, spac+dept)

	Dim i,j,k,r,s,t
	For i = 0 To ubound(triangles) Step 1
		r = 0
		s = 0
		For j = 0 To ubound(triangles(i)) Step 1
			If j Mod(2) Then
				s = s+1
				t = i+1
				If j &gt; 0 Then
					Call Rhino.DeleteObject(cuts(i)(j)(0))
				End If
				If j&lt;ubound(triangles(i)) Then
					Call Rhino.ObjectColor(cuts(i)(j)(1),RGB(255,0,0))
				End If
			Else
				r = r+1
				t = i
				If j &gt; 0 Then
					Call Rhino.DeleteObject(cuts(i)(j)(1))
				End If
				Call Rhino.ObjectColor(cuts(i)(j)(0),RGB(255,0,0))
			End If

			tabs = tabmaker(cuts(i)(j)(2),dept,CStr(&quot;2.&quot; &amp; i &amp; &quot;.&quot; &amp; r))
			Call labelEdge(tri(i)(j)(2),CStr(&quot;2.&quot; &amp; t &amp; &quot;.&quot; &amp; r))
			Call Rhino.ObjectColor(cuts(i)(j)(2),RGB(255,0,0))
			Call Rhino.AddSrfPt(triangles(i)(j))
		Next
	Next

	Call Rhino.EnableRedraw(True)

End Sub
Function drawTriangle(arrPoints)
	drawTriangle = Null
	Dim i,j,k
	Dim curve(), arrOutput(),crv(2)
	ReDim curve(ubound(arrPoints(0))), arrOutput(ubound(arrPoints))
	For i = 0 To ubound(arrPoints) Step 1
		For j = 0 To ubound(arrPoints(i)) Step 1
			For k = 0 To 2 Step 1
				crv(k) = Rhino.AddLine(arrPoints(i)(j)(k),arrPoints(i)(j)(k+1))
			Next
			curve(j) = crv
		Next
		arrOutput(i) = curve
	Next

	drawTriangle = arrOutput
End Function
Function reOrient(arrPoints)
	reOrient = Null
	Dim i,j,k
	Dim cPlane, wplane
	Dim curve(), arrOutput(),crv(2)
	ReDim curve(ubound(arrPoints(0))), arrOutput(ubound(arrPoints))
	For i = 0 To ubound(arrPoints) Step 1
		For j = 0 To ubound(arrPoints(i)) Step 1
			For k = 0 To 2 Step 1
				crv(k) = Rhino.AddLine(arrPoints(i)(j)(k),arrPoints(i)(j)(k+1))
				Call Rhino.OrientObject(crv(k),array(arrPoints(i)(j)(0),arrPoints(i)(j)(1),arrPoints(i)(j)(2)),array(array(0,0,0),array(1,0,0),array(0,1,0)))
			Next
			curve(j) = crv
		Next
		arrOutput(i) = curve
	Next

	reOrient = arrOutput
End Function
Function makeStrips(arrObjects)
	makeStrips = Null
	Dim arrOutput(), arrVal()
	ReDim arrOutput(ubound(arrObjects))
	Dim i,j,k,r
	Dim ptA(2), ptB(2)
	For i = 0 To ubound(arrObjects) Step 1
		r=0
		ReDim arrVal(r)
		For j = 0 To ubound(arrObjects(i))-1 Step 1
			If j Mod(2) Then
				ptA(0) = Rhino.CurveStartPoint(arrObjects(i)(j+1)(1))
				ptA(1) = Rhino.CurveEndPoint(arrObjects(i)(j+1)(1))
				ptA(2) = array(ptA(0)(0),ptA(0)(1),ptA(0)(2)+1)

				ptB(0) = Rhino.CurveEndPoint(arrObjects(i)(j)(1))
				ptB(1) = Rhino.CurveStartPoint(arrObjects(i)(j)(1))
				ptB(2) = array(ptB(0)(0),ptB(0)(1),ptB(0)(2)+1)
			Else
				ptA(0) = Rhino.CurveStartPoint(arrObjects(i)(j+1)(0))
				ptA(1) = Rhino.CurveEndPoint(arrObjects(i)(j+1)(0))
				ptA(2) = array(ptA(0)(0),ptA(0)(1),ptA(0)(2)+1)

				ptB(0) = Rhino.CurveEndPoint(arrObjects(i)(j)(0))
				ptB(1) = Rhino.CurveStartPoint(arrObjects(i)(j)(0))
				ptB(2) = array(ptB(0)(0),ptB(0)(1),ptB(0)(2)+1)
			End If

			Call Rhino.OrientObjects(arrObjects(i)(j+1),ptA,ptB)
			If j = 0 Then
				For k = 0 To ubound(arrObjects(i)(j)) Step 1
					ReDim Preserve arrVal(r)
					arrVal(r) = arrObjects(i)(j)(k)
					r = r+1
				Next
			End If
			For k = 0 To ubound(arrObjects(i)(j+1)) Step 1
				ReDim Preserve arrVal(r)
				arrVal(r) = arrObjects(i)(j+1)(k)
				r = r+1
			Next
		Next
		arrOutput(i) = arrVal
	Next
	makeStrips = arrOutput
End Function
Function tabMaker(curve,depth,text)
	tabMaker = Null
	Dim arrOutput, pt(3), txt
	pt(0) = Rhino.CurveMidPoint(curve)
	pt(1) = Rhino.CurveStartPoint(curve)
	pt(2) = Rhino.CurveEndPoint(curve)
	pt(3) = Rhino.PointAdd(pt(0),Rhino.VectorRotate(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorCreate(pt(1),pt(2))),depth),90,Rhino.WorldXYPlane()(3)))
	arrOutput = Rhino.AddPolyline(array(pt(1),pt(3),pt(2)))
	txt = Rhino.AddText(text,pt(0),depth*0.3)
	Call Rhino.ObjectColor(txt,RGB(0,255,0))
	Call Rhino.OrientObject(txt,array(pt(0),array(pt(0)(0)+1,pt(0)(1),pt(0)(2)),array(pt(0)(0),pt(0)(1)+1,pt(0)(2))),array(pt(0),pt(1),pt(3)))
	tabMaker = arrOutput
End Function
Function labelEdge(curve,text)
	labelEdge = Null
	Dim arrOutput, pt
	pt = Rhino.CurveMidPoint(curve)
	arrOutput = Rhino.AddTextDot(text,pt)
	labelEdge = arrOutput
End Function
Function tileObject(arrObjects, spacing)
	tileObject = Null
	Dim arrOutput(), arrVal()
	ReDim arrOutput(ubound(arrObjects)), arrVal(ubound(arrObjects(0)))
	Dim i,s
	Dim bBox, pt()
	ReDim pt(ubound(arrObjects))
	s=0
	For i = 0 To uBound(arrObjects) Step 1
		bBox = Rhino.BoundingBox(arrObjects(i))
		If i &gt; 0 Then
			arrOutput(i) = Rhino.MoveObjects(arrObjects(i),bBox(0),pt(i-1))
		Else
			arrOutput(i) = Rhino.MoveObjects(arrObjects(i),bBox(0),bBox(0))
		End If
		bBox = Rhino.BoundingBox(arrObjects(i))
		pt(i) = array(bBox(1)(0)+spacing,bBox(1)(1),bBox(1)(2))
	Next

	tileObject = arrOutput
End Function
Function triangulate(surface,cols,rows)
	triangulate = Null
	Dim arrOutput(), arrVal(), tVal(3), iStep, jStep
	ReDim arrOutput(rows-1), arrVal(cols*2-1)
	Dim i,j,r

	iStep = Rhino.SurfaceDomain(surface,0)(1)/rows
	jStep = Rhino.SurfaceDomain(surface,1)(1)/cols

	For i = 0 To rows-1 Step 1
		r=0
		For j = 0 To cols-1 Step 1
			tval(0) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*(j+1)))
			tval(1) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*j))
			tval(2) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*j))
			tval(3) = tval(0)

			arrVal(r) = tval

			tval(0) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*j))
			tval(1) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*(j+1)))
			tval(2) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*(j+1)))
			tval(3) = tval(0)
			arrVal(r+1) = tval

			r=r+2
		Next
		arrOutput(i) = arrVal
	Next

	triangulate = arrOutput
End Function
Function reparameterize(strCurveID)
	If Rhino.IsCurve(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
	If Rhino.IsSurface(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/triangulate-strips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Triangulate Tile</title>
		<link>http://neoarchaic.net/2010/03/triangulate-tile/</link>
		<comments>http://neoarchaic.net/2010/03/triangulate-tile/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 23:58:46 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=95</guid>
		<description><![CDATA[This simple triangulation fabrication script evaluates a surface and creates a tiled set of triangulated pieces with incrementally numbered tabs. To assemble, simply combine tabs with matching numbers… and your done.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center; ">
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^95#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_5', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_5'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_tiles_00.jpg' rel='shadowbox[album-95];player=img;' title='fab_tiles_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_tiles_00-128x128.jpg" class="attachment-thumbnail" alt="fab_tiles_00" title="fab_tiles_00" /></a>
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_tiles_01.jpg' rel='shadowbox[album-95];player=img;' title='unit'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_tiles_01-128x128.jpg" class="attachment-thumbnail" alt="unit" title="unit" /></a>

				</div>
				
</p>
<hr />
<p><span style="font-size: smaller; "><span style="font-family: Arial; ">This simple triangulation fabrication script evaluates a surface and creates a tiled set of triangulated pieces with incrementally numbered tabs. To assemble, simply combine tabs with matching numbers&hellip; and your done.</span></span></p>
<hr />
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform: </span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Script copyrighted by &lt;Neoarchaic Studio&gt;
'Script version Saturday, March 07, 2009 6:11:13 PM

Call Main()
Sub Main()
	Dim surface, arrValue
	Dim cols, rows, dept, spac
	surface = Rhino.GetObject(&quot;Select Surface&quot;,8,True)
	If isnull(surface) Then Exit Sub

	arrValue = Rhino.PropertyListBox(array(&quot;Columns&quot;,&quot;Rows&quot;,&quot;TabHeight&quot;,&quot;Spacing&quot;),array(10,10,2,2),&quot;Surface Parameters&quot;,&quot;Input Parameters&quot;)
	If isNull(arrValue) Then Exit Sub

	cols = CDbl(arrValue(0))
	rows = CDbl(arrValue(1))
	dept = CDbl(arrValue(2))
	spac = CDbl(arrValue(3))

	Call reparameterize(surface)
	Call Rhino.EnableRedraw(False)

	Dim triangles, cuts, tile, tabs,tri
	triangles = triangulate(surface,cols,rows)
	cuts = reOrient(triangles)
	tile = tileObjects(cuts, spac+dept)
	tri = drawTriangle(triangles)

	Dim i,j,k,r,s,t
	For i = 0 To ubound(triangles) Step 1
		r = 0
		s = 0
		For j = 0 To ubound(triangles(i)) Step 1
			If j Mod(2) Then
				s = s+1
				t = i+1
			Else
				r = r+1
				t = i
			End If
			tabs = tabmaker(tile(i)(j)(0),dept,CStr(i &amp; &quot;.&quot; &amp; &quot;0.&quot; &amp; r))
			Call labelEdge(tri(i)(j)(0),CStr(i &amp; &quot;.&quot; &amp; &quot;0.&quot; &amp; r))

			tabs = tabmaker(tile(i)(j)(1),dept,CStr(i &amp; &quot;.&quot; &amp; &quot;1.&quot; &amp;  s))
			Call labelEdge(tri(i)(j)(1),CStr(i &amp; &quot;.&quot; &amp; &quot;1.&quot; &amp;  s))

			tabs = tabmaker(tile(i)(j)(2),dept,CStr(&quot;2.&quot; &amp; i &amp; &quot;.&quot; &amp; r))
			Call labelEdge(tri(i)(j)(2),CStr(&quot;2.&quot; &amp; t &amp; &quot;.&quot; &amp; r))
			Call Rhino.AddSrfPt(triangles(i)(j))
		Next
	Next
	Call Rhino.EnableRedraw(True)

End Sub
Function drawTriangle(arrPoints)
	drawTriangle = Null
	Dim i,j,k
	Dim curve(), arrOutput(),crv(2)
	ReDim curve(ubound(arrPoints(0))), arrOutput(ubound(arrPoints))
	For i = 0 To ubound(arrPoints) Step 1
		For j = 0 To ubound(arrPoints(i)) Step 1
			For k = 0 To 2 Step 1
				crv(k) = Rhino.AddLine(arrPoints(i)(j)(k),arrPoints(i)(j)(k+1))
			Next
			curve(j) = crv
		Next
		arrOutput(i) = curve
	Next

	drawTriangle = arrOutput
End Function
Function reOrient(arrPoints)
	reOrient = Null
	Dim i,j,k
	Dim cPlane, wplane
	Dim curve(), arrOutput(),crv(2)
	ReDim curve(ubound(arrPoints(0))), arrOutput(ubound(arrPoints))
	For i = 0 To ubound(arrPoints) Step 1
		For j = 0 To ubound(arrPoints(i)) Step 1
			For k = 0 To 2 Step 1
				crv(k) = Rhino.AddLine(arrPoints(i)(j)(k),arrPoints(i)(j)(k+1))
				Call Rhino.ObjectColor(crv(k),RGB(255,0,0))
				Call Rhino.OrientObject(crv(k),array(arrPoints(i)(j)(0),arrPoints(i)(j)(1),arrPoints(i)(j)(2)),array(array(0,0,0),array(1,0,0),array(0,1,0)))
			Next
			curve(j) = crv
		Next
		arrOutput(i) = curve
	Next

	reOrient = arrOutput
End Function
Function tabMaker(curve,depth,text)
	tabMaker = Null
	Dim arrOutput, pt(3), txt
	pt(0) = Rhino.CurveMidPoint(curve)
	pt(1) = Rhino.CurveStartPoint(curve)
	pt(2) = Rhino.CurveEndPoint(curve)
	pt(3) = Rhino.PointAdd(pt(0),Rhino.VectorRotate(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorCreate(pt(1),pt(2))),depth),90,Rhino.WorldXYPlane()(3)))
	arrOutput = Rhino.AddPolyline(array(pt(1),pt(3),pt(2)))
	txt = Rhino.AddText(text,pt(0),depth*0.3)
	Call Rhino.ObjectColor(txt,RGB(0,255,0))
	Call Rhino.OrientObject(txt,array(pt(0),array(pt(0)(0)+1,pt(0)(1),pt(0)(2)),array(pt(0)(0),pt(0)(1)+1,pt(0)(2))),array(pt(0),pt(1),pt(3)))
	tabMaker = arrOutput
End Function
Function labelEdge(curve,text)
	labelEdge = Null
	Dim arrOutput, pt
	pt = Rhino.CurveMidPoint(curve)
	arrOutput = Rhino.AddTextDot(text,pt)
	labelEdge = arrOutput
End Function
Function tileObjects(arrObjects, spacing)
	tileObjects = Null
	Dim arrOutput(), arrVal()
	ReDim arrOutput(ubound(arrObjects)), arrVal(ubound(arrObjects(0)))
	Dim i,j,r,s
	Dim bBox, xDis(), yDis(), maxVal
	ReDim xDis(ubound(arrObjects(0))),yDis(ubound(arrObjects(0)))
	r = 0
	For i = 0 To uBound(arrObjects) Step 1
		r = r+maxVal+spacing
		s = 0
		For j = 0 To uBound(arrObjects(i)) Step 1
			bBox = Rhino.BoundingBox(arrObjects(i)(j))
			xDis(j) = Rhino.Distance(bBox(0),bBox(1))
			yDis(j) = Rhino.Distance(bBox(0),bBox(3))
			If j &gt; 0 Then
				s = s+yDis(j-1)+spacing
			End If
			arrVal(j) = Rhino.MoveObjects(arrObjects(i)(j),array(0,0,0),array(r,s,0))
		Next
		maxVal = Rhino.Max(xDis)
		arrOutput(i) = arrVal
	Next

	tileObjects = arrOutput
End Function
Function triangulate(surface,cols,rows)
	triangulate = Null
	Dim arrOutput(), arrVal(), tVal(3), iStep, jStep
	ReDim arrOutput(rows-1), arrVal(cols*2-1)
	Dim i,j,r

	iStep = Rhino.SurfaceDomain(surface,0)(1)/rows
	jStep = Rhino.SurfaceDomain(surface,1)(1)/cols

	For i = 0 To rows-1 Step 1
		r=0
		For j = 0 To cols-1 Step 1
			tval(0) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*(j+1)))
			tval(1) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*j))
			tval(2) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*j))
			tval(3) = tval(0)

			arrVal(r) = tval

			tval(0) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*j))
			tval(1) = Rhino.EvaluateSurface(surface,array(iStep*i,jStep*(j+1)))
			tval(2) = Rhino.EvaluateSurface(surface,array(iStep*(i+1),jStep*(j+1)))
			tval(3) = tval(0)
			arrVal(r+1) = tval

			r=r+2
		Next
		arrOutput(i) = arrVal
	Next

	triangulate = arrOutput
End Function
Function reparameterize(strCurveID)
	If Rhino.IsCurve(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
	If Rhino.IsSurface(strCurveID) = True Then
		Call rhino.SelectObject(strCurveID)
		Call rhino.Command(&quot;reparameterize 0 1 0 1&quot;)
		Call rhino.UnselectAllObjects()
	End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/triangulate-tile/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Triangulate 3 Pack</title>
		<link>http://neoarchaic.net/2010/03/triangulate-3-pack/</link>
		<comments>http://neoarchaic.net/2010/03/triangulate-3-pack/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 20:26:05 +0000</pubDate>
		<dc:creator>David Mans</dc:creator>
				<category><![CDATA[Fabrication Scripts]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Rhinoscripts]]></category>
		<category><![CDATA[Rhinoscript]]></category>

		<guid isPermaLink="false">http://neoarchaic.net/?p=16</guid>
		<description><![CDATA[This Rhino Script triangulates a surface with three pattern options
Pattern Types:
[A][A] &#124; [A][B] &#124; [A][B]
[A][A] &#124; [A][B] &#124; [B][A]
typ.0 _typ.1 _typ.2
]]></description>
			<content:encoded><![CDATA[<p>&nbsp;&nbsp;
				<script type='text/javascript'>
					var flashvars = {};
					flashvars.file = 'http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/getxml.php?attr=id^16#';
					
					flashvars.rotatetime = '3';
					flashvars.autostart = 'true';
					flashvars.backcolor = '0xffffff';
					flashvars.frontcolor = '0xffffff';
					flashvars.lightcolor = '0xffffff';
					flashvars.screencolor = '0xffffff';
					flashvars.screenalpha = 'false'
					flashvars.logo = '';
					flashvars.transition = 'fade';
					flashvars.shuffle = 'false';
					flashvars.overstretch = 'false';
					flashvars.shownavigation = 'false';
					flashvars.height = '300';
					flashvars.width = '590';
					var params = {};
					params.allowFullScreen = 'true';
					params.wmode = 'transparent';
					params.menu = 'false';
					var attributes = {};
					swfobject.embedSWF ('http://neoarchaic.net/wp-content/plugins/wordpress-gallery-slideshow/org/myplugins/slideshow/imagerotator.swf', 'slideshow_6', '590', '300', '9.0.0', false, flashvars, params, attributes);
				</script>
				<div class='slideshow' id='slideshow_6'>
					
<a href='http://neoarchaic.net/wp-content/uploads/2010/03/fab_trithree_00.jpg' rel='shadowbox[album-16];player=img;' title='fab_trithree_00'><img width="128" height="128" src="http://neoarchaic.net/wp-content/uploads/2010/03/fab_trithree_00-128x128.jpg" class="attachment-thumbnail" alt="fab_trithree_00" title="fab_trithree_00" /></a>

				</div>
				
</p>
<hr />
<p>&nbsp;</p>
<p>This Rhino Script triangulates a surface with three pattern options</p>
<p>Pattern Types:</p>
<p>[A][A] | [A][B] | [A][B]</p>
<p>[A][A] | [A][B] | [B][A]</p>
<p>typ.0 _typ.1 _typ.2</p>
<p>This version of the script lays out the resulting triangular faces in a tiled grid with numbered tabs which allow for rapid reconstruction. To assemble simply match up tab numbers.</p>
<p>&nbsp;</p>
<hr />
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<div style="background-color: rgb(255, 255, 255); padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; ">
<table align="left" border="1" cellpadding="1" cellspacing="1" width="500">
<tbody>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">platform:&nbsp;</span></span><span style="font-family: Arial; "><span style="font-size: small; ">Rhino Script</span></span></td>
</tr>
<tr>
<td style="font-family: Arial, Verdana, sans-serif; font-size: 12px; "><span style="font-family: Arial; "><span style="font-size: xx-small; ">function:&nbsp;</span>Fabrication</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>
</p></div>
<p>&nbsp;</p>
</div>
<pre class="brush: vb; title: Copy Code From Below; notranslate">
Option Explicit
'Script written by &lt;David Mans&gt;
'Script copyrighted by &lt;NeoArchaic Studio&gt;
'Script version Monday, March 23, 2009 11:03:52 AM

Call Main()
Sub Main()
	Dim surface
	surface = Rhino.GetObject(&quot;Select Surface&quot;,8,True)
	If isnull(surface) Then Exit Sub

	Dim arrValue, cols, rows, spacing, height, typ
	typ = Rhino.GetInteger(&quot;Select Triangulation Type&quot;,0,0,2)
	If isNull(typ) Then Exit Sub

	arrValue = Rhino.PropertyListBox(array(&quot;Columns&quot;,&quot;Rows&quot;,&quot;Tile Spacing&quot;,&quot;tabHeight&quot;),array(10,10,1,0.5))
	If isNull(arrValue) Then Exit Sub

	cols = CDbl(arrValue(0))
	rows = CDbl(arrValue(1))
	spacing = CDbl(arrValue(2))
	height = CDbl(arrValue(3))

	Dim i,j,k,r,s,t
	Dim arrVals
	Dim grid,sort,edge,surf,tri(3),outline(3)

	Call Rhino.EnableRedraw(False)
	grid = arrEvalSrf(surface, cols, rows)

	arrVals = array(array(0,0,1,1,1,0),array(1,1,0,0,0,1),array(1,0,0,1,0,0),array(0,1,1,0,1,1))

	For i = 0 To 3 Step 1
		tri(i) = triangulate(surface, grid, arrVals(i))
		If i &lt; 2 Then
			outline(i) = flatten(tri(i),True)
		Else
			outline(i) = flatten(tri(i),False)
		End If
	Next
	sort = sortTriangles(outline,typ)
	surf = sortTriangles(tri,typ)

	edge = drawTriangle(sort)

	Call tileObjects(edge,spacing+height)

	Dim blnDir

	For i = 0 To uBound(edge) Step 1
		r=0
		s=0
		For j = 0 To uBound(edge(i)) Step 1
			If j Mod(2) Then: s=s+1: t=i : Else: r=r+1: t=i+1: End If

			If typ = 0 Then
				blnDir = False
			Else
				If r Mod(2) Then
					If typ = 2 And i Mod(2) Then: blnDir = True: Else: blnDir = False: End If
				Else
					If typ = 2 And i Mod(2) Then: blnDir = False: Else: blnDir = True: End If
				End If
			End If

			Call tabMaker(edge(i)(j)(0),height,i &amp; &quot;.&quot; &amp; r &amp; &quot;.&quot; &amp; 0,blnDir)
			Call tabMaker(edge(i)(j)(1),height,i &amp; &quot;.&quot; &amp; t &amp; &quot;.&quot; &amp; 1,blnDir)
			Call tabMaker(edge(i)(j)(2),height,i &amp; &quot;.&quot; &amp; s &amp; &quot;.&quot; &amp; 2,blnDir)
			Call Rhino.addsrfpt(surf(i)(j))
		Next
	Next
	Call Rhino.EnableRedraw(True)
End Sub
Function arrEvalSrf(surface, cols, rows)
	arrEvalSrf = Null
	Dim i,j
	Dim pt(), arrOutput(), dom(1), stp(1)
	ReDim pt(rows), arrOutput(cols)

	dom(0) = Rhino.SurfaceDomain(surface,0)
	dom(1) = Rhino.SurfaceDomain(surface,1)

	stp(0) = (dom(0)(1)-dom(0)(0))/cols
	stp(1) = (dom(1)(1)-dom(1)(0))/rows

	For i = 0 To cols Step 1
		For j = 0 To rows Step 1
			pt(j) = Rhino.EvaluateSurface(surface,array(dom(0)(0)+stp(0)*i,dom(1)(0)+stp(1)*j))
		Next
		arrOutput(i) = pt
	Next

	arrEvalSrf = arrOutput
End Function
Function triangulate(surface, arrPoints, arrValues)
	triangulate = Null
	Dim i,j,k,r, cols, rows
	Dim pts(), arrOutput(), pt(3), maxVal(1)

	maxVal(0) = Rhino.Max(array(arrValues(0),arrValues(2),arrValues(4)))
	maxVal(1) = Rhino.Max(array(arrValues(1),arrValues(3),arrValues(5)))

	cols = ubound(arrPoints)-maxVal(0)

	ReDim arrOutput(cols)

	For i = 0 To cols Step 1
		rows = ubound(arrPoints(i))-maxVal(1)
		ReDim pts(rows)
		For j = 0 To rows Step 1
			r=0
			For k = 0 To 2 Step 1
				pt(k) = arrPoints(i+arrValues(r))(j+arrValues(r+1))
				r=r+2
			Next
			pt(3) = pt(0)
			pts(j) = pt
			'Call Rhino.AddPolyline(pts(j))
		Next
		arrOutput(i) = pts
	Next

	triangulate = arrOutput
End Function
Function flatten(arrPoints,blnUp)
	flatten = Null
	Dim i,j,k, cols, rows
	Dim pts(), arrOutput(), tPts(3), pt(3), temp
	cols = uBound(arrPoints)
	ReDim arrOutput(cols)

	For i = 0 To cols Step 1
		rows = ubound(arrPoints(i))
		ReDim pts(rows)
		For j = 0 To rows Step 1
			For k = 0 To 3 Step 1
				tPts(k) = Rhino.AddPoint(arrPoints(i)(j)(k))
			Next
			temp = Rhino.OrientObjects(tPts,array(arrPoints(i)(j)(0),arrPoints(i)(j)(1),arrPoints(i)(j)(2)), array(array(0,0,0),array(1,0,0),array(0,1,0)))
			If blnUp = True Then
				Call Rhino.RotateObjects(temp,array(0,0,0),180,Rhino.WorldXYPlane()(2),False)
			End If

			For k = 0 To 3 Step 1
				Pt(k) = Rhino.PointCoordinates(temp(k))
				Call Rhino.DeleteObject(temp(k))
			Next
			pts(j) = pt
		Next
		arrOutput(i) = pts
	Next

	flatten = arrOutput
End Function
Function drawTriangle(arrPoints)
	drawTriangle = Null
	Dim i,j,k, cols, rows
	Dim arrTemp(), arrOutput(),lines(2)
	cols = uBound(arrPoints)
	ReDim arrOutput(cols)

	For i = 0 To cols Step 1
		rows = ubound(arrPoints(i))
		ReDim arrTemp(rows)
		For j = 0 To rows Step 1
			For k = 0 To 2 Step 1
				lines(k) = Rhino.AddLine(arrPoints(i)(j)(k),arrPoints(i)(j)(k+1))
			Next
			Call Rhino.ObjectColor(lines,RGB(255,0,0))
			arrTemp(j) = lines
		Next
		arrOutput(i) = arrTemp
	Next

	drawTriangle = arrOutput
End Function
Function sortTriangles(arrSet,blnType)
	sortTriangles = Null
	Dim i,j,k,r,a,b, cols, rows
	Dim arrTemp(), arrOutput()
	cols = uBound(arrSet(0))
	ReDim arrOutput(cols)

	For i = 0 To cols Step 1
		rows = ubound(arrSet(0)(i))
		r=1
		For j = 0 To rows Step 1
			If blnType = 0 Then
				a = array(1,1)
			ElseIf blnType = 1 Then
				a = array(1,2)
			ElseIf blnType = 2 Then
				a = array(2,2)
			End If

			If i Mod(a(0)) Then
				If j Mod(a(1)) Then
					b = array(0,1)
				Else
					b = array(2,3)
				End If
			Else
				If j Mod(a(1)) Then
					b = array(2,3)
				Else
					b = array(0,1)
				End If
			End If
			ReDim Preserve arrTemp(r)
			arrTemp(r-1) = arrSet(b(0))(i)(j)
			arrTemp(r) = arrSet(b(1))(i)(j)
			r=r+2
		Next
		arrOutput(i) = arrTemp
	Next

	sortTriangles = arrOutput
End Function
Function tileObjects(arrObjects,spacing)
	tileObjects = Null
	Dim i,j,cols,rows,arrOutput(),arrTemp()
	Dim origin, tDis, dist, bBox()
	origin = array(0,0,0)

	cols = uBound(arrObjects)
	ReDim arrOutput(cols)

	For i = 0 To cols Step 1
		rows = uBound(arrObjects(i))
		ReDim bBox(rows),arrTemp(rows)
		tDis = 0
		For j = 0 To rows Step 1
			bBox(j) = Rhino.BoundingBox(arrObjects(i)(j))
			dist = Rhino.Distance(bBox(j)(0),bBox(j)(1))
			If j = 0 Then
				Call Rhino.MoveObjects(arrObjects(i)(j),bBox(j)(0),origin)
			Else
				Call Rhino.MoveObjects(arrObjects(i)(j),bBox(j)(0),bBox(j-1)(3))
				Call Rhino.MoveObjects(arrObjects(i)(j),array(0,0,0),array(0,spacing,0))
			End If
			bBox(j) = Rhino.BoundingBox(arrObjects(i)(j))

			If tDis &lt; dist Then
				tDis = dist
				origin = array(bBox(j)(1)(0)+spacing,0,0)
			End If
			arrTemp(j) = arrObjects(i)(j)
		Next
		arrOutput(i) = arrTemp
	Next
	tileObjects = arrOutput
End Function
Function tabMaker(curve,depth,text,blnDirection)
	tabMaker = Null
	Dim arrOutput, tPlane, pt(3), txt
	tPlane = Rhino.ViewCPlane()
	Call Rhino.ViewCPlane(,Rhino.WorldXYPlane())
	pt(0) = Rhino.CurveMidPoint(curve)
	If blnDirection = True Then
		pt(1) = Rhino.CurveStartPoint(curve)
		pt(2) = Rhino.CurveEndPoint(curve)
	Else
		pt(2) = Rhino.CurveStartPoint(curve)
		pt(1) = Rhino.CurveEndPoint(curve)
	End If
	pt(3) = Rhino.PointAdd(pt(0),Rhino.VectorRotate(Rhino.VectorScale(Rhino.VectorUnitize(Rhino.VectorCreate(pt(1),pt(2))),depth),90,Rhino.WorldXYPlane()(3)))
	arrOutput = Rhino.AddPolyline(array(pt(1),pt(3),pt(2)))
	txt = Rhino.AddText(text,pt(0),depth*0.3)
	Call Rhino.ObjectColor(txt,RGB(0,255,0))
	Call Rhino.OrientObject(txt,array(pt(0),array(pt(0)(0)+1,pt(0)(1),pt(0)(2)),array(pt(0)(0),pt(0)(1)+1,pt(0)(2))),array(pt(0),pt(1),pt(3)))
	Call Rhino.ViewCPlane(,tPlane)
	tabMaker = arrOutput
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://neoarchaic.net/2010/03/triangulate-3-pack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

