Grasshopper

algorithmic modeling for Rhino

What's the most efficient way to divide a curve by length from the midpoint out? And to make it even more fun, how would I do the same but with the segments centered?

Context: I'd like to write a definition to create panelized railings (think glass railings) along a curve. Panels are best manufactured at equal lengths, so I'd array a 1m panel, then have whatever is left over be a unique panel. There are many conditions that I might want to try:

1. Standard size from start, left-over size at end.

2. Standard size from end, left-over size at start.

3. Edge of standard size from midpoint, equal left-over size at start and end.

4. Center of standard size from midpoint, equal left-over size at start and end.

I'd like to switch between these 4 cases along with adjusting the length of the standard size panel to find the best solution.

So I could also ask if anybody knows of a preexisting solution that's already out there, too.

Any help would be greatly appreciated.

Views: 16671

Replies to This Discussion

Ok. That's the first thing that crossed my mind but then you mentioned the Human plugin so I thought installing plugins was not a problem.

I guess each has his priorities but I think the two most essential plugins to have installed are probably Weaverbird and Kangaroo (you didn't mention either).

We do next to no work with meshes (maybe we should, but currently we don't) and I've never explored Kangaroo. The one time I needed to use meshes and anything physics related, I used Geometry Gym to model an ETFE cushion.

i think the best solution is to add the the divide by lenght component the possibility to center/left/right/divise at both direction the rest of division...

0.5-2-2-2-0.5

2-2-2-1

1-2-2-2..

coz I used the definition Vincente had made and it's really too complicated for a simple operation...

You make it sound like that solution will work just as well as the one I posted. If you are special casing straight lines, sure, but the OP wants other types of curves.

It is possible I over-engineered the solution and a more simple one exists that solves the same problem, but there is no evidence on this thread about this yet.

I agree that a general solution would be best. I think it would be a useful addition to code some nice divide curve components that are specific to these cases. To further generalize the cases, it could be a new Divide Distance component that has an additional input for a base point on the curve: choose a distance from the start of the curve for the base point, then create equal distance divisions along it, but order the points from the start to the end of the curve. That's basically what I've done with Danny Boyes' definition. (I'll "finish" it today to share and get feedback.)

If it was a scripted component, it could do the calculations iteratively, and probably more efficiently. Any takers?

Hello I used Vicente definition where he used the Knagaroo, but now I am working on another PC and I had to install the Rhino grasshopper as I did on my first PC.. and I made sure that I had installed all the plugins but when I try to open my folder I always have an error which is the following:

  • Object: KangarooA (level 1)
  • {
  • Exception has been thrown by the target of an invocation.
  • TargetInvocationException
  • }
  • Object: KangarooA (level 2)
  • {
  • Could not load file or assembly 'KangarooLib, Version=0.0.9.6, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
  • FileNotFoundException
  • }

Does anyone have any idea why I am having this problem.. thank you

It's possible you have the Kangaroo files blocked. Right click on the .gha and .dll files individually, select properties and if there is an 'unblock' button, click it.

You can also use the script I posted bellow, so there is no need to install any plugins.

Here's the "final" definition for my railing. Comments and suggestions for improvements welcome. Thank you everybody for your help.

Note: This definition does use LunchBox to bake the whole thing to particular layers at the end, but it's only three layers, so it could be done manually. Or you could use Human... I haven't decided which is preferable.

Attachments:

And here is a scripted version of more or less what Kangaroo is doing, so you don't need any plugins.

It has the advantage of stopping once it's under a maximum deviation value before it reaches the maximum number of steps set.

You might want to reduce the Time Step value depending on the scale of your model.

Attachments:

I added the 4 different types to the script.

I also added a threshold for when to add or remove a segment for generating odd or even panels. If the size of the lateral panels is too large you can lower the value to add another segment. Ideally this should be done by solving it first, checking if you need an extra segment, solving it again, and so on.

Attachments:

I added a 5th option to equalize the length of all segments. The final segment length will be a bit smaller than the target length.

Attachments:

Must stop procrastinating...

I added the recursive logic of first making the border segments of equal length, then if they are larger than the interior segment's length, adding 2 extra segments (keeping them odd or even) and repeating the process.

I also added a warning indicating if it stopped before reaching the maximum allowed deviation and when successful, the number of iterations it took.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service