<?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>Code &#038; form &#187; Rhino</title>
	<atom:link href="http://workshop.evolutionzone.com/category/rhino/feed/" rel="self" type="application/rss+xml" />
	<link>http://workshop.evolutionzone.com</link>
	<description>Computational aesthetics and programming for artists and designers.</description>
	<lastBuildDate>Mon, 26 Oct 2009 08:09:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rhino: randCube.rvb</title>
		<link>http://workshop.evolutionzone.com/2008/02/14/rhino-randcubervb/</link>
		<comments>http://workshop.evolutionzone.com/2008/02/14/rhino-randcubervb/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 13:38:19 +0000</pubDate>
		<dc:creator>marius watz</dc:creator>
				<category><![CDATA[AHO]]></category>
		<category><![CDATA[Rhino]]></category>
		<category><![CDATA[landscape]]></category>
		<category><![CDATA[rhinoscript]]></category>
		<category><![CDATA[rvb]]></category>
		<category><![CDATA[Workshops]]></category>

		<guid isPermaLink="false">http://workshop.evolutionzone.com/2008/02/14/rhino-randcubervb/</guid>
		<description><![CDATA[This landscape of randomized cube-like structures proved popular with the students in the AHO workshop:
Code: randCube.rvb


Option Explicit
'Script written by Marius Watz
'Script version 14. februar 2008 10:56:41

Call Clear
Call Main()

Sub Main()
	Call rhino.enableRedraw(False)

	Dim i,j
	For i=0 To 10
		For j=0 To 10
			Call rndCube(i*15,j*15)
		Next
	Next

	Call rhino.enableRedraw(True)
End Sub

Function rndVec(range)
	rndVec=Array(Rnd*range-range/2,Rnd*range-range/2,Rnd*range-range/2)
End Function

Function rndCube(xpos,ypos) 

	Dim pt(8)
	Dim c1,c2

	Dim rad
	rad=5
	pt(0)=Array(-rad,-rad,rad)
	pt(1)=Array(rad,-rad,rad)
	pt(2)=Array(rad,rad,rad)
	pt(3)=Array(-rad,rad,rad)

	pt(4)=Array(-rad,-rad,-rad)
	pt(5)=Array(rad,-rad,-rad)
	pt(6)=Array(rad,rad,-rad)
	pt(7)=Array(-rad,rad,-rad)	

	Dim i,rndv,rndH
	rndH=Rnd*rad*2
	For i=0 To 3
		rndv=rndVec(4)
		rndv(2)=rndv(2)+rndH
		pt(i)=Rhino.VectorAdd(pt(i),rndv)
	Next

	For i=0 To 7
		pt(i)=Rhino.VectorAdd(pt(i),Array(xpos,ypos,0))
	Next

	Dim ln(8)
	For [...]]]></description>
			<content:encoded><![CDATA[<p>This landscape of randomized cube-like structures proved popular with the students in the AHO workshop:</p>
<div class="mediumtitle">Code: randCube.rvb</div>
<p><span id="more-181"></span></p>
<pre name="code" class="vb">
Option Explicit
'Script written by Marius Watz
'Script version 14. februar 2008 10:56:41

Call Clear
Call Main()

Sub Main()
	Call rhino.enableRedraw(False)

	Dim i,j
	For i=0 To 10
		For j=0 To 10
			Call rndCube(i*15,j*15)
		Next
	Next

	Call rhino.enableRedraw(True)
End Sub

Function rndVec(range)
	rndVec=Array(Rnd*range-range/2,Rnd*range-range/2,Rnd*range-range/2)
End Function

Function rndCube(xpos,ypos) 

	Dim pt(8)
	Dim c1,c2

	Dim rad
	rad=5
	pt(0)=Array(-rad,-rad,rad)
	pt(1)=Array(rad,-rad,rad)
	pt(2)=Array(rad,rad,rad)
	pt(3)=Array(-rad,rad,rad)

	pt(4)=Array(-rad,-rad,-rad)
	pt(5)=Array(rad,-rad,-rad)
	pt(6)=Array(rad,rad,-rad)
	pt(7)=Array(-rad,rad,-rad)	

	Dim i,rndv,rndH
	rndH=Rnd*rad*2
	For i=0 To 3
		rndv=rndVec(4)
		rndv(2)=rndv(2)+rndH
		pt(i)=Rhino.VectorAdd(pt(i),rndv)
	Next

	For i=0 To 7
		pt(i)=Rhino.VectorAdd(pt(i),Array(xpos,ypos,0))
	Next

	Dim ln(8)
	For i=0 To 3
		ln(i)=Rhino.AddLine(pt(i),pt((i+1) Mod 4))
		ln(i+4)=Rhino.AddLine(pt(i+4),pt(((i+1) Mod 4)+4))
	Next

	Dim srf(6)
	For i=0 To 3
		srf(i)=Rhino.AddEdgeSrf(Array(ln(i),ln(i+4)))
	Next

	ln(0)=Rhino.AddLine(pt(1),pt(0))
	srf(4)=Rhino.AddEdgeSrf(Array(ln(0),ln(2)))
	srf(5)=Rhino.AddEdgeSrf(Array(ln(6),ln(4)))

	For i=0 To UBound(ln)-1
		Rhino.DeleteObject ln(i)
	Next

End Function

Sub Clear
	Rhino.Command "SelAll "
	Rhino.Command "Delete "
End Sub</pre>
]]></content:encoded>
			<wfw:commentRss>http://workshop.evolutionzone.com/2008/02/14/rhino-randcubervb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RhinoScript at MIT IAP</title>
		<link>http://workshop.evolutionzone.com/2008/02/11/rhinoscript-at-mit-iap/</link>
		<comments>http://workshop.evolutionzone.com/2008/02/11/rhinoscript-at-mit-iap/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 20:40:01 +0000</pubDate>
		<dc:creator>marius watz</dc:creator>
				<category><![CDATA[AHO]]></category>
		<category><![CDATA[Rhino]]></category>
		<category><![CDATA[Workshops]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[computational-architecture]]></category>
		<category><![CDATA[generative]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[rhinoscript]]></category>

		<guid isPermaLink="false">http://workshop.evolutionzone.com/2008/02/12/rhinoscript-at-mit-iap/</guid>
		<description><![CDATA[
MIT IAP RhinoScript workshop &#8211; Danzer Variations
While looking for RhinoScript resources for the Digital Architecture workshop at AHO I found a recent posting of the final projects from a RhinoScript workshop at MIT IAP. It features some very nice-looking work, including the Danzer tile forms shown above. It also provides the source code for most [...]]]></description>
			<content:encoded><![CDATA[<div class="flickrImg"><a href="http://rhinoscripting.blogspot.com/2008/02/final-presentations.html"><img src="http://farm3.static.flickr.com/2235/2257464782_f40d30c713.jpg" alt="Danzer tiling" /></a></p>
<p>MIT IAP RhinoScript workshop &#8211; <a href="http://rhinoscripting.blogspot.com/2008/02/final-presentations.html">Danzer Variations</a></div>
<p>While looking for RhinoScript resources for the Digital Architecture workshop at AHO I found a recent <a href="http://rhinoscripting.blogspot.com/2008/02/final-presentations.html">posting of the final projects</a> from a RhinoScript workshop at MIT IAP. It features some very nice-looking work, including the Danzer tile forms shown above. It also provides the source code for most of the experiments, well worth checking out.</p>
<p>The resource page for a previous MIT workshop is still up, it has more scripts and some useful links: <a href="http://www.kaschaandjohn.com/rhinoscripting/index.html" title="Computational Design Solutions Part 1">Computational Design Solutions Part 1</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://workshop.evolutionzone.com/2008/02/11/rhinoscript-at-mit-iap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Digital Architecture at AHO</title>
		<link>http://workshop.evolutionzone.com/2008/02/11/digital-architecture-at-aho/</link>
		<comments>http://workshop.evolutionzone.com/2008/02/11/digital-architecture-at-aho/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 01:50:01 +0000</pubDate>
		<dc:creator>marius watz</dc:creator>
				<category><![CDATA[AHO]]></category>
		<category><![CDATA[Processing / Java]]></category>
		<category><![CDATA[Rhino]]></category>
		<category><![CDATA[Workshops]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[computational-architecture]]></category>
		<category><![CDATA[processing.org]]></category>
		<category><![CDATA[rhinoscript]]></category>

		<guid isPermaLink="false">http://workshop.evolutionzone.com/2008/02/11/digital-architecture-at-aho/</guid>
		<description><![CDATA[I am teaching a 3-day workshop in Digital Architecture at the Oslo School of Architecture &#038; Design (AHO) this week, as part of a course by Søren Sørensen. The workshop will give an introduction to Processing, with a focus on synthesis of spatial form. If time permits we&#8217;ll also look briefly at Rhinoscript.
Be sure to [...]]]></description>
			<content:encoded><![CDATA[<p>I am teaching a 3-day workshop in Digital Architecture at the Oslo School of Architecture &#038; Design (AHO) this week, as part of a course by Søren Sørensen. The workshop will give an introduction to Processing, with a focus on synthesis of spatial form. If time permits we&#8217;ll also look briefly at Rhinoscript.</p>
<p>Be sure to look at the page I have prepared with <a href="http://workshop.evolutionzone.com/computational-architecture/">links related to computational architecture</a>. Code will be uploaded to:<br />
<a href="http://workshop.evolutionzone.com/workshops/080211_aho">http://workshop.evolutionzone.com/workshops/080211_aho</a>.</p>
<div class="mediumtitle">Workshop contents</div>
<ul>
<li>Basic Processing syntax</li>
<li>Simple animation</li>
<li>Control structures: If / else, loops, keyPressed(), mousePressed()</li>
<li>Transformations: translate(), scale(), rotate()</li>
<li>Complex drawing: beginShape(), endShape()</li>
<li>Data structures: Arrays, classes</li>
<li>Polygon mesh generation</li>
<li>Output: PDF, STL, DXF</li>
</ul>
<div class="mediumtitle">Possible advanced topics</div>
<ul>
<li><a href="http://en.wiki.mcneel.com/default.aspx/McNeel/RhinoScript.html">RhinoScript</a></li>
<li><a href="http://hipstersinc.com/p5sunflow/">p5Sunflow</a>, a radiosity rendering library for Processing</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://workshop.evolutionzone.com/2008/02/11/digital-architecture-at-aho/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My first Rhinoscript&#8230;</title>
		<link>http://workshop.evolutionzone.com/2008/02/05/my-first-rhinoscript/</link>
		<comments>http://workshop.evolutionzone.com/2008/02/05/my-first-rhinoscript/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 10:42:21 +0000</pubDate>
		<dc:creator>marius watz</dc:creator>
				<category><![CDATA[AHO]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Processing / Java]]></category>
		<category><![CDATA[Rhino]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[cad]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[rhinoscript]]></category>
		<category><![CDATA[rvb]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://workshop.evolutionzone.com/2008/02/05/my-first-rhinoscript/</guid>
		<description><![CDATA[
Rhinoscript sketch, extruding a revolution surface along random curves. Good cheesy fun.
I had a chance to see a bit more of the impressive tool Rhino 4 during the Generator.x 2.0 workshop, and so I thought I&#8217;d have a go at making a simple sketch in Rhinoscript. As it turns out, the fact that Rhinoscript is [...]]]></description>
			<content:encoded><![CDATA[<div class="flickrImg"><img src='http://workshop.evolutionzone.com/wp-content/uploads/2008/02/080205_rhinoscript.jpg' alt='080205_rhinoscript.jpg' /></p>
<p>Rhinoscript sketch, extruding a revolution surface along random curves. Good cheesy fun.</p></div>
<p>I had a chance to see a bit more of the impressive tool <a href="http://www.rhino3d.com/">Rhino 4</a> during the <a href="http://generatorx.no/gx20workshop">Generator.x 2.0 workshop</a>, and so I thought I&#8217;d have a go at making a simple sketch in Rhinoscript. As it turns out, the fact that Rhinoscript is based on VBScript makes coding feel horrible at first. Seriously, who would want to use syntax like that? It might be easy for beginners to pick up, but it quickly gets painful once you&#8217;re dealing with complex API calls and 100+ lines of code.</p>
<p>Nevertheless, frustration soon gives way to amazement at the built-in Rhino library and its vast array of heavy-duty functions for creating and manipulating curves, meshes and NURBS surfaces. In comparison, mesh generation in Processing is enough to give anyone a headache, and I seriously doubt anyone would even attempt to implement NURBS. Even Boolean mesh operations is a staggering task, with no good Java libraries readily available.</p>
<p>While Rhinoscript is firmly a non-realtime tool, its power for pure geometry is amazing. I would definitely use Rhino as a creative tool for digital fabrication projects, where animation is not the goal. There are some excellent RhinoScript resources online, for starters look at <a href="http://en.wiki.mcneel.com/default.aspx/McNeel/RhinoScript101">RhinoScript 101</a> and <a href="http://reconstructivism.net/">David Rutten&#8217;s tutorial</a>. I would also definitely recommend using the <a href="http://en.wiki.mcneel.com/default.aspx/McNeel/MonkeyForRhino4.html">Monkey Script editor</a> instead of the built-in editor, it&#8217;s more powerful and has a very useful documentation feature.</p>
<p>The script below gives a basic idea of the Rhino syntax, and while it is a basic sketch suffering from 3D clichées, it shows the power and versatility of Rhinoscript. I just wish it wasn&#8217;t Visual Basic.</p>
<div class="mediumtitle">Code: RandRail.rvb</div>
<p><span id="more-174"></span></p>
<pre name="code" class="vb">'RandRail.rvb
'Marius Watz, http://workshop.evolutionzone.com

Option Explicit

Sub Main
	Dim doRender : doRender=1
	Dim num : num=100
	Dim pt, curve(100)

	Call rhino.enableRedraw(False)
	Rhino.Print "--------------------------"

	' delete any existing objects
	Dim oldScene:oldScene=Rhino.AllObjects()
	If isArray(oldScene) Then
		Rhino.DeleteObjects Rhino.AllObjects()
		Rhino.DeleteObjects Rhino.LightObjects()
	End If

	' Set up scene
	Dim light
	light=Rhino.AddPointLight (Array(0,-200,0))
	light=Rhino.AddPointLight (Array(-100,-100,0))

	Rhino.RenderColor 1, RGB(50,50,50)
	Rhino.RenderResolution Array(1200,900)
	Rhino.RenderAntialias 2

	' Create random curves
	Dim cp(3),mult, i
	For i=0 To num
		mult=random(0.75,1.25)
		cp(0)=Array(0,0,0)
		If Rnd>0.5 Then
			cp(1)=Array(0,random(30,50),0)
		Else
			cp(1)=Array(0,random(-30,20),0)
		End If
		If Rnd>0.5 Then
			cp(2)=Array(random(-50,50)*mult,random(30,50),random(-50,50)*mult)
		Else
			cp(2)=Array(random(-50,50)*mult,random(-30,20),random(-50,50)*mult)
		End If
		cp(3)=Array(random(-50,50)*mult,random(-50,50),random(-50,50)*mult)
		curve(i)=Rhino.AddCurve(cp)
		'		Rhino.AddSphere cp(2), dblRadius
	Next

	' Create random rounded profile
	Dim numRot : numRot=Int(random(7,18))
	Dim j, rndCurve(10),profPt(),deg,offs
	ReDim profPt(numRot)

	For j=0 To Ubound(rndCurve)
		For i=0 To numRot
			deg=(2*Rhino.Pi/numRot)*i
			offs=random(5,7)*0.2
			If i Mod 2=0 Then
				offs=random(7,12)*0.2
			End If

			profPt(i)=Array(Cos(deg)*offs, 0 ,Sin(deg)*offs)
		Next
		rndCurve(j)=Rhino.AddCurve(profPt)
	Next

	' Create random RailRefSrf and ExtrudeCurve surfaces
	Dim railAxis(1)
	railAxis(0)=Array(0,0,0)
	railAxis(1)=Array(0,1,0)

	Dim srf,profCurve
	For i=0 To num
		profCurve=rndCurve(Int(random(0,Ubound(rndCurve))))
		srf=Rhino.AddRailRevSrf(curve(i),profCurve,railAxis)
		applyRndMaterial(srf)
		'		srf=Rhino.ExtrudeCurve(profCurve,curve(i))
		'		applyRndMaterial(srf)
	Next

	If doRender=1 Then
		renderView()
	End If

	Call rhino.enableRedraw(True)

End Sub

' Set random materials
Function applyRndMaterial(obj)
	Dim prob,col,material

	material=Rhino.AddMaterialToObject (obj)

	' Coloring: Pink, Orange
	prob=random(0,100)
	If prob<30 Then
		Rhino.MaterialColor material, RGB(255, 0, Int(random(100,150)))
	ElseIf prob<90 Then
		Rhino.MaterialColor material, RGB(255, Int(random(100,254)),0)
	Else
		Rhino.MaterialColor material, RGB(255, 255, 255)
	End If
End Function

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

' Render current viewport
Function renderView()
	Dim view,filename

	view = Rhino.CurrentView
	Rhino.Command "_-Render"
	filename=getRenderFileName("RandRail")
	Dim cmd : cmd="_-SaveRenderWindowAs " &#038; Chr(34) &#038; filename &#038; Chr(34)
	Rhino.Command cmd
End Function

' Get auto-incremented filename
Function getRenderFileName(scriptName)
	Dim index,done, doc, file, temp,imgNum

	done=-1
	index=0
	Do While done=-1
		doc=Rhino.WorkingFolder &#038; "\" &#038; scriptName &#038; padStr(scriptName,index) &#038; ".png"
		file=Rhino.FindFile(doc)
		If IsNull(file)=True Then
			done=1
		Else
			index=index+1
		End If
	Loop

	getRenderFileName=doc
End Function

Function padStr(prefix,val)
	Dim l : l=Len(val)
	If l<1 Then
		padStr="000" &#038; val
	ElseIf l<2 Then
		padStr="00" &#038; val
	ElseIf l<3 Then
		padStr="0" &#038; val
	Else
		padStr="" &#038; val
	End If
End Function	

Main</pre>
]]></content:encoded>
			<wfw:commentRss>http://workshop.evolutionzone.com/2008/02/05/my-first-rhinoscript/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
