Field Lines Grasshopper pattern: field lines flowing around several points

Field Lines

Magnetic field line pattern

Curved field lines radiating from a set of point charges, pushing apart where the charges meet. Move the points to reshape the field, or mix positive and negative charges to make the lines flow between them.

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 field lines are drawn on. It also sets the boundary of the field. It must be a planar (flat) surface.

Point

The point charges. Each point sends out its own set of field lines. Place them on the surface.

Main Sliders

SliderWhat it changesDefault
Field Lines per ChargeHow many lines start from each point.25
Start radiusThe radius of the small circle around each point where the lines start.0.14
Curve thicknessThe width of each line once it is turned into a strip.0.04

Also try: connect a Panel to the Charge (C) input of Point Charge that lists one value per point, and make some of them negative. Positive and negative points attract each other, so the lines run from one point into another instead of only pushing apart.

Notes

  • All points have the same charge. The lines spread out from every point and bend away from the neighbouring points, like magnets with the same pole facing each other.
  • Watch the crowding at each point. The lines start on a small circle, so with many lines, a small start radius and thick strips, they merge into a solid ring around the point. Raise Start radius or lower Curve thickness if you need them separate.
  • Draw the surface in the Top view. The strips are made with Offset Curve using its default plane, which is the world XY plane.

Design Logic

How the script builds the pattern, step by step.

Field Lines Grasshopper script on the canvas
The whole script on the Grasshopper canvas. Open full size ↗
StepHow the script does it
1. Turn the points into a fieldPoint Charge gives every point the same charge, limited to the box of your surface. Merge Fields combines them into one field.
2. Place the start points around each chargeEvaluate Surface and an MD Slider get the plane of the surface, and Plane Origin moves that plane to each point. Circle draws a small circle there and Divide Curve splits it into the start points of the lines.
3. Trace the field linesField Line follows the field from each start point and draws the line it flows along.
4. Simplify the linesRebuild Curve rebuilds each line as a smooth curve with fewer control points, so the next step works reliably.
5. Give the lines a thicknessTwo Offset Curve components offset each line by half the thickness to each side. End Points and two Line components close the ends, and Join Curves joins everything into a closed outline, which is turned into a surface.

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 →