algorithmic modeling for Rhino
I have been working on this script in python to generate a hexagonal pattern based off a UV coordinate system [http://jluebker.wordpress.com/2013/04/10/hexagonal-grid-on-surface-...]. I am trying to get this to work in grasshopper to begin to add some of the graph mapper functionality to vary the UV coordinates. But first i need need to figure out how to transitions several parts of the code one of them being this following if statement:
[code]
for i in range(intU):
for j in range(intV):
if j %3== 0:
#test
#rs.AddPoint(PtMtx[(i,j+1)])
#list1
self.HexCrvsV1.append(rs.AddLine(PtMtx[(i,j)], PtMtx[(i,j+1)]))
#list2
self.HexCrvsV2.append(rs.AddLine(PtMtx[(i+1,j)], PtMtx[(i+1,j+1)]))
elif j %3== 1:
centPt2 = self.MidPt(PtMtx[(i,j)], PtMtx[(i+1,j+1)])
#rs.AddPoint(centPt2)
#list1
self.HexCrvsV1.append(rs.AddLine(PtMtx[(i,j)], centPt2))
#list2
self.HexCrvsV2.append(rs.AddLine(PtMtx[(i+1,j)], centPt2))
#list3
self.HexCrvsU.append(rs.AddLine(PtMtx[(i,j)], centPt2))
self.HexCrvsU.append(rs.AddLine(PtMtx[(i+1,j)], centPt2))
elif j %3== 2:
centPt3 = self.MidPt(PtMtx[(i,j)], PtMtx[(i+1,j+1)])
#rs.AddPoint(centPt3)
#list1
self.HexCrvsV1.append(rs.AddLine(centPt2, centPt3))
self.HexCrvsV1.append(rs.AddLine(centPt3, PtMtx[(i,j+1)]))
#list2
self.HexCrvsV2.append(rs.AddLine(centPt2, centPt3))
self.HexCrvsV2.append(rs.AddLine(centPt3, PtMtx[(i+1,j+1)]))
#list3
self.HexCrvsU.append(rs.AddLine(centPt3, PtMtx[(i,j+1)]))
self.HexCrvsU.append(rs.AddLine(centPt3, PtMtx[(i+1,j+1)]))
[end code]
I am assuming that this could possibly done with a dispatch but does anyone know if there is a simple way of accessing the branch indecies and dispatching them?
Tags:
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by