Tuesday, April 24, 2012

section along curves


An exercise similar to the one we did today in class but with a pre-defined section instead of a simple circle:

import rhinoscriptsyntax as rs
curve =  rs.GetObject("curve",4)
section =  rs.GetObject("section",4)
domain = rs.CurveDomain(curve)
divisions = 20
step = (domain[1]-domain[0])/ divisions
sections = []
val = 0
startplane = rs.CurveFrame(curve,0)
startplainaxis = [[0,0,0], [1,0,0], [0,1,0]]

for i in rs.frange(domain[0],domain[1],step):
    perpplane = rs.CurvePerpFrame(curve,i)
    refplain = [perpplane[1],perpplane[2],perpplane[3]]
    newsec = rs.OrientObject(section,startplainaxis,refplain,1)
    centerpoint = rs.CurveAreaCentroid(newsec)
    vector = rs.VectorCreate([0,0,0],centerpoint[0])
    rs.MoveObject(newsec,vector)
    sections.append(rs.MoveObject(newsec,perpplane[0]))
rs.AddLoftSrf(sections)

No comments:

Post a Comment