import rhinoscriptsyntax as rs
import math
class myPolygon:
def __init__(self, radius, sides):
self.radius = radius
self.sides = sides
theta = (2*math.pi)/self.sides
pt01 = rs.AddPoint(self.radius, 0, 0)
pts = []
pts.append(pt01) #adding this to the empty list
self.origin = [0,0,0] #origin variable as a property of polygon
#this is bc we will later change this origin point
degrees = theta*(180/math.pi)
#want to add other points
#to do so use rptate object method in rhino
#to rotate these points around based on angle theta
#for a certain number of times, so need loop:
for i in range(1, self.sides):
tempPt = pts[-1] #to use very last pt in list of pts
newPt = rs.RotateObject(tempPt, self.origin, degrees, None, True)
pts.append(newPt)
pts.append(pt01) #to end, add the first point
self.polygon = rs.AddPolyline(pts)
def joinPolylines(self):
rs.JoinCurves(rs.AllObjects, True)
def makePipe(self):
crv = rs.AllObjects()
rs.AddPipe(crv, 0 .1)
polygon1 = myPolygon(4,4)
polygon1 = myPolygon(5,5)
polygon2 = myPolygon(6,6)
polygon3 = myPolygon(7,7)
polygon4 = myPolygon(8,8)
polygon5 = myPolygon(9,9)
polygon6 = myPolygon(10,10)
polygon7 = myPolygon(11,11)
polygon8 = myPolygon(12,12)

### Like this:

Like Loading...

*Related*