Pratt | Digital Futures Group

Icon

Benjamin Ferraioli (Dragana + Onur)

script-board-blog10

Tags: Dragana, Ferraioli, Onur Gun, Rhino3D, Rhinoscript, Scripting

kristin koslowski (dragana + onur)

koslowski_learning-unit-sectionslearning-unit-sectionspattern development

Tags: Dragana, Koslowski, Onur Gun, pattern development, Rhinoscript

Grasshopper | luong [should have saved my work]

Saving your work often is essential when working with grasshopper. To illustrate this point, I decided to create a really awesome associative model, take a screenshot of it, and then fail to save it before closing Rhino. That’s how brilliant I am.

Below is proof that I did indeed have a more complete model, and below that is a link to the .ghx file in the state it was in 1hr before the screenshot below.


090225_luong_b from Digital Futures Group on Vimeo.

090225_luong_b.ghx

Tags: Associative, don't forget to save!, Grasshopper, linear progression, Vb.Net

Grasshopper | lalaj_rudi

lalaj_rudi_3

Check out Lalaj & Rudi’s (carvalho) tiling pattern implemented in Grasshopper.  Things got a bit sticky, and we ended up with a big fat script node to do the bulk of the work, but the results are pretty good for an early-semester swipe at a corrugation.

Notice that sweet, sweet sectional variation.

Links below to source files.

lalaj_rudi_1lalaj_rudi_2

090224_lalaj_rudi_b.ghx090224_lalaj_rudi.3dm

Tags: Grasshopper, ksteinfe, mesh, Parametric, scripted node, tiling, truss

Grasshopper | Kyle’s First Grasshopper

kyle's first grasshopper screenshot

kyle's first grasshopper screenshot

kyle's first grasshopper screenshot

Attached is my first real attempt at Grasshopper, and I have to say that I’m optimistic about the possibilities of combining a scripted approach with the user interface of grasshopper.  It was my intention here to try out the scripted methodology that we’re employing in the third year long span studio, and see how applicable it might be to the parametric environment of Grasshopper.  I was trying to be as flexible as possible – the user can define any number of points within a bounding box (both controlled by rhino geometry, see attached 3dm) as a unit “cell”, which is then arrayed in a rectangular grid.  Linear transformations may then be applied, and altered using Grasshopper’s nifty Graph Widget.  It’s a pain dealing only with one-dimensional arrays of things, but a few scripted nodes does the trick.

090220_planar_tiling_g.ghx090220_planar_tiling.3dm

Tags: Grasshopper, ksteinfe, mesh, Parametric, scripted node, tiling, truss

Student Scripts | abbe_bernal

abbe_bernal_090216_a

abbe_bernal_090216_b

abbe_bernal_090216_c

Three very similar variations on a script written for Abbe and Bernal in Lonn Comb’s class.  These scripts create a truss-like 3d pattern, with increasingly complex math-driven variations.  They rely on 4 methods to do the bulk of the work, described below:

the function HynetCellPts, creates a collection of four points which makeup the basic module of a truss… it doesn’t draw anything to rhino, it just creates the points (as data) at a given location, and stores these points in an array.

the function HynetGridPts, calls upon this previous function, and creates a grid of modules at a particular scale and spacing…. again, it doesn’t draw anything, it simply creates the points and stores them in an array in a structured manner.  can you figure out the structure of this array, and draw it in monkeybrainland?

the function Main, calls upon this previous function, and creates two grids of module points – one slightly higher than the other: arrPtsTop and arrPtsBtm.  again, nothing is drawn to rhino, but the critical positions for the truss are figured out here and stored in two arrays.  Then, finally, at the end of this function, the final method is called which draws elements to rhino based on these two arrays.

the function DrawHynetMatrix looks like the most complicated function in the lot, but in reality it’s job is the simplest.  based on two arrays of module points (defined in functions above), this function draws the desired geometry to rhino.  there’s alot of “weaving” going on here – figuring out which point on one module to connect to which point on the next – but conceptually, things are very straightforward.

Tags: Rhinoscript, structure, student script, tiling, truss

Rhinoscript | Vector Utility Functions


Function VectorProjectedLength(arrSrc, arrDest)
	'' Returns the length of the vector which results from the projection of the source vector onto the destination vector
	VectorProjectedLength = Rhino.VectorDotProduct(arrSrc,Rhino.VectorUnitize(arrDest))
End Function

Function VectorProject(arrSrc, arrDest)
	''Returns the vector which results from the projection of the source vector onto the destination vector
	VectorProject = VectorResize(arrDest,VectorProjectedLength(arrSrc, arrDest))
End Function

Function VectorResize(arrVec, dblSize)
	Dim v : v = Rhino.VectorUnitize(arrVec)
	VectorResize = Rhino.VectorScale(v,dblSize)
End Function

Function Centroid(arrPts)
	Dim cent, n
	cent = array(0,0,0)
	For n=0 To Ubound(arrPts)
		cent = Rhino.VectorAdd(cent, arrPts(n))
	Next
	cent = Rhino.VectorScale(cent, 1/(Ubound(arrPts)+1))
	Centroid = cent
End Function

Function PointInterpolate(arrPtA, arrPtB, t)
	Dim vec
	vec = Rhino.VectorCreate(arrPtB, arrPtA)
	vec = Rhino.VectorScale(vec,t)
	PointInterpolate = Rhino.PointAdd(arrPtA, vec)
End Function

Function ScalePtsAboutCentroid(arrPts, scale)
	Dim cent, tVec
	cent = Centroid(arrPts)
	tVec = Rhino.VectorCreate(array(0,0,0), cent)

	Dim n
	For n=0 To Ubound(arrPts)
		arrPts(n) = Rhino.PointAdd(arrPts(n), tVec)
		arrPts(n) = Rhino.PointScale(arrPts(n), scale)
		arrPts(n) = Rhino.PointAdd(arrPts(n), Rhino.VectorReverse(tVec))
	Next
	ScalePtsAboutCentroid = arrPts
End Function

Function VectorCompare(arrVecA, arrVecB)
	'' compares two vectors, see if they are pointing basically the same way
	VectorCompare = False
	If (VectorProjectedLength(arrVecA, arrVecB) > 0 ) Then VectorCompare = True
End Function

Function DistanceXY(arrPtA, arrPtB)
	DistanceXY = (  (arrPtA(0)-arrPtB(0))^2 + (arrPtA(1)-arrPtB(1))^2  )^0.5
End Function
Tags: Rhinoscript, sample script, utility, vector, vector math

Workshop | Grasshopper Level III

February 19, 2009
6:00 pmto10:00 pm






All attendees-

Grasshopper Level III Workshop

RESCHEDULED for

Thursday, February 19 (6-10PM)

due to scheduling conflict.

For those of you who attended the second GH workshop please visit the new Digital Futures Group wiki for assignment information, workshop files, and to post your progress. If you were on the sign-up sheet you will have a username and password for posting to the wiki. Remember to please reference the Grasshopper Primer which can be found on the wiki if you need a refresher.

Thank you and we look forward to seeing you all soon.

20090209_dfg_gh02_GHdynSkin

Tags: Associative, Grasshopper, Parametric, Relational, Rhino, Vb.Net

Sunday Script | Cardioid


Option Explicit
'Script written by ksteinfe
Call Cardioid()
Sub Cardioid()
	ReDim arrPoints(50)
	Dim x,y,z
	Dim theta

	'' cardioid
	Dim r
	Dim n
	r = 1
	For n=0 To 50
		theta = (n/50)*Rhino.Pi*4
		x = 2*r*(cos(theta)-.5*cos(2*(theta)))
		y = 2*r*(sin(theta)-.5*sin(2*(theta)))
		z = 0
		arrPoints(n)=array(x,y,z)
	Next
	Rhino.AddCurve(arrPoints)
End Sub
Tags: geometry, graph drawing, Rhinoscript, sample script

Sunday Script | Sort Colors to Layers


Option Explicit
'Script written by ksteinfe
'Script copyrighted by nobody!
'Script version Wednesday, April 23, 2008 12:37:44 PM

Call Main()
Sub Main()
	Dim arrObjects, strObject
	arrObjects = Rhino.GetObjects("select objects")

	Rhino.AddLayer("colorSort")

	Rhino.EnableRedraw vbFalse
	For Each strObject In arrObjects
		Dim lngColor
		lngColor = Rhino.ObjectColor(strObject)

		If Not Rhino.IsLayer(lngColor) Then
			Call Rhino.AddLayer(lngColor, lngColor, True, False, "colorSort")
		End If

		Call Rhino.ObjectLayer(strObject, lngColor)
		Call Rhino.ObjectColorSource(strObject,0)
	Next
	Rhino.EnableRedraw vbTrue
End Sub
Tags: layer management, Rhinoscript, sample script

Pratt | Digitial Futures Group

The Digital Futures Group is a collective of computational design experts teaching at Pratt Institute.

Categories