RhinoCommons To Python (.rvb to .py)

There’s this script that makes it easier to make stairs, the problem is that it is a rhinocommon script (.rvb) and Rhino on OSX to my knowledge/experience just allows for running python scripts.

Working on windows (because it’s a .rvb), however I work on Mac OS as well and would like to use this script.riserMaker.rvb (2.4 KB)

''  http://ofthiswearesure.com/rhino
''  (c) bryan boyer 2008, of this we are sure
''  this script comes with no guarantee and
''  barely any help. be smart, save you work,
''  sleep regularly, tip your waiter, and
''  clean up your own mess.
''  risermaker makes basic risers on a sloped surface!
''  define the two edges of the sloped surface and a 
''  height for the riser and watch in awe!

Option Explicit

Dim edge1, edge2, riserHeight, line1, line2
Dim len1, len2, yDomain1, yDomain2
Dim points1, points2,i
Dim p1,p2,p3,p4,p5,p6, myStep

' For some reason joinsurfaces is not working later on, so instead we do it with a COMMANd call. Dumb.
Call rhino.UnselectAllObjects()

edge1 = Rhino.getPoints(True,False,"Bottom of stair edge1","top of stair edge1",2)
edge2 = Rhino.getPoints(True,False,"Bottom of stair edge2","top of stair edge2",2)
riserHeight = rhino.GetReal("how high is the riser?")

line1 = rhino.addline(edge1(0),edge1(1))
line2 = rhino.addline(edge2(0),edge2(1))

yDomain1 = edge1(1)(2)-edge1(0)(2)
yDomain2 = edge2(1)(2)-edge2(0)(2)

len1 = Abs((riserHeight * Rhino.CurveLength(line1)) / yDomain1)
len2 = Abs((riserHeight * Rhino.CurveLength(line2)) / yDomain2)

points1 = rhino.DivideCurvelength(line1,len1,False)
points2 = rhino.DivideCurvelength(line2,len2,False)

For i = 0 To ubound(points1)-1
	p1 = points1(i)
	p2 = array(points1(i)(0),points1(i)(1),points1(i)(2)+riserHeight)
	p3 = points1(i+1)
	p4 = points2(i)
	p5 = array(points2(i)(0),points2(i)(1),points2(i)(2)+riserHeight)
	p6 = points2(i+1)
	Call makeStep(p1,p2,p3,p4,p5,p6)

Call rhino.deleteObjects(array(line1,line2))
rhino.Print "Riser depth is between " + FormatNumber(Rhino.Distance(p2,p3),2) + " and " + FormatNumber(Rhino.Distance(p5,p6),2)

Function makeStep(p1,p2,p3,p4,p5,p6)
	Dim s1,s2,s3,s4,s5, bobby
	s1 = rhino.AddSrfPt(array(p1,p2,p3))
	s2 = rhino.AddSrfPt(array(p4,p5,p6))
	s3 = rhino.AddSrfPt(array(p1,p4,p5,p2))
	s4 = rhino.AddSrfPt(array(p2,p5,p6,p3))
	s5 = rhino.AddSrfPt(array(p1,p4,p6,p3))
	rhino.command("Join ")
	makeStep = array(s1,s2,s3,s4,s5)
End Function

Thanks for the help

Hi Richard,

*.rvb is a RhinoScript (vb) not Python or RhinoCommon. You might try below, i’ve just made a conversion to Python without changing anything in the general code:

RiserMaker.py (2.3 KB)


1 Like

Richard -

We have added more Python documentation that may help with the transition from RVB to Python and Rhinoscriptsytnax.

1 Like

May I know which page exactly can I refer to ? I am not sure which is for Mac with which software installed especially when python ships with mac rhino now.

I try to look in here.

But it seems there is no command for Loadscript in mac rhino

as far as i know now there seems to be no direct transferal way from .rvb to .py…? like copy and paste something

I have a little hope… that is to be able to use the rhinoscript from this website

which would be extremely helpful for Mac users!!

Unfortunately, .rvb’s do not run on Mac, and likely never will. So any .rvb needs to be translated into Python to run on Mac. Depending on the size of the script, this can take from just a few minutes to hours if it’s really complex. But, there are already a large collection of python scripts out there, more every day, so it is probably best to ask here for what you, it might already exist in .py. Pascal has translated quite a few of his scripts already.


I see your point. Is there any recommended websites where I can reference from, especially those from Pascal?

Hi Li

I think the only way (maybe …) would be a RhinoScript interpreter written in IronPython
But IMO it would not be an easy task …
VBS syntax aside, there are a lot of little (or not so little) things that are different from RhinoScript in rhinoscriptsyntax.
(Speaking for Rhino 5 here, don’t know in things will be different in Rhino 6)

“People” are in the process / have been encouraged to place scripts on the Food4Rhino site. There doesn’t seem to be a scipt category - pretty much everything is an “app”.

Again, for the moment, I think it’s best just to ask here for tools you need as you need them…

There is a script category if you check “resources” as below -

However, @Rodri this looks pretty limited for the moment, and I agree with Wim, having everything under the “App” category is pretty general and not very transparent… It would be like having everything in Rhino under a “Make” menu. I still think that items for Rhino and items for Grasshopper should be separate categories, and if people do start throwing scripts up there, having a few hundred scripts in one flat “Scripts” category is going to make it impossible to find anything (my 2¢).


1 Like