Sunday, December 31, 2006

Area Script

















Here's a small script I wrote for calculating the area of panels in 3d. In the end I'd like to be able to send the information to a spreadsheet that will also flatten the panels and dimension them automatically.

Option Explicit

main()

Sub main()

Dim arrObjects

arrObjects = Rhino.GetObjects ("select a objects", 8)

Dim i
For i = 0 To UBound(arrObjects)
If Rhino.IsSurface(arrObjects(i)) Then
Dim arrArea : arrArea = Rhino.SurfaceArea(arrObjects(i))
Dim arrPoints : arrPoints = Rhino.SurfacePoints(arrObjects(i))
Rhino.AddText "Panel "& i+1 & " Area: " & CStr (arrArea(0)), arrPoints(0)
End If

Next

End Sub

Challenge #2 Method List (Please Update)

So following up on Yuki's proposal for Challenge #2 here is a list of methods we must use at least once in our script. Other restrictions are that we cannot use any other methods than the ones given. The goal should be to make the most useful/interesting/fun script using all the methods. Before the Challenge begins we should all contribute a method or two we'd like to use.

note *methods are built in commands and can be accessed by going to help - plugin - rhinoscript (in folder called methods)*

Method List for Challenge #2 (Maximum of 10)

Rhino.AddSrfPoint (Sky)
Rhino.GetPointOnSurface (Sky)

Rhino.CurveLength (Yuki)
Rhino.ScaleObject (Yuki)
Rhino.DivideCurve (Yuki)


Solution #1 (Sky)

I hope everyone's gotten started on your scripts. Here's my take on Challenge #1. Instead of starting with a panel I started with two curves. The user gets to input how many panels they want from 2 to 500 with the default value set at 10. To make this I used the tutorials along with the searching the method helpfiles. Working out the bugs with the nested arrays took a while. My original intent was to work in 2d and make ellipses that would span the two points on the curves with varying thickness. In the end I couldn't think of any other way than Rhino.command and that was giving me trouble.








































Here's the script:

Option Explicit

Call Main()

Sub Main
Dim t
Dim strCurve1, strCurve2
Dim arrCurve1Points(), arrCurve2Points()

t = Rhino.GetInteger("Number of Divisions",10,2,500)

Do
strCurve1 = Rhino.GetObject("Select First Curve",4)
If IsCurve(strCurve1) Then Exit Do
Loop

Do
strCurve2 = Rhino.GetObject("Select Second Curve", 4)
If IsCurve(strCurve2) Then Exit Do
Loop

Call AddPoints(strCurve1, t, arrCurve1Points)
Call AddPoints(strCurve2, t, arrCurve2Points)

Dim r
Dim arrTemp

For r = 0 To t-1 'line30
arrTemp = Array(arrCurve1Points(r), arrCurve1Points(r+1), arrCurve2Points(r+1), arrCurve2Points(r))
Call Rhino.AddSrfPt(arrTemp)
'Call Rhino.AddLine(arrCurve1Points(r), arrCurve2Points(r))
Next

End Sub

'This function makes an array of points on the selected curve
Function AddPoints(StrCurve, t, ByRef CurvePoints)

Dim arrDomain, dblParam, arrPoint

arrDomain = Rhino.CurveDomain(StrCurve)
dblParam = arrDomain(1)/t

Dim i
For i = 0 To t
arrPoint = Rhino.EvaluateCurve(StrCurve, dblParam * i)
ReDim Preserve CurvePoints(i)
CurvePoints(i) = arrPoint
'Call Rhino.AddPoint (arrPoint)
Next

End Function

Saturday, December 30, 2006

The Rhinoscript Challenge #2

How about the following problem as a first challenge?

Instead of solving one problem with everybody, each of us come up to 3 to 5 RhinoScript Methods we can use, and write one or more scripts.

Like we started learning AutoCAD only with
"L"
"Pl" "O" "Co" "Tr"
Those
5 RhinoScript Methods will be our basic tools. Then everything else will follow!

You can find RhinoScripting Methods in Rhino
Rhino Help/ plug-ins/ RhinoScript plug-in
Then open RhinoScript Methods

A list of VBscript functions can be found here:
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp

newbie thoughts

I finally started messing around with vbScript. It's like learning another language.
I was having a little trouble comprehending the
McNeel Rhinoscript PDF's without having any scripting experiences.

I would recommend the PDF tutorial that Devyn gave us in our 3A.
Reconstructivism:
http://www.reconstructivism.net/PDF/Scripting_Handout.pdf


Saturday, December 23, 2006

The Rhinoscript Challenge #1

Given that we're all Rhinoscript beginners the challenge was set up so that we could all work on one problem and compare our solutions.

Everyone got mad at me for making the first challenge several months ago so to make this as fair of a process let's all make suggestions to what the first challenge should be.

Why we need to learn Rhinoscript: A manifesto of sorts

Scripting in architecture, also known as computational design seems to be the current trend. So what's the big deal and why should we be a part of it?

In answering this question I'd like for us to come up with a new relevance for scripting in architecture, one that goes beyond form generation, or unique structure as we see at Sciarc. Already the division between scripting, parametric modeling, and B.I.M. software is going away to where they are all being connected into one big organizational software such as Generative Components, or Digital Project. This is very exciting in that never before has the designer played as much of a role as the designing software as they are now. Through scripting we are able to create the tools we want to use rather than picking from what the available software has to offer.

This is all good and as architects it will be necessary for us to know this stuff. My real beef is with what the prominent architects are doing with this new freedom. Around school what I see is a leaning toward complexity, complexity far beyond the capabilities of construction. What this means is that designs are visionary at best, mental masturbation at worst. You be the judge but it's safe to say that most of the projects proposed at Sciarc cannot be built tomorrow. This in as of itself is not a problem and I love to think in these big terms, but as a practical measure I want to also pursue scripting in terms of what it takes to get the job done. For those of you that saw the lecture by Roberto in 4A you know what I mean. Using scripting as a tool to simplify and automate the process. In the practicing environment this economy of speed and labour results in real savings, a way for us to actually make lots of money with our knowledge. This makes people that can script, i.e. us, a major component of any design & construction process.

I'd like to hear from those of you in Evan Douglas' studio to see your take on this stuff.

Here are several links to people already thinking about this.

The Yale Symposium <-- this is very interesting

The Gehry Method
A lecture that introduces concepts of BIM and Parametric Design

About the S.S.S.S.

The S.S.S.S. was formed as a way to help all of us exchange information about things pertaining to scripting, in particular Rhinoscripting. This blog is open for all members to post, update and edit, not only things about Rhinoscript but anything remotely related should be brought up.

For clarity we should put our name in the label of the post. That way we'll know who to respond to about certain topics.