I am trying to create a perf pattern with staggered circles in it. I created a hex grid to make them staggered, but how do I control the distance between them?
Hi @courteneykemp,
The distance between your circles corresponds to radius of the inscribed circle of each hexagon cell minus the circle radius times 2!
what if the radius of my circle is .094" and I want the spacing to be .188" apart? how can I control that spacing manually?
Has anyone suggested to you yet that posting your actual GH file with internalized geometry (not just a screen shot) is the best way to get answers? It makes it so much easier for everyone.
CPP1 7-15.gh (24.6 KB) CPP1 7-15.3dm (51.9 KB)
Sorry. Thanks for reminding me to do that. Hope this helps.
The one on the left is pretty much what Iām wanting except id like the circles to be staggered with controlled distance between circles
R6 strikes again:
Given your screen shot of the code, I can fix it for R5 but canāt see your Crv from the Rhino file. Taking a wild guess, I created a line from the origin 50 units long in the X directionā¦
- For forum questions, it really helps if you internalize your geometry instead of referring to a Rhino file, especially when the geometry is extremely simple.
- Even better than internalized geometry is to use GH to create the geometry when possible, thus making it parametric.
Moving on⦠I see no reason to use Map Srf here unless your input curve is not a straight line?
- For one thing, you can create the HexGrid in a vertical plane (XZ?) in the first place instead of mapping it from XY to XZ.
- Second, as written, there is no guarantee that your āTarget Surfaceā has the same proportions as the HexGrid, and if it doesnāt, the hexagons will be distorted.
Referring to this portion of your model:
- There is no need to use PCen (Polygon Center) since you already have the center points from HexGrid.
- There is no need to ācreate plane normal to surface at cell centerā since the āFā output of EvalSrf gives you that already.
On curved surfaces, sometimes Circle CNR can be helpful, though I see no reason in this case:
This is getting to be a very long winded answer⦠Iām hesitant to refactor your code without knowing more about your input curve?
P.S. Playing with a curved input instead of a straight line, though both reveal a UV flip issue that is not at all intuitive for beginners!!
Oh no, this is a duplicate thread?
The following doesnāt answer the question about spacing yet, but without your input curve, itās a great example of possibly wasting time answering the wrong question:
CPP1 7-15_2019Jul15a.gh (27.7 KB)
Changing the āSā input to HexGrid has no effect on the outcome because the result is determined by the length of the input curve. I hacked a Python SwapUV component (using āTransposeā); UV is a painful subject recently so to see why I did it, skip it and see what happens.
Unfortunately, radius of the circles is not proportional to hexagons in this model, as they are scaled by the length of the input curve. You could do the circles before Map Srf:
CPP1 7-15_2019Jul15b.gh (34.6 KB)
Or maybe you donāt need Map Srf at all?
I am just using an 18" long straight curve and the panel is 24" in height⦠I need .094" diameter circles that are .188" apart. Does that help? Sorry, I am very new to this
So you donāt need Map Srf at all. Thatās what I figuredā¦
CPP1 7-15_2019Jul15c.gh (30.3 KB)
P.S. I didnāt actually cut the holes in the surface but you have three options:
- Boundary Surface using the perimeter curve and circles; this is often the best option for planar surfaces, but will be extremely slow for ~14,000 circles in this case!.
- SrfSpilt is probably even slower. Both might fail before they finish.
- Bake the surface and circles to Rhino and cut the holes there.
I already mentioned this old thread in your duplicate thread:
Some of it is irrelevant for planar surfaces but there is a discussion of option #3 (bake and cut in Rhino) showing it can be MUCH FASTER than Grasshopper.
Oh, there is a fourth option: cut holes in a panel that is ~1/10th the size (1/10th the number of holes!) and then copy/move it nine times.
This is very helpful! one last question: how/where can I set a boundary that the hex grid cannot go beyond?
You canāt. I used manual slider settings with feedback from the ādistance between centersā panel for spacing, then used Vec2Pt to move and realign the HexGrid and circles (default alignment is sub-optimal), and finally visual inspection to adjust the āExā and āEyā inputs to HexGrid to match the rectangle size. You could do some math to calculate those values but I didnāt have time for that.
Thatās okay. This is working great! Thank you so much!!
ck5.gh (13.8 KB)
If I use this mapping, is there a way to control the spacing of the circles on here?
As I understand it, there are two basic parts to this question:
- Distance between centers?
- How many rows and columns can fit on a given rectangle? (for a given distance between centers)
Part 1 is basic geometry, and Iām pretty sure someone mentioned this already:
This is some GH that illustrates the āQualities of a 30-60-90 Triangleā. Blue lines are the polygonās radius (the āSā input to HexGrid). White lines are half the distance between centers in a HexGrid. In other words, the distance between center points is half the radius times the square root of three times two. Or simply radius * ā3
.
For radius = 2 as shown, distance between center points in a HexGrid is 3.4641.
The rest of the code addresses Part 2: How many rows and columns can fit on a given rectangle? As you can see by changing the ācountā slider, the ācol/row averageā is useless because it changes constantly (can you see why?).
CPP1 7-15_2019Jul16a.gh (23.6 KB)
What remains constant, however, is:
- vertical (Y) distance between rows = distance between center points.
- horizontal (X) distance between columns is [ā¦] (another 30-60-90 triangle).
(CORRECTION: In a rush to get out the door, I posted wrong information - sorry!
Should be:
horizontal (X) distance between columns is (distance between center points / 2) * ā3
ORā¦((radius * ā3) / 2) * ā3
.
The edges are a different matter but thatās all I have time for today. You have all the information needed to answer your questions. Think it though!
P.S. Have you tried yet to cut ~14,000 holes in your 18" X 24" surface? (using the code I posted yesterday) Good luck with that.
P.P.S. My plans today were changed by someone else⦠so here are more hints. Working backward from this to calculating ācol countā and ārow countā based on radius (HexGrid āSizeā) and target rectangle size are left undone. But very close!
CPP1 7-15_2019Jul16b.gh (24.3 KB)
Well, this is almost the āFull Montyā. If it still doesnāt work for @courteneykemp, maybe others will find it useful or amusing. Two features that I believe Courteney would like to see are not implemented (yet, but donāt hold your breath for me to do them):
- To specify ādistance between centersā and derive HexGrid āradiusā from it, rather than the other way around as this code does.
- Center the grid of hexagons/circles on the rectangular panel? This code orients the grid to the bottom left corner.
Inputs are āX Sizeā and āY Sizeā of the rectangle, āradiusā of the HexGrid cells and ādiameterā of the circles.
CPP1 7-15_2019Jul16c.gh (22.2 KB)
how can i apply this to any type of surface ?