Grasshopper

algorithmic modeling for Rhino

Hi guys,

I have a list which is read from Excel sheet, I want to subdivide the list by categories,

All GM-Panel-01 become one list, all GM-panel-02 become a separate list, same as GM-Panel-03, how should I do that? 

Views: 1057

Attachments:

Replies to This Discussion

That's a few lines of code (also easily doable with standard GH components but that's not fun at all) : provide the list (internalized data in a single GH data component) and the solution could be yours ASAP.

Hi Peter, i would love to go through code, can you give me some clue of the logic of the code ? 

Thank you so much!

Maybe I was NOT clear: I need your data and then the code could be all yours (with full remarks on each line about why I do this or that).

I'll provide a variety of ways to organize your data as well (as a small demo about what code can do for you).

Moral: your data please (IN A SINGLE DATA GH COMPONENT).

Hi Peter, 

Here is my grasshopper and my excel data sheet, I kind of find a way to do the subtree, but I still want to know how to write it through code.

Thank you so much,

JL

Attachments:

If code is what you want code is what you'll get.

Added a few explanations (especially pay attention to the "bottom-to-top" List counting approach for potentially removing the empty/null entries).

But I confess that ... well ... since there's a Tree around the only thing that we can do (other than checking this or that for validity or being empty/null etc etc) is to decide what portion of the Tree we need out (as a List).

Anyway, if you want some other thing notify

best, Peter

Attachments:

Hello

your screenshot has the data from the excel sheet already structured in a data tree (collection of lists)

so if you use explode tree you gain access to each branch as an output, so each gm panel as a separate list.

In case you want to remove the tilte of each category from 0 index, you can use cull index, with culling index 0, in the dta tree and then use explode tree.

so basically you need one or two components (there goes the fun)

Thank you for your reply, but if I have 100 member of the lists, explode it will make the list really long,

Attached is so far I have, I made them separate into different branch, just the last step is how to retrieve the branch from the original list?

Attachments:

hello

in this case you can use tree branch, you provide a data tree and the path of the branch (which is a list) you want and outputs the branch specified. tree statistics also helps, ouputting the paths of the tree, the length of each brunch. So one way could be the following.

Hope that helps

cheers

alex

*edit i am trying to undestand from the screenshot what you are after. maybe i did not get with the above answer.

I can highly recommend getting the Human plug-in for a variety of reasons. Here is a good opportunity for you to use the dynamic "item selector" component. It reads a list of input values and allows you to interface with them as selectors in a variety of ways. Here, because your input lists are already well ordered in a clean data tree, and your list name is the first item you want to use as a filter, it's pretty straightforward (the blue component is the item selector...right click to select the type you want):

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service