Randomized Bars Grasshopper pattern: vertical bars with random lengths and offsets

Randomized Bars

Random bar façade pattern

Vertical bars with random lengths and offsets, packed into a dense, irregular screen.

Want all 53 patterns? Get them in one zip →


Price

Free

Plugins

None, native components only

Works with

Rhino 7 & 8, Mac and Windows

Level

Beginner

Inputs

Reference in Rhino

Surface

The surface the pattern is built on. The rails and bars run in its V direction. It must be a planar (flat) surface.

Main Sliders

SliderWhat it changesDefault
DivisionsThe number of columns of bars. There is a thin rail on each side of every column.55
Rail Width %The thickness of the rails, as a percentage of the surface width. Each rail is twice this value wide.0.18
min bar length as %
max bar length as %
The range of random lengths each column picks from, as a percentage of the surface height.4.7
9.3
Size MultiplierScales all the bar lengths at once. Higher values give longer bars and gaps, and fewer of them.1.7

Also try: change the seed (S) of the Random components that have one set to 2 for a different arrangement of bars and gaps.

Notes

  • The script gives two results: the rails, trimmed to your surface, and the bars between them. The bars fill the whole gap between two rails and touch them.
  • Bars and gaps alternate in every column. Whether a column starts with a bar or a gap is random, which keeps neighbouring columns out of step.
  • For a finer pattern, lower Size Multiplier or the min and max bar lengths. Higher values give fewer, longer bars and gaps, and a more blocky look.

Design Logic

How the script builds the pattern, step by step.

Randomized Bars Grasshopper script on the canvas
The whole script on the Grasshopper canvas. Open full size ↗
StepHow the script does it
1. Draw the rail linesDivide Surface makes a grid of points with one division in V, and Nurbs Curve joins each pair into a straight line across the surface. Flip Matrix, List Item and Distance measure the gap between two lines, and Line and Length measure the surface width.
2. Thicken the lines into railsOffset Curve copies each line to both sides by Rail Width % of the surface width. End Points, Line and Join Curves close the two copies into a thin rectangle, and Region Intersection trims the rails to the surface.
3. Draw a centre line for each columnRelative Item pairs each line with the next one, and Tween Curve draws a line halfway between them.
4. Pick random lengths for each columnRandom picks three lengths per column between min bar length as % and max bar length as % (as a share of the column’s Length), and Multiplication scales them by Size Multiplier. Mass Addition adds them up step by step, Duplicate Data repeats the result until it covers the column, and Jitter shuffles it.
5. Cut each centre line into piecesA second Mass Addition turns the shuffled lengths into positions along the line. Evaluate Length finds them, Clean Tree drops any past the end, and Insert Items adds the start and end of the line. Relative Item, Construct Domain and Sub Curve cut the line into pieces between neighbouring positions.
6. Keep every other pieceDispatch with a True/False pattern keeps alternating pieces. Random and Shift List shift the pattern in some columns, so some start with a bar and others with a gap.
7. Turn the pieces into barsAn Expression works out the gap between two rails. Extrude with Amplitude stretches each piece to that width, and Move centres it on its line, so the bar fits exactly between the rails.

Want to learn how to build scripts like this on your own? Check out the Grasshopper Pro course.

On this page

Related tutorial

Free to use, also commercially

Use and change this script in your own projects, personal or commercial.

Please don't re-upload or redistribute the file. If you share it, link to this page so people always get the latest version.

© Hopific

Something not working?

If a script throws an error or doesn't do what this page describes, tell me and I'll fix it.

Tell me →