0 Replies - 394 Views - Last Post: 18 August 2015 - 07:55 PM Rate Topic: -----

#1 Cmrobins   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-August 15

Python + Rhino Geometry Help

Posted 18 August 2015 - 07:55 PM

Hey everyone, I am currently undertaking a course in python for a semester as part of my architectural degree, and I need a little bit of help with part of my script.

My task was to create a paneling system where each panel was different to the other in same form, but had to have some logic behind it (so can't use .random).

Currently my script generates the panels, and what I would like to do is change the panelheight of each panel to either get bigger from bottom left to top right, or change height of the panel depending on the position of an attractor. (the attractor option sounds more difficult but would give a nicer result i think). Any help or suggestions would be greatly appreciated.

Here is my script:

import rhinoscriptsyntax as rs #imports Rhino script so we can access rhino geometry "as rs" is an alias so we no longer need to type the entire rhinoscriptsyntax, rather just rs
import Rhino.Geometry as rg
import random as rm

noPanelsX = 10 #this allocates a number of panels along the X axis
noPanelsY = 10 #this allocates a number of panels along the Y Axis
sPanelX = 10 #this determines the panels width
sPanelY = 20 #determines panels length




rs.EnableRedraw(False)

for i in range(noPanelsX): #generates panels from the list above
    for q in range(noPanelsY):
        panelheight = 0.5 + 1 #sets the panel heights
        scalefactor = 1 #sets the panel scale
        
        
        
        pt1 = rg.Point3d( (i*sPanelX),(q*sPanelY),0 ) 
        pt2 = rg.Point3d( (i*sPanelX),(q*sPanelY) + sPanelY,0 )
        pt3 = rg.Point3d( (i*sPanelX) + sPanelX,(q*sPanelY) + sPanelY,0 )
        pt4 = rg.Point3d( (i*sPanelX) + sPanelX,(q*sPanelY),0 )
        
        pt5 = rg.Point3d( (i*sPanelX),(q*sPanelY),panelheight )
        pt6 = rg.Point3d( (i*sPanelX),(q*sPanelY) + sPanelY,panelheight + panelheight )
        pt7 = rg.Point3d( (i*sPanelX) + sPanelX,(q*sPanelY) + sPanelY,panelheight +panelheight )
        pt8 = rg.Point3d( (i*sPanelX) + sPanelX,(q*sPanelY),panelheight )
        
        thepanel = rs.AddBox( (pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8) )

        print thepanel
        rs.ScaleObject(thepanel, pt1, (scalefactor,1,1) )
        



rs.EnableRedraw(True)




Image of geometry Generated:

https://i.gyazo.com/...1814e8789ec.png

Is This A Good Question/Topic? 0
  • +

Page 1 of 1