Geometry Solutions for CAD

In this lab experiment we take some very simple Visual Basic code and use it to solve and update certain geometric information in Rhino CAD dynamically.

The first example is an ellipse, we’re looking to solve the area and the ratio of major to minor radius that make up an ellipse. Also when this ratio is equal to 1, the information should update and read out as a circle and give the circumference, area, and diameter. Below is a sample of the code.

Within the VB component that makes up part of the definition, a simple If…Then…Else statement was written to read whether a circle or ellipse was being created. Also the variables of Diameter, Circumference, Area, and Ratio were defined As Double within VB.

For those who are not familiar, we built a definition in a Rhino CAD plug-in called grasshopper that allows the ability to write VB code within the definition and feed that information as data into Rhino. Below is what the definition looks like in Grasshopper.

The second example was a right triangle with the intent of solving the length of the hypotenuse using Pythagorean’s theorem as well as the perimeter and the area. Some simple math functions were written in the VB component including squaring an input into the component and finding the square root using the & Math.Sqrt function of VB. A variable was declared As Double type, defining Pythagorean’s theorem.

The end result was the ability to throw floating point numeric values into the definitions created and have a real-time update readout of information defining both of the geometric shapes.


patagonia_6 miltech backpackinglight biomimicry eastonlogo02_for_web adiochain_for_web sway