Using Python to connect points

   2016   0   1
User Avatar
Member
26 posts
Joined: Sept. 2010
Offline
Hello again!

I am creating several layers of points like this:

for point in geo.points():
for i in range(-1,levels):
if i == -1:
pos = point.position()
else:
pos = point.position() + hou.Vector3((0, level_height,0))
point = geo.createPoint()
point.setPosition(pos)
point.setAttribValue(pointlevel, i+1)
point.setAttribValue(building, cluster)

When I try to create a polygon for each layer of points, by storing it in a list like this:

for point in geo.points():
for i in range(-1,levels):
if i == -1:
pos = point.position()
else:
pos = point.position() + hou.Vector3((0, level_height,0))
coord.append(pos)
point = geo.createPoint()
point.setPosition(pos)
point.setAttribValue(pointlevel, i+1)
point.setAttribValue(building, cluster)

for position in coord:
point = geo.createPoint()
point.setPosition(position)
poly.addVertex(point)


I get vertically connected polygons…(See image 2)

My question is, how can I create a polygon for each layer instead of for the whole list?

…I somehow get the feeling that it has to do with my placement of the geo.createPolygon or the list…

Attachments:
error_polygon.jpg (119.1 KB)

  • Quick Links