I’m new to grasshopper and having trouble to figure this one out. I need to space a geometry along a curve with the spacing being 2 times the length of one triangle edge as a radius to where it cuts the curve as shown in the picture.
The attached file is working relatively well however the spacing is messured with 2 times the length of one triangle edge along the curve as so is not accurate.
Does anyone know how to solve this?
geo spaced on curve.gh (17.5 KB)
You didn’t internalize your geometry:
It should be in this one.
geo spaced on curve.gh (18.7 KB)
This is hasty and doesn’t align the triangle as you did, with two vertices touching the curve… Basically though, you want to use DivDist.
This version aligns the triangles by their “base points” but as you can see, it fails on the last one because the curve ends too soon. so to speak: Later - Wait a second, I made a mistake… working on it…
(18.8 KB) (removed due to error)
Fixed that by by extending the curve (Ext), though that might cause trouble in some cases where the curve is already “just right”? Later - Wait a second, I made a mistake… working on it…
(20.9 KB) (removed due to error)
By the way, any particular reason your geometry is eighty-seven thousand units away from the origin? Inconvenient if it’s not necessary.
Wow! Thank you so much Joseph.
No, there’s no need for it to be so far from origin. The curve and sizing of the triangles are just a sketch. So can be changed. I just need a scritical of test many options.
Standby… Except for the first one, I made a mistake in versions ‘b’ and ‘c’ (which I will remove).
Like version ‘a’, this version has the correct spacing but aligns the triangles according to the tangent at each point, which isn’t the same as having two vertices of each triangle touching the curve. That’s more complicated… Not quite sure yet how to do that part “easily”.
OK, I think I finally got it right. The complexity of “simple things”!
There is still an assumption here that the curve is in the XY plane, which might not always be true, and then the code will break…
For whatever it’s worth, this version handles a 3D non-planar curve, but as you can see, the triangles all remain horizontal because of using HFrame. That too can be “fixed” but I’ll stop at this point.
A huge thank you Joseph!
This works great for what I need. The curves will remain planar.
Really learnt a lot from you help. Amazing!
Thank you so much for your help with the script.
I altered it a bit today so the spacing is the length of one side between each geometry. (I realised later that this is what I needed) Now I have tried o extrude them and I am almost finished but I just have one problem now I can’t fix - it’s that the last element piles up… even when I set a number slider to control the number if geometries. Might you have a solution?
No worries if not.
geo2_spaced_on_curve.gh (13.1 KB)
I sounds like you want version ‘c’ from yesterday? Here is a slightly modified version of that using your latest geometry. I didn’t add the extrusions.
geo_spaced_on_curve_2018Feb13a.gh (18.1 KB)
P.S. Adding your extrusion code now and I see your “last element piles up” problem". Standby…
OK, see two things in the purple group:
- To count the points (Lng), you want every other point, which comes from Cull, not from DivDist.
- The Range ‘N’ input needs the expression “x-1” to get the same number of results.
P.P.S. I just noticed the min/max settings on your domain sliders in the purple group??? What’s up with only two possible values? ‘499 to 500’ and ‘899 to 900’? Kind of useless, eh? Fixed that.
Great Joseph that all makes perfect sense
Thanks again, I really appreciate it.
Hi again Joseph,
what I’m trying to do now is add more range domains to the extrusion and a number slider to the start and end points so I can get a height that can move up and down along the curve. Here’s a screen shot of what I’d like to achieve. If you have any good ideas to share?
If not no worries!!
I’m still getting my head around it but really really learning a lot from the files you’re making!!
Well, yeah, I have some ideas… Kind of mixing apples and oranges though, since that’s really a completely different topic. And it’s not well defined. There are many ways of doing stuff like that. Graph Mapper comes to mind, but if you want slider controls, it’s what I call an art project - totally arbitrary.
You’re right - it’s a different topic.
I’ll check out Graph Mapper.
Unless you want to use attractors(?), just forget about the geometry and think about how to generate and control a pattern of numeric values. Here’s a quick application of Graph Mapper:
The graph mapper works alright.
Just looking quickly at a attractors, probably would be the better as it appear that there is more variety in the ability to adjust and control the form.