Sanchez Class Work 03.04.16 – 1

3 Surface Code.PNG
</pre>
<pre></pre>
import rhinoscriptsyntax as rs

def makeGridsFromSurface():
obj = rs.GetObject()
uDomain = rs.SurfaceDomain(obj,0)
vDomain = rs.SurfaceDomain(obj,1)
print uDomain
print vDomain

uMax = uDomain[1]
uMin = uDomain[0]
vMax = vDomain[1]
vMin = vDomain[0]
uStep = 20
vStep = 20
uStepDist = (uMax - uMin)/uStep
vStepDist = (vMax - vMin)/vStep

ulist = rs.frange(uMin, uMax, uStepDist)
vlist = rs.frange(vMin, vMax, vStepDist)

ptlist = []
for u in ulist:
vptlist = []
for v in vlist:
pt = rs.EvaluateSurface(obj, u, v)
#rs.AddPoint(pt)
vptlist.append(pt)
ptlist.append(vptlist)
return ptlist
ptlist1 = makeGridsFromSurface()
ptlist2 = makeGridsFromSurface()
ptlist3 = makeGridsFromSurface()

def verticleColumns(x,y):
p0 = ptlist1[x][y]
p1 = ptlist2[x][y]
rs.AddLine(p0, p1)

def obliqColumns0(x,y):
p0 = ptlist1[x][y]
p1 = ptlist2[x+1][y-1]

path = rs.AddLine(p0,p1)
cir1 = rs.AddCircle(p0, 0.2)
rs.ExtrudeCurve(cir1,path)

def obliqColumns1(x,y):
p0 = ptlist1[x][y]
p1 = ptlist2[x+1][y+1]

path = rs.AddLine(p0,p1)
cir1 = rs.AddCircle(p0, 0.2)
rs.ExtrudeCurve(cir1,path)

def obliqColumns2(x,y):
p0 = ptlist1[x][y]
p1 = ptlist2[x-1][y+1]

path = rs.AddLine(p0,p1)
cir1 = rs.AddCircle(p0, 0.2)
rs.ExtrudeCurve(cir1,path)

def obliqColumns3(x,y):
p0 = ptlist1[x][y]
p1 = ptlist2[x-1][y-1]

path = rs.AddLine(p0,p1)
cir1 = rs.AddCircle(p0,0.2)
rs.ExtrudeCurve(cir1,path)
def makeColumns(ptlist1, ptlist2):
xlist = range(1, 19, 2)
ylist = range(1, 19, 2)
for x in xlist:
for y in ylist:
verticleColumns(x,y)
obliqColumns0(x,y)
obliqColumns1(x,y)
obliqColumns2(x,y)
obliqColumns3(x,y)

#makeColumns(ptlist1, ptlist2)

def makeCrv(x,y):
p8 = ptlist3 [x] [y-1]

p4 = ptlist2[x+1][y-1]
y4 = p4[1] * 2 / 3
p4 = p4[0], y4, p4[2]

p0 = ptlist1[x+1][y-1]

pts = p8,p4,p0
rs.AddCurve(pts)

def makeFins():
xlist = range(1, 19, 2)
ylist = range(1, 19, 2)
for x in xlist:
for y in ylist:
crv0 = makeCrv(x,y)

makeFins()

def makeGrids():
ptlist = []
xlist = range(20)
ylist = range(20)
for x in xlist:
yptlist = []
for y in ylist:

cord = x,y,0
#rs.AddPoint(cord)
yptlist.append(cord)
ptlist.append(yptlist)
return ptlist

#ptlist = makeGrids()

def makeCircles(ptlist):
xlist = range(20)
ylist = range(20)
for x in xlist:
for y in ylist:
pt = ptlist[x][y] #1st bracket is the first index and second bracket is the nested item
rad = 0.5
rs.AddCircle(pt,rad)

#makeCircles(ptlist)

def makeRectangles(ptlist):
xlist = range(20)
ylist = range(20)
for x in xlist:
for y in ylist:
pt0 = ptlist[x][y]
pt1 = ptlist[x+1][y]
pt2 = ptlist[x+1][y+1]
pt3 = ptlist[x][y+1]
pts = pt0,pt1,pt2,pt3,pt0
rs.AddPolyline(pts)

#makeRectangles(ptlist)

def makeTriangles(ptlist):
xlist = range(20-1)
ylist = range(20-1)
for x in xlist:
for y in ylist:
pt0 = ptlist[x][y]
pt1 = ptlist[x+1][y]
pt2 = ptlist[x+1][y+1]
#1st bracket is the first index and second bracket is the nested item
pts = pt0,pt1,pt2,pt0
rs.AddPolyline(pts)

#makeTriangles(ptlist)

def makeTriangles2(ptlist):
xlist = range(20-1)
ylist = range(20-1)
for x in xlist:
for y in ylist:
pt0 = ptlist[x][y]
pt1 = ptlist[x+1][y]
pt2 = ptlist[x+1][y+1]
pt3 = ptlist[x][y+1]
xm = pt3[0] + pt2[0]/2
ym = pt2[1]
ptm = xm,ym,0
pts = pt0,pt1,pt2,pt0
rs.AddPolyline(pts)

#makeTriangles2(ptlist)

def makeTriangles3(ptlist):
xlist = range(0,20-1,2)
ylist = range(0,20-1,3)
for x in xlist:
for y in ylist:
pt0 = ptlist[x][y]
pt1 = ptlist[x+1][y]
pt2 = ptlist[x+1][y+1]
pt3 = ptlist[x][y+1]
xm = (pt3[0] + pt2[0])/2
ym = pt2[1]
ptm = xm,ym,0
pts = pt0,pt1,ptm,pt0
rs.AddPolyline(pts)

#makeTriangles3(ptlist)

def makeTriangles4(ptlist):
xlist = range(0,20-1,1)
ylist = range(0,20-1,1)
pt = 10.5, 10.5, 0
for x in xlist:
for y in ylist:
pt0 = ptlist[x][y]
pt1 = ptlist[x+1][y]
pt2 = ptlist[x+1][y+1]
pt3 = ptlist[x][y+1]
xm = (pt3[0] + pt2[0])/2
ym = pt2[1]
ptm = xm,ym,0
pts = pt0,pt1,pt,pt0
rs.AddPolyline(pts)

#makeTriangles4(ptlist)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s