Hi there
I finished my first Script ever (feel a bit proud ) and it works fine (it’s not perfect but does the job).
Unfortunately it’s only working in Rhino6 WIP (for Mac) and not on my Rhino5 Mac Version…
Here’s my script. It produces a Rectangle with variable number of Rectangles inside and a fixed distance between them. It’s usefull for elevations of windowframes or to layout photos.
(sorry, i don’t know how to porperly quote code…)
import rhinoscriptsyntax as rs
rs.AddLayer("inside", color = (0, 0, 255))
rs.AddLayer("outside", color = (255,0,0))
plane = rs.WorldXYPlane()
FW = rs.GetReal("Frame Width", number = 0.1) # Definiert Rahmenbreite
Q = rs.GetInteger("Quantity") # Anzahl Fenster
S = rs.GetPoint("Holy Cow! Define the lower corner") # Startpunkt
E = rs.GetPoint("Define the upper corner") # Endpunkt
outrec =rs.AddRectangle(plane, S, E) # Zeichnet aeusseres Rechteck
rs.ObjectLayer(outrec,"outside")
SX = S[0]
EX = E[0]
SY = S[1]
EY = E[1]
W = (EX-SX) # Width, die gesamte Fensterbreite
H = abs(EY-SY) # Height, die gesamte Fensterhoehe
WW = (W-(Q+1)*FW)/Q # WindowWidth, Breite eines einzelnen Fensters
WH = H-2*FW # WindowHeight, Hoehe des Fensters
for i in range(1,Q+1):
A0X = SX + i*FW + (i-1)*WW
A0Y = SY + FW
A2X = SX + i*FW + i*WW
A2Y = SY + FW + WH
A0 = rs.CreatePoint(A0X, A0Y, 0)
A2 = rs.CreatePoint(A2X, A2Y, 0)
rect = rs.AddRectangle(plane, A0, A2)
rs.ObjectLayer(rect, "inside")
Any help, very much appreciated!
Thanks =)