designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Revisiting RhinoScript

July 19, 2013 | Algorithms
#hexagon #vbnet

Recently, I returned to old fashion RhinoScripts in order to recapture its idea and functionalities again. After almost 10 years, this is my first experiment on creating a custom function that draws hexagonal grids. I tried to implement a fast process for it, however, there could be much faster ones. This script focuses on using functions, variables, and object arrays. I’ll continue to make more of these simple exercises and revisit some of the older studies on this blog page that were done with Grasshopper. So far, the initial experiment on a hexGrid function works properly. Below is the Rhinoscript code if you want to try it.

Option Explicit
Call Main()
Sub Main()
Dim testhex, testOrigin, testSize, testIter
testOrigin = Rhino.GetPoint("Center point of grid")
testSize = Rhino.GetReal("Grid size", 2, 0.1)
testIter = Rhino.GetInteger("Number of Iterations", 5, 1)
testhex = hexGrid(testOrigin, testSize, testIter)
' Rhino.SelectObject testhex(3, 5)
End Sub
Function hexGrid(ptOrigin, intSize, intIter)
'**************************************************************
' Purpose: Draw hexagonal grid
' Inputs : ptOrigin: Origin point of the grid
'          intSize: Size of grid cells
'           intIter: Number of iterations
' Returns: A 2-dimensional array of grid cells (polygons)
'**************************************************************
Dim hexReturn(100,100), hexOrigin, hexOrigin2, i, j, arrPly(100), arrHex(100)
hexOrigin = Rhino.MovePlane(Rhino.WorldXYPlane, ptOrigin)
hexReturn(0, 0) = Rhino.AddPolygon(hexOrigin, intSize, 6, True)
For i = 1 To intIter
arrPly(i) = Rhino.AddPolygon(hexOrigin, intSize * 1.5 * i, 6, False)
arrHex(i) = Rhino.DivideCurve(arrPly(i), i * 6, True, True)
Rhino.DeleteObject arrPly(i)
For j = 0 To (i * 6) - 1
hexOrigin2 = Rhino.MovePlane(Rhino.WorldXYPlane, arrHex(i)(j))
hexReturn(i, j) = Rhino.AddPolygon(hexOrigin2, intSize, 6, True)
Next
Next
hexGrid = hexReturn
End Function
Revisiting RhinoScript hexagon, vbnet
Rhinoscript file (RVB)Download

Cite this post

Yazar, T. (2013, July 19). Revisiting RhinoScript. designcoding. Retrieved August 24, 2026, from https://www.designcoding.net/revisiting-rhinoscript/

Related Posts

Hexagonal Star Lattice

December 18, 2023

Here are the variations of classical six-pointed star patterns generated by Grasshopper. Generally, you can see these patterns under the title “Islamic patterns” because they are frequent in the decorations of mosques and palaces. I studied these patterns in Grasshopper earlier in these posts. I always find this an interesting geometry exercise. This time, my main goal was to develop a useful code only with the native Grasshopper components that create laser-cut-ready products of hexagonal star lattice. Thus, I made…

Hexagonal grid with Rhino Python

July 25, 2017

This python code proves how much effort it takes to create a simple hexagonal tessellation. There are, of course, much easier and faster methods than this. But here you see a code that introduces students to Rhino Python. Using this code, a new Rhino command can be generated, and for the first time in Rhino, we can have a command that creates a hexagonal grid. I followed this tutorial to turn this Python script into a Rhino command. This is…

Waterbomb Tessellation

January 23, 2013

It all started with my new passion for origami tessellations, not much of origami, but the tessellation part. I was too lazy to fold it physically, nor model them using an engine such as Kangaroo. That would also be very unnecessary (and yes, very boring) to simulate a folding effort on the computer unless we lose our connection with the real world. Instead, I tried to look at a much more abstract, silly, and basic part of it; the creasing…

Vector Fields

December 28, 2012

Back to the basics. I finally had time to test the vector fields components in Grasshopper. It was a couple of updates ago, a new tool group emerged in the vector tab, introducing different types of vector fields to users. Then, these fields could be merged to form more complex effects. However, I created a very simple example of how we can use those components to distort a system (such as a regular tessellation).  Using attractor forces (usually in geometric…

Parquet Deformation of Star Patterns

February 3, 2012

This is another starting point for pattern generation study in a dataflow environment. I tried to implement the parquet deformation of Islamic patterns in Grasshopper. I studied Hankin’s method of Islamic Pattern generation. Then I tried to simulate his process beginning with basic regular tiling (regular hexagonal tessellation). Craig S. Kaplan (here) explains this and other methods in his dissertation. A Simple Foundation We have already experienced the result of exploding any hexagonal grid, shifting its points with the help…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #grasshopper
    • #tessellation
    • #fractal
    • #grid
    • #timer
    • #rhinoceros
    • #islamic-pattern
    • #pattern
    • #rhino-python
    • #computational-geometry
    • #polygon
    • #tutorial
    • #cnc-milling
    • #visualization
    • #design-object
    • #tree
    • #arduino
    • #laser-cutting
    • #responsive
    • #animation
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement