Hello,
i get this error “Iteration over non-sequence of type NoneType” all the time, and i dont know why. I know that the problem lies in the line 78 but i am a beginner and copied the code from the professor. So i dont know exactly what im doing and therefor i dont know whats wrong.
for face_index in vertex_faces:
This is the problematic line.
Below is the code.
Best whishes to all of you. Hope somebody can help me.
import rhinoscriptsyntax as rs
import math
import Rhino as rc
import Rhino
a=400
b=100
c=1.5
d=1
f=0
n_u=16
n_v=16
u_closed=True
v_closed=True
edge_list =
point_list =
polygon_list =
origin = rc.Geometry.Point3d(0,0,0)
rs.EnableRedraw(False)
#generate the points
for i in range(0,n_v+1):
v = i / n_v
for j in range(0,n_u+1):
u = j / n_u
x = 10*((0.1+math.sin(3i/160math.pi))math.cos(cj/bmath.pi))
y = 10((0.1+math.sin(3i/160math.pi))math.sin(cj/bmath.pi))
z = 10(0.1+j/a+(0.3-0.231*i/40)math.cos(i/20math.pi))
point_list.append ([x,y,z])
generate the polygons & edges
for i in range(0,n_v):
for j in range(0,n_u):
if (not u_closed):
p0 = i*(n_u+1)+j
p1 = i*(n_u+1)+j+1
if (not v_closed):
p2 = (i+1)(n_u+1)+j+1
p3 = (i+1)(n_u+1)+j
else:
p2 = ((i+1) % n_v)(n_u+1)+j+1
p3 = (i+1)(n_u+1)+j
else:
p0 = i*(n_u)+j
p1 = i*(n_u)+((j+1) % n_u)
if (not v_closed):
p2 = (i+1)(n_u)+((j+1) % n_u)
p3 = (i+1)(n_u)+j
else:
p2 = ((i+1) % n_v)(n_u)+((j+1) % n_u)
p3 = ((i+1) % n_v)(n_u)+j
polygon_list.append ([p0,p1,p2,p3])
edge_list.append ([p0,p1])
edge_list.append ([p3,p0])
if (not u_closed):
if (j == n_u-1):
print “u edge”
edge_list.append([p1,p2])
if (not v_closed):
if (i == n_v-1):
print “v edge”
edge_list.append([p2,p3])
mesh = rs.AddMesh(point_list,polygon_list)
face_normals = rs.MeshFaceNormals(mesh)
point_normals =
for k in range(0,len(point_list)):
vertex_faces = rs.MeshVertexFaces(mesh, k)
p_normal = Rhino.Geometry.Vector3d(0,0,0)
for face_index in vertex_faces:
p_normal = p_normal + face_normals[face_index]
p_normal = rs.VectorUnitize(p_normal)
point_normals.append(p_normal)
#Pasta = rs.AddMesh(point_list,polygon_list)
#rs.ScaleObject(Pasta,origin,[d,d,d])
#rs.RotateObject(Pasta,origin,f)
points = point_list
edges = edge_list
rs.EnableRedraw(True)
geometry = ghdoc.Objects.Geometries