Grasshopper

algorithmic modeling for Rhino

Hi all, 

Just beginning to learn list management. Any help you could extend would be appreciated!

The problem:


I have a list which has a series of branches, each with a single mesh and multiple polylines. The branches are currently organized by the volume of the single mesh that appears at the first indices of each branch (low volume to high).

My intention is to cull the 500 branches with the largest mesh volume then split the list of 500 branches into four even chunks.


The trick is, I need the final list to keep the original format ie. one mesh at the first indices and the corresponding polylines.

I have no idea how to do this! could you please help!?

Views: 1840

Attachments:

Replies to This Discussion

20.5 MB GH file!  Wow.

You might want to spend a little more time studying the code we did three days ago:

http://www.grasshopper3d.com/forum/topics/merging-two-list-by-testi...

Because it takes only a few small changes to get from that to what you want now.

  1. reverse the sorted list of meshes.
  2. use 'SubSet (Sub List)' to get the largest 500
  3. reverse again to go from smallest to largest
  4. partition into four lists of 125 each  (what's the point of doing this?)
  5. and only then do the 'Mesh Inclusion' tests for the curves

Question: why are the curves already partitioned into 555 branches (close but not quite the same number as the 558 meshes)?  I had to flatten both lists for the previous code to work properly.  Seems to me that merging different data types (one mesh and a bunch of curves) into the same tree (list/branch) might create headaches down the line.

Attachments:

Thanks again for the help Joseph, 

I am just getting a hang of list management, so my apologies for the dumb question!  I don't know why I didn't understand that you could create the subset before the merge, but I get it now! It makes perfect sense. 

In the future, I'll keep my file uploads less than 20.5MB too! 

I have been processing a large number of meshes by extracting their centerlines and then using those centerlines to reorient the meshes... which is why I have been combining them on the same branch/tree. Maybe I will see if there is another way around this if you say it may cause headaches down the line. 

The reason for breaking everything into 4 chunks is because it is getting too heavy to process in Galapagos. 

Thanks!

Ethan

I think you are seeing the kind of headache I'm referring to.  See how easy it is to manipulate the list of meshes alone?  Not so easy anymore after the meshes and curves are merged, is it?  In fact, did that partitioning step do you any good?  No hard and fast rules about this stuff, merging might make perfect sense for you.

If you want to split up your data, I would suggest doing this:

  1. Take the partitioned mesh results and 'Explode Tree (BANG!)' to collect each of the four partitions into a separate 'Mesh' geometry param ('Mesh P0', 'Mesh P1', 'Mesh P2', 'Mesh P3').
  2. Internalize each one of these four, which will disconnect them from 'BANG!'.
  3. One at a time, feed each of these separately into the 'Mesh Inclusion' component.
  4. For each one, internalize the 'Curve' output ('Curve P0', 'Curve P1', 'Curve P2', 'Curve P3').

Now you've got four sets of meshes and four sets of their related curves.  You can save each pair in a separate GH file, 'Merge' them if you wish or work with them as paired, separate data trees.

Just beginning to learn list management. Any help you could extend would be appreciated!

Have you played with this 'Tree/List Viewer' tool I wrote?  Try connecting any data tree of geometry to the 'Tree' input and move the two sliders ('path idx' and 'list idx') to visually highlight the selected branch.

Very simple pair of clusters, you can look inside both of them to see how they work.

Attachments:

Joseph, 

This is a great tool! This is going to be very helpful while I'm getting more comfortable with list management. Thank you!

Ethan

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service