課題1コード


import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import math

objs = []
pls = []
pts = []
zz = 0
for i in range(int(length)):
    xx = i*200
    rad = math.radians(i*freq)
    yy = math.sin(rad)*amp
    pos = rg.Point3d(xx,yy,zz)
    pt = rs.AddPoint(pos)
    pts.append(pt)
    objs.append(pt)

pts.reverse()
for i in range(int(length)):
    xx = i*200
    rad = math.radians((i+5)*freq)
    yy = math.sin(rad)*amp
    yy *= 5
    yy += depth
    pos = rg.Point3d(xx,yy,zz)
    pt = rs.AddPoint(pos)
    pts.append(pt)
    objs.append(pt)
pts.append(pts[0])
if mode == 0:
    pl = rs.AddPolyline(pts)
elif mode == 1:
    pl = rs.AddCurve(pts)
else:
    pl = rs.AddInterpCurve(pts)
pls.append(pl)
objs.append(pl)

#--------------------------->
pts = []
zz = 2000
for i in range(int(length)):
    xx = i*200
    rad = math.radians(i*freq)
    yy = math.sin(rad)*amp
    yy /= (i+1)
    pos = rg.Point3d(xx,yy,zz)
    pt = rs.AddPoint(pos)
    pts.append(pt)
    objs.append(pt)

pts.reverse()
for i in range(int(length)):
    xx = i*200
    rad = math.radians((i+5)*freq)
    yy = math.sin(rad)*amp
    yy *= 8
    yy += depth
    pos = rg.Point3d(xx,yy,zz)
    pt = rs.AddPoint(pos)
    pts.append(pt)
    objs.append(pt)
pts.append(pts[0])
if mode == 0:
    pl = rs.AddPolyline(pts)
elif mode == 1:
    pl = rs.AddCurve(pts)
else:
    pl = rs.AddInterpCurve(pts)
pls.append(pl)
objs.append(pl)

lf = rs.AddLoftSrf(pls)
objs.extend(lf)
a = objs

Comments are closed.