top of page

Opposites Attract - Dynamo

Not that kind of attraction! I’m talking point attraction in Dynamo of course.

Here is what we are going to make when all is said and done.

Dynamo Attractor

Now we’ll break it down.

First, we need to find a source image and break it down a bit. Luckily, I found a perfectly square image which made life easier. Also, for some reason it makes life easier to rotate the image like shown below. In this case, we will go ahead and grab an even number of pixels from the image’s height and width.

Dynamo Attractor

After grabbing those pixels, we go ahead and break down the colors to use in Dynamo!

Dynamo Attractor

Next, we need to generate a surface to work with to process the “directions” from the image. For this example, I used a line to extrude a surface that is the same dimensions as my image.

I also went ahead and placed points on this surface at the same spacing and logic as my image from before, (25x25).

Dynamo Attractor

Dynamo Attractor

Next, we need to generate something called an attractor point. This means we measure distance between one item, (in our case a point), and several other items, (in our case 625 other points). The way this is achieved is through a node called, “Geometry.DistanceTo”. It is important to keep in mind that this node will return the literal length from the attractor point to the other points, we’ll fix that next.

Dynamo Attractor

To fix this situation, we will use something called “Math.RemapRange”. This beautiful node will redefine all the numbers in a list, based on a minimum and maximum value. Once again, this means Dynamo is doing math on 625 numbers way quicker than I can.

Dynamo Attractor

When we are all done with the geometry we can now override the cubes based on the colors from the image.

Dynamo Attractor

And here it is in action using the direct movement of a point in Dynamo.

Dynamo Attractor gif

If you have enjoyed this, please comment/share!

John Pierson

John Pierson is a Computational BIM Specialist at EvolveLAB. John has presented at Revit Technology Conference where he was rated as one of the top 5 speakers. He is an active member in the Dynamo community and currently manages Rhythm; which is among the top 10 most downloaded Dynamo packages.



Join EvolveLAB's newsletter to stay informed on our latest tools, live streams, and more. Get inside access to new releases, updates, and exclusive content. Subscribe now to stay in the know.

Thanks for subscribing!

bottom of page