Cushion Panels Script in Python for GH


This is a code snippet I have been using long time ago written in VB. Just thought of re-writing the code in Python, which is clearer to understand, but I had some problems with datatrees so I had to change the structure of code resulting into a few more lines of code.


This routine utilizes rhinocommon (if you are looking for rhinoscript methods here, in this blog, you are terribly wrong), and simple list management. The code is pretty straightforward, as you can see.

#Library imports
import Rhino.Geometry as rc

#main routine
data_T = []
data_T2 = []
breps = []

for i in range(len(panels)):
    temp_list = []
    temp_list2 = []
    cn = centroids[i]
    nrm = normals[i]
    upper_p = cn+(nrm*height)
    upper_p = rc.Point(upper_p)
    lower_p = cn-(nrm*height)
    lower_p = rc.Point(lower_p)

for j in range(len(data_T)):
    ienum = data_T[j]
    ienum2 = data_T2[j]
    b = rc.Brep.CreatePatch(ienum,10,10,0.0005)
    b2 = rc.Brep.CreatePatch(ienum2,10,10,0.0005)

cushion_panels = breps

You can download the definition along  with the python code here.



3 thoughts on “Cushion Panels Script in Python for GH

  1. this one looks fabulous! Thanks four sharing the script and the GH def as well, I just cannot wait to give it a try. COuld you share the VB script you’ve mentioned as well? It sounds like interesting to do this in VB, I’m curious:)

    • Hi,
      It’s more or less the same routine only written in and without nested lists, but DataTrees instead. So each branch stands for a nested list in this algorithm. Will post it sometime soon.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s