\nCodon

Free-form & flat quads with Rhino.Python

Posted in examples, tutorials by pierre forissier on October 5, 2011

Fossile-like structures made of flat quad panels. Panels can be assembled along their folded sides. The script works with free from surfaces (trimmed or not_see conditional minimum distance between any point evaluated within surface domain and the base surface_as per Python Primer example)

CODE:
import rhinoscriptsyntax as rs
import random #import  random module

def SurfaceQuad():
    idSurface=rs.GetObject("Select Surface",8,True,False)
    if not idSurface:return
    intCountU = rs.GetInteger("Number of panels in U direction",20,10)
    if not intCountU:return
    intCountV = rs.GetInteger("Number of panels in V direction",7,5)
    if not intCountV:return
    uDomain=rs.SurfaceDomain(idSurface,0)
    vDomain=rs.SurfaceDomain(idSurface,1)
    uStep=uDomain[1] - uDomain[0]
    uStep=uStep / intCountU
    vStep=vDomain[1] - vDomain[0]
    vStep=vStep / intCountV

    #Tolerance in between panels
    dblTolU = uStep/100
    dblTolV = dblTolU*intCountU/intCountV

    rs.EnableRedraw(False)

    for v in rs.frange(vDomain[0],vDomain[1]-vStep-vDomain[0],vStep):
        for u in rs.frange (uDomain[0],uDomain[1]-uStep-uDomain[0],uStep):
            #Evaluate panel coordinates on idSurface

(more…)

Tagged with: , ,
Follow

Get every new post delivered to your Inbox.

Join 25 other followers