Custom shape on staggered grid with attractor points at the border?

Hi there, I’ve been using Grasshopper for a little while (simple algorithms and following along dozens of YouTube tutorials) and Rhino for a very long while, but I haven’t had much success with putting this latest script together.

I’m trying to create a script for a speaker grille with staggered holes, but I would like to use a custom shape for the holes and I would like to use the borders of the grille as attractor points so that the shapes shrink/fade out as they approach the end of the speaker grille surface. I need to adjust the UV count on the grid, so I can control the number of holes in order to hit a specific percentage of open area (in my case this is 40% open area) so that the grille doesn’t interfere with the sound. There is a minimum for the size of the smallest hole and the smallest space between holes, but that depends on material thickness and I haven’t gotten that far yet. For now, I’m trying to stick to 2D curves so I can calculate the open area in Rhino.

Right now, I can’t seem to get the grid points to stay within the surface of the speaker grille, and I have completely botched all attempts to use the grille’s border as attractor points. Any help is much appreciated! I’ve been at this for about 30 hours this week without much fruitful progress :sweat_smile:

Shoot, I even tried to get ChatGPT to help me but that hasn’t been much help either lol

Speaker Grille Test_03_19JAN24.3dm (189.9 KB)
Staggered Grid with Custom Shape and Attractor_18JAN24.gh (14.7 KB)

Here’s an image that’s kinda like what I’m aiming for, but instead of the pill shape shrinking I’d like a custom shape:

I did’t understand what you were trying to do in your definition…
Maybe study this:



Staggered Grid.gh (23.0 KB)

… good luck :sweat_smile:

1 Like

I just randomly stepped on this youtube video which models that very same exact pattern .________. https://www.youtube.com/watch?v=9xHPCf_-MYo&list=PLO1Xwz4iyp_k6YEWaljxfbOdXANCKxJgf&index=6

1 Like

Cool! But one hour and 42 minutes :exclamation: :face_exhaling:

yeah, he takes it from the origin of life on this planet… up what led us to design that particular pattern :rofl:

2 Likes

@maje90, @Joseph_Oster , @inno Thanks! Joseph and Inno I thought the same thing lol

@maje90 Ricardo that’s helpful! But instead of that pill shape in the pattern, I would like to use that little boat shape that was sitting near the origin in my Rhino file. So, from a distance the speaker grille would look like a normal speaker grille, but when you move your eye closer to the speaker grille you would see a little staggered boat pattern instead of a staggered pill shape pattern.

Switching to that custom shape is trickier than I thought. I can’t seem to figure out how to get the custom shape to scale along the grid/according to the attractor points the same way that pill shape does in the tutorials. Ideally that custom shape, the boat shape I’m aiming for, would scale smaller as it get closer to the border of the speaker grille’s surface. I have another script where the boat is in a rectangular, non-staggered grid, but it doesn’t give me the end result I’m aiming for (it looks too uniform, or too linear). A staggered grid would be nice, and would possibly yield more open area for sound to pass through the grill, but that’s been tricky to figure out as well.

I referenced that YouTube video initially, thinking it would be simple to change the shape being used for the holes in the grille, but I haven’t gotten it quite right so far.

if I correctly understand your post, you just want to scale your shapes over a grid, depending on their distances to a curve


data_is_internalized_Re.gh (21.6 KB)

given your custom shape C, the destination points P organized as a grid, and a curve B that defines the boundary of the attraction

on (1) the boat curve gets oriented “as it is” over each destination point

then each destination point on the grid gets pulled (2) over the boundary curve, just to measure its distance from the curve itself (value you can read in the output D)
you can interpet that as if you were drawing a curve from each point in the grid to the closest point in the boundary and measure the length of that line

so in the D output of Pull Point (2), for each point you have the distance between that point and the boundary curve, and you can use that data to scale the curves you just oriented on the grid points in (1)

in this case, because I want to use a Graph Mapper to define a function for the scaling and the Graph Mapper wants a Domain [0 to 1] (*note), then you can first remap (3) the Distances into values [0 to 1] then apply your graph function (4), then remap back those [0 to 1] values into something that you want to use for real (5)

*note: you can actually customize the domain of the Graph Mapper by double clicking on it… but I think if you get used to remapping values it becomes easier.
BTW there are some plugins like righ graph mapper that allow for custom domains ( Riched Graph Mapper | Food4Rhino )

the Graph Mapper function you can interpret this way:

on A you have your distances, remapped from 0 (A0 → points on the Boundary curve) to 1 (A1 → max distance of Points from boundary curve)

on B you define the amount of (in this case) scaling you are giving to your final boat shape

so for instance in this case points which are on the boundary curve will get a value from the graph which is “0”, and it’s remapped instantly into a 1.84 scaling factor

then depending on their distance, shapes are being scaled up to a final 3.91 the more they are far away from the boundary curve

nothing forbids to create custom functions where you decide that scaling happens only for a smaller portion of the distance domain

for instance, let’s say that you want to scale linearly only the points that are up to 2 units form the boundary, then you want to maintain the very same scaling factor for the more distant ones

instead of remapping the distance values by their bound, you remap by the domain of interest [0, 2] and use the Clipped output of the Remap in such a way they don’t go outside the domain itself:

data_is_internalized_Re_Re.gh (22.2 KB)

these are the basics of the weapons at your disposal, you can of course create custom functions, use IFs and stuff to go crazier if you want :+1:

2 Likes

This is exactly what I was trying to achieve, thank you for the detailed write up!!

I’m going to play around with this script to understand what’s going on here a bit more. Does this technique or set of steps have a name that I can research and study?

it’s just the very basics of using an attractor point, you’ll find really a lot of info and tutorials on youtube
this is also a very good page: Working With Attractors | The Grasshopper Primer Third Edition

Awesome! Ok let’s go one step further, I’m wondering if my thinking is heading in the right direction. Keeping the staggered grid, if I wanted to take the points at the border of the surface (the ones assigned to the smaller boats) and alter those points exponentially so that the number of little boats increased and the number of big boats stayed roughly the same. How might I go about that?

Here’s a rough screenshot of the goal, bashed together in Photoshop using a script from @Joseph_Oster from 2017. BUT, this grid is not staggered and I think the end result would be nice if the grid of holes was staggered:
Exponential_Spacing_2017Jun5b.gh (13.0 KB)

Would I begin to alter the script at the area within the boundary of the attraction? Around this part of the script? See screenshot below:

UPDATE: Ok, so I was able to split the points into two groups (domains? still learning some terminology) those points closer to the border of the grille, and those points closer to the center of the grille.

Now I think I need to figure out how to increase the number of points near the border exponentially as they get closer to the edge of the grille. I’m not sure how though. I haven’t seen any examples so far where the grid points actually increase, usually the grid being affected by attractor points seems to remain the same and the attractor points seem to only affect geometry attributed to the grid points. I’ll keep at it!

Speaker Grille Test_03_19JAN24.3dm (189.9 KB)
Parametric Grid_mk3_25JAN24.gh (32.4 KB)

Free labor is great, eh? :rofl:

1 Like

lol This whole forum is based on that premise! Gotta teach the people somehow :laughing:

But are the people learning? Many are only concerned about getting the geometry they imagine.

I always did the job to learn myself. So I don’t answer and try to don’t rant if I am not interested.

1 Like

I hope so, I’ve been learning a ton. I see it like playing the guitar; you need to play songs other people wrote before you can understand the chords and write your own.

1 Like

There’s playback too.

This? https://guitarplayback.com/
I haven’t tried that yet but it seems cool.

This script though; I still haven’t quite gotten it. I split points on the grille surface into two groups based on their distance from the border/edge of the surface. After that I remapped the points so now the size of the shapes (boats) on the border/outer edge can be scaled independently of the shapes (still boats, although I think these point could be assigned a different shape too if need be) in the center of the surface. But, I don’t yet know how to increase the points on the border/outer edge.

Would anyone know what components exponentially increase grid points? At this point I think I can figure out where the components need to go, but I don’t know which ones to use.

Much appreciated!


Parametric Grid_mk3_25JAN24.gh (49.2 KB)
Speaker Grille Test_03_19JAN24.3dm (189.9 KB)

I was joking. A lot of people here just ask for help in school projects and they never ever understand the definitions they receive…

1 Like