**Module 1 Review**February 7th, 2014-
### Recent Posts

- Final Work: Andrew Aquart B.Arch May 23, 2014
- Final Work: Zhe Wen B. Arch May 23, 2014
- Final Work: Sansheng Gu M. Arch May 23, 2014
- Final Work: Caroline Redelmeier M.Arch May 23, 2014
- Final Work Xuwen Xing M.Arch May 23, 2014
- Final Work: Yi Johnson M.Arch May 21, 2014
- final models May 1, 2014
- tools and failed parts May 1, 2014
- models of project3 May 1, 2014
- models of project2 May 1, 2014
- ArrangeHousing_(genRandom) April 9, 2014
- iris mechanism with sensor April 6, 2014
- 许文 March 31, 2014
- March 27 Loops March 27, 2014
- March 26 Generators March 26, 2014
- March 25 Learning Strings Codes March 25, 2014
- code16 March 12, 2014
- code15 March 12, 2014
- code14 March 12, 2014
- code13 March 12, 2014

### Recent Comments

Juhong Park on March 27 Loops Juhong Park on code16 Anonymous on MX3D Printing Anonymous on 26 Feb Concept 1 Anonymous on Louvers Galore in Rhino Juhong Park on Sheets and Models – revi… Juhong Park on 25 Feb Recursion (need he… Juhong Park on 20 Feb My Recursion xingxuwen on Fractal! hiwotefera on 20 Feb My Recursion ### Categories

### ARCHITECTS

## ArrangeHousing_(genRandom)

import rhinoscriptsyntax as rs import random def ArrangeHousing(): """Locates and Generates units from existing curves""" curveList = rs.GetObjects() x = 0.05 for curve in curveList: number = random.random() if number > 0.8: trans = [0,0,9] midCurve = rs.CopyObject(curve, trans) centroid = rs.CurveAreaCentroid(curve) origin = centroid[0] scale = [x,x,1] topCurve = rs.ScaleObject(curve, origin, scale, True) trans2 = [0,0,25 *number] rs.MoveObject(topCurve, trans2) ids = [curve, midCurve, topCurve] house = rs.AddLoftSrf(ids) rs.OffsetSurface(house, 5) x = x + 0.01 ArrangeHousing()

Posted in Assignments
Leave a comment

## 许文

import rhinoscriptsyntax as rs

import math as mt

def lisacurve():

nlist= range(1 , 8)

for n in nlist:

anglelist = range( 0, 360)

crvList = []

ptlist = []

for angle in anglelist:

a = 1

b = 1

c = 1

t = mt.radians(angle)

x = a * mt.sin(n * t + c)

y = b * mt.sin(t)

ptposition = (x, y, mt.sin(angle))

pt = rs.AddPoint(ptposition)

ptlist.append(pt)

curve01 = rs.AddCurve(ptlist)

lisacurve()

Posted in Assignments
Leave a comment

## March 27 Loops

import rhinoscriptsyntax as rs """LOOPS""" def forLOOP(): # USING XRANGE evens = [2,4,6,8] for even in evens: print even for x in xrange(8): print x for x in xrange(3,6): print x forLOOP() """while loops have boolean condition""" def whileLOOP(): count = 0 while count < 10: print count count += 1 if count >= 5: break """limts the outcome between 0-4""" whileLOOP()

## March 26 Generators

def fib(): a, b = 2, 3 while 1: yield a a, b = b, a + b import types if type ( fib()) == types.GeneratorType: print "fib series." counter = 0 for n in fib(): print n counter += 1 if counter == 15: break

## March 25 Learning Strings Codes

import rhinoscriptsyntax as rs def ArithmeticOperators (): number = 1 + 2 * 3 /2.0 print number remainder = 13 % 3 print remainder squared = 5 ** 2 print squared cubed = 2 ** 3 print cubed ArithmeticOperators () def LearnStrings(): hello = "hello" print hello manyhello = "hello" * 13 print manyhello Astring = "Hey Man." print len(Astring) """len(x) prints out the number of characters including punctuation""" print Astring.index("y") """ y is the second character """ print Astring.count("a") """ there is only one a character """ LearnStrings()

## code16

</pre> import rhinoscriptsyntax as rs def triangle(): p0 = [0,0,0] p1 = [0.25,0.75,0] p2 = [0,1,0] pts = [p0,p1,p2,p0] tri = rs.AddPolyline(pts) return tri def rotate(obj,angle): center = [0,0,0] result = rs.RotateObject(obj,center,angle) return result def cyclic(number): increment = 360/number angle = 0 count = range(number) for i in count: tri = triangle() tri = rotate(tri,angle) angle = angle + increment cyclic(10) <pre>

Posted in Assignments
1 Comment

## code15

</pre> import rhinoscriptsyntax as rs def triangle(): p0 = [0,0,0] p1 = [0.25,0.75,0] p2 = [0,1,0] pts = [p0,p1,p2,p0] tri = rs.AddPolyline(pts) return tri def translate(obj,x,y): translation = [x,y,0] trans = rs.MoveObject(obj,translation) return trans def reflect_y(obj): start = [0,-1,0] end = [0,1,0] ref = rs.MirrorObject(obj,start,end) return ref def rotate(obj,angle): center = [0,0,0] result = rs.RotateObject(obj,center,angle) return result def square_grid(spacing,h_number,v_number): ty = 0 v_count = range(v_number) h_count = range(h_number) for v in v_count: tx = 0 for h in h_count: tri = triangle() tri = translate(tri,tx,ty) tx = tx + spacing ty = ty + spacing square_grid(1.2,4,4) <pre>

Posted in Assignments
Leave a comment

## code14

</pre> import rhinoscriptsyntax as rs def triangle(): p0 = [0,0,0] p1 = [0.25,0.75,0] p2 = [0,1,0] pts = [p0,p1,p2,p0] tri = rs.AddPolyline(pts) return tri def translate(obj,x,y): translation = [x,y,0] trans = rs.MoveObject(obj,translation) return trans def simpleFrieze(spacing,number): tx = 0 count = range(number) for i in count: tri = triangle() tri = translate(tri,tx,0) tx = tx + spacing simpleFrieze(1,6) <pre>

Posted in Assignments
Leave a comment

## code13

</pre> import rhinoscriptsyntax as rs def triangle(): p0 = [0,0,0] p1 = [0.25,0.75,0] p2 = [0,1,0] pts =[p0,p1,p2,p0] tri = rs.AddPolyline(pts) return tri def translate(obj,x,y): translation = [x,y,0] trans = rs.MoveObject(obj,translation) return trans def reflect_y(obj): start = [0,-1,0] end = [0,1,0] ref = rs.MirrorObject(obj,start,end) return ref def rotate(obj,angle): center = [0,0,0] result = rs.RotateObject(obj,center,angle) return result def frieze(x_separation,y_separation,spacing, number): tx = 0 count = range(number) for i in count: tri = triangle() tri = reflect_y(tri) tri = rotate(tri,180) tx = tx + x_separation ty = -y_separation tri = translate(tri,tx,ty) tri = triangle() tri = translate(tri,tx,0) tx = tx + spacing frieze(1,1,0.5,6) <pre>

Posted in Assignments
Leave a comment