
I did a few renderings of architectural and product design projects for Hawaii-based Global Living Systems. Design & modeling by Patrick Tozier and Hemasaila Rajan.

Download and load this rvb file into Rhino. As soon as you do that, a cylinder will appear. That's thanks to this code down on line 63, after defining the Cylinder Class:Dim objPersistentCylinderLooks pretty clear, doesn't? We've made a new Cylinder, without having to worry about how, and set it's Height to 10. Much more elegant than without classes, if you wanted to keep track of these things you'd have to store the required parameters to build the cylinder and the identifying string for the solid as separate variables and pass them to a "ModifyCylinder" function. Then if you wanted to build an array of cylinders...ugh!
'create the cylinder object on loading the script file
Set objPersistentCylinder=New Cylinder
objPersistentCylinder.Height=10
Line 68
Sub MakeTemporaryCylinder()
Dim objMyCylinder
Set objMyCylinder=New Cylinder
objMyCylinder.Radius=3
objMyCylinder.Pick
'pause for user input, just to show it exists
Dim strInput
strInput=Rhino.GetString("The volume of this cylinder is " & objMyCylinder.Volume &". Press any key to continue...")
'after this sub exists, the object ceases to exist and the cylinder is deleted as per Class_Terminate()
End Sub
This illustrates how objects have "scope" just like normal variables. The objMyCylinder variable was declared inside the function, so as soon as you press any key at the prompt, the object ceases to exist. In the class definition there's a special subroutine called Class_Terminate() you can use to execute any cleanup code you like at that time, like in this case deleting the actual solid.Public Sub Pick()Functions, Subs, and variables can be defined as Public or Private. Pick is Public, so that the rest of the program can call it, but int_strSolid, the GUID of the cylinder solid itself, is one of the Private properties.
Rhino.SelectObject int_strSolid
End Sub
Public Property Get VolumeSo, we could make a Property Get for the GUID like this:
'Retrieve the volume of the cylinder
Volume=Rhino.SurfaceVolume(int_strSolid)(0)
End Property
Public Property Get GUID
GUID=int_strSolid
End property
Public Function GetGUID()The difference is that as far as the calling code is concerned, "GUID" is just a property like any other rather than the result of a function. So both more elegant, isolating the logic of what you want to do with your object from the nasty dirty business of making it work, plus it means that if at some stage your GUID was a simple public property, and you decided to do something more complex with it, then that change would be transparent to the rest of your code.
GetGUID=int_strSolid
End Function
Sub ChangePersistentCylinder()This function randomly modifies the radius and height of the cylinder, automatically redrawing. The last chunk of code made use of Public Property Get, this makes use of Public Property Let, and shows why you would use it.
'randomly change radius and height
Randomize
Dim dblRadius,dblHeight
dblRadius=1+Rnd*7
dblHeight=5+Rnd*10
objPersistentCylinder.Radius=dblRadius
objPersistentCylinder.Height=dblHeight
End Sub
Public Property Let Radius(dblRadius)The Property Let stores the entered radius in the internal radius variable, so that it can't get changed unexpectedly by outside code, and calls a Redraw function that deletes the cylinder and rebuilds it with the new dimensions.
'Set the radius
int_dblRadius=dblRadius
Redraw
End Property




This is where the Brazil Utility Material comes in. If we place the floor material inside a Brazil Utility Material, we can tweak, among many other things, the amount of lighting it emits and receives from global illumination. To do this, I created a Utility Material and assigned it to the floor object, then inserted the old floor material into the Base slot of the Basic material overrides section. I then scrolled down to the Global Illumination Parameters and reduced the Level and Saturation values for generating and receiving GI.

Here I switched the sink to a glass material and adjusted the ground plane to show the effect of the planar background setting.
With the planar background override turned on, you can see it has no effect on what's refracted or refracted in the glasss.