Stacked Books Grasshopper pattern: rows of thin bars leaning at different angles

Stacked Books

Leaning bar pattern

Rows of thin vertical bars leaning at different angles, like books on a shelf.

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 script reads its edges to set the directions of the rows and the sticks, so use a four-sided surface; a rectangle works best. It must be a planar (flat) surface.

Main Sliders

SliderWhat it changesDefault
Segment A as % of Length
Segment B as % of Length
Segment C as % of Length
The three row heights, as a percentage of the surface edge the rows stack along. The rows use these three heights in a random order.5
6
7
Segment Length Min
Segment Length Max
The range for the spacing between sticks, in thousandths of the row length. Each row gets its own random spacing within this range.16
20
Scale MultiplierScales the stick spacing in every row at once. Lower values pack the sticks closer together.1
Gap as % of LengthHow much is cut off both ends of every stick, which sets the gap between rows.0.26
Stick Width as % of LengthHalf the width of every stick, as a percentage of the surface edge the rows stack along.0.26

Also try: set the unnamed slider in the Randomized Selection Pattern group from 2 to 0 or 1. The pairs of straight sticks then become leaning sticks too, and every book on the shelf tilts.

Notes

  • Use the Flip Direction toggle to turn the pattern 90°. It swaps which surface edge the rows follow and which one the sticks follow.
  • Keep the stick width well below the spacing. Stick Width as % of Length and the two Segment Length sliders are set separately, so wide sticks in a tightly spaced row will overlap.
  • Row height changes how far a stick leans. A leaning stick runs from the foot of one stick to the top of the next, so in tall rows it stands almost upright and in short rows it tilts more.

Design Logic

How the script builds the pattern, step by step.

Stacked Books Grasshopper script on the canvas
The whole script on the Grasshopper canvas. Open full size ↗
StepHow the script does it
1. Find the two directions of the surfaceBrep Edges gets the edges of the surface. Shift List (driven by Flip Direction) and List Item pick one edge for the direction of the rows and the edge next to it for the direction of the sticks. Flip Curve turns the opposite edge round so both sides of the surface run the same way.
2. Set three row heightsLength measures the edge the rows stack along, and three Expression components turn Segment A, B and C into actual heights.
3. Mix the heights into a random stackMass Addition and an Expression work out how many times the three heights must repeat to fill the edge, and Duplicate Data repeats them. Jitter shuffles the order, Mass Addition adds them up into running totals, and Insert Items adds a 0 for the first row.
4. Draw the row linesEvaluate Length places a point at each running total on both side edges. Flip Matrix and Nurbs Curve join each pair of points into a line across the surface. Shatter and Length measure the height of each row.
5. Give each row its own spacingConstruct Domain builds the spacing range from Segment Length Min and Segment Length Max, Random picks a spacing for each row and Multiplication applies Scale Multiplier. Divide Length places points along each row line at that spacing.
6. Draw the sticks and the gapsAmplitude makes a vector as long as the row height, Move copies each point up by it, and Line joins the two into a stick. Extend Curve with negative values shortens both ends by Gap as % of Length, leaving a gap between rows.
7. Make some sticks leanPartition List groups the sticks in pairs. End Points, List Item and Line draw the two diagonals across each pair, and Group keeps the straight pair together. Weave, Random and a Panel build a pattern of “straight pair, then one stick leaning left or right at random”, and Pick'n'Choose applies it.
8. Give the sticks their widthUngroup separates the sticks. Two Move components shift each stick sideways in both directions by Stick Width as % of Length, and End Points, Merge and a closed Nurbs Curve join the four corners into an outline. Surface fills it.

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 →