Script only Working on Rhino6 WIP (Mac) an not on Rhino 5(Mac)

Hi there
I finished my first Script ever (feel a bit proud :slight_smile: ) 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 =)

Enclose code in tripple backticks

1 Like

I’ve edited your post with the necessary backticks.

1 Like

Thanks! I think I got it now ;)

Any idea about the code? It seams to be so basic that I’m surprised it’s not running on Rhino5Mac… :frowning:

Do you get any sort of error?

Yes, it does:

Message: ‘module’ object has no attribute ‘CreatePoint’

Traceback:

line 33, in <module>, “/Users/X/X/X/99 My first Rhino Python Scripts/08 Fenster 05.py”

rs.CreatePoint() is a method that only was added for V6. Use instead rs.coerce3dpoint([x,y,z]) - that should work for any version on any platform.

1 Like

Nice! It works now =)

Meilleures salutations de zurich!

Greüzi aus der Westschweiz!

1 Like