Пример #1
0
def surface_grid(ptss, closed_u=False, closed_v=False):
    if closed_v:
        ptss = [pts + [pts[0]] for pts in ptss]
    if closed_u:
        ptss = ptss + [ptss[0]]
    if len(ptss) == 2 and len(ptss[0]) == 2:
        return rh.AddSrfPt(ptss[0] + ptss[1])
    else:
        if len(ptss) == 2:
            ptss = [ptss[0], map(intermediate_loc, ptss[0], ptss[1]), ptss[1]]
        elif len(ptss[0]) == 2:
            ptss = map(
                lambda cs: [cs[0],
                            intermediate_loc(cs[0], cs[1]), cs[1]], ptss)
        ps = [Pt(pt) for pts in ptss for pt in pts]
        nu = len(ptss)
        nv = len(ptss[0])
        return rh.AddSrfPtGrid(
            (nu, nv), ps,
            (max(2 * int(nu / 10) + 1, 2), max(2 * int(nv / 10) + 1, 2)),
            (closed_u, closed_v))
Пример #2
0
vp =2*math.pi
vpstep=vp/(xy[1])


points = []
a=2


for i in rs.frange(-0.5,0.5,op):
    for j in rs.frange(0,vp,vpstep):
        b=j/2
        x=math.cos(j)*(a+i*math.cos(b))
        y=math.sin(j)*(a+i*math.cos(b))
        z=i*math.sin(b)
        pt = x,y,z
        points.append(pt)


xy=(xy[0]+1,xy[1]+1)


rs.AddLayer('surface',Color.Black)
srf=rs.AddSrfPtGrid(xy, points)
rs.ObjectLayer(srf,'surface')


rs.EnableRedraw(False)


Пример #3
0
geoL = rs.GetString("geo-locate", "Y", ["N", "Y"])
if geoL == "Y":
    geoL = True
else:
    geoL = False

DEMdata = readDEM(path)

#assign variables
ncols = DEMdata[0][0]
nrows = DEMdata[0][1]
xllcorner = DEMdata[0][2]
yllcorner = DEMdata[0][3]
cellsize = DEMdata[0][4]
NODATA_value = DEMdata[0][5]

landscape = DEMdata[1]

#draw landscape
rs.EnableRedraw(False)

srfPts = []
for i in range(len(landscape)):
    for j in range(len(landscape[i])):
        nowCellPt = myPos(i, j, landscape)
        srfPts.append(nowCellPt)

srf = rs.AddSrfPtGrid((nrows, ncols), srfPts)

rs.EnableRedraw(True)
Пример #4
0
import rhinoscriptsyntax as rs
import random

xOffset = 3
yOffset = 4
count = xOffset, yOffset

points = []

for i in range(0, count[0]):
    for j in range(0, count[1]):
        z = random.uniform(-5,5)
        pt = i*xOffset, j*yOffset, z
        points.append(pt)
        
rs.AddSrfPtGrid(count, points)
Пример #5
0
#Rachel Lutes
#08/30/2018
#ARCH 7210 Ideas Seminar
#This script creates a surface from a grid of random points

import rhinoscriptsyntax as rs
import random
points = []
u = 10
v = 10

for i in range(0, u):
    for j in range(0, v):
        points.append(
            rs.AddPoint((i + random.random()), (j + random.random()),
                        random.random()))

rs.AddSrfPtGrid((u, v), points)
Пример #6
0
newCrv = rs.ProjectCurveToSurface(crv, srf, [0, 0, 1])[0]

srfPts = []
uRes = 100
vRes = 100
uDom = rs.SurfaceDomain(srf, 0)
uDom = uDom[1] - uDom[0]
vDom = rs.SurfaceDomain(srf, 1)
vDom = vDom[1] - vDom[0]

#sample surface

ptList = []
for i in range(uRes + 1):
    for j in range(vRes + 1):
        nowU = i * (uDom / uRes)
        nowV = j * (vDom / vRes)
        nowPt = rs.EvaluateSurface(srf, nowU, nowV)
        parCrv = rs.CurveClosestPoint(newCrv, nowPt)
        onCrv = rs.EvaluateCurve(newCrv, parCrv)
        if (rs.Distance(nowPt, onCrv) < 40):
            nowPt[2] = 0
        ptList.append(nowPt)

#generate surface
newSrf = rs.AddSrfPtGrid((uRes + 1, vRes + 1), ptList)

#print newSrf

#delete projected curve
rs.DeleteObject(newCrv)