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 December 3, 2026, from https://www.designcoding.net/revisiting-rhinoscript/

Related Posts

Hexagonal Star Pattern

November 14, 2026

Sharing the latest scary pattern from my old pattern archive. This time, instead of using Parakeet, I designed it using only standard Grasshopper components. We start with a hexagonal grid. We exploded the cells of this grid and found the midpoint of each edge. By connecting these midpoints, we again created closed polylines. Then, we exploded these closed polylines, turning them into a sequence of data lists. Next, we place a point on each exploded segment (reparameterized with a t-value…

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…

  • Chapters

    • Algorithms
    • Discourses
    • Escapes
    • Fabrications
    • Studios
  • Explore

    • Table of Contents
    • Monthly Archive

    • All Keywords
    • #grasshopper
    • #tessellation
    • #pattern
    • #fractal
    • #grid
    • #timer
    • #polygon
    • #rhinoceros
    • #islamic-pattern
    • #rhino-python
    • #computational-geometry
    • #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