Grasshopper

algorithmic modeling for Rhino

Hi, 

I have a set of Breps which is imported from GIS file and i have a attribute list which is imported from excel file. Does anyone know if there is a way to sort the Breps into groups or sub divide brep into groups based on the attribute list which have been imported. 

The attribute list contains various types like construction year, building type, energy use etc. I would like to sort based on different types so that certain properties can be assigned to those groups. 

Views: 803

Replies to This Discussion

Post the Brep List AND the other thingy and have faith, he he.

Hi Peter, 

Sorry for that. so i have attached my files and a screenshot of the same. So i have separately imported GIS Shp file which was created in arcgis and converted dbf to excel file and imported to grasshopper which has attributes to shape file.

Now using that i extruded the shape file to get the heights of building. But i need to group the buildings based on other data in the excel file.

 

The Files

Attachments:

You forgot the schema (shx) file.

Provide the List of curves that represent the buildings (internalized).

Anyway ... assuming that column 4 is the building index (is it?) and column 2 is the description ... what are you looking for? Queries of that type? (or combined ones?).

Say (what = building description):

List<string> queryList = sList.Where(x => x.Contains(what)).ToList();

I apologize if i could not explain what i exactly was looking for. I am a newbie in this so would take time. 

So what i actually want is dividing my shapefile into maybe 3-4 different shapefiles. 

So suppose i have 120 curves in one file. and i have age of construction( or any attribute) for those curves. i would want to have four different curve files based on the separate list of attributes i have. 

like First one curves which have age 1890 -1900)

second one (age of 1900 -2000)

third one (age from 2000 to 2016)

I have also attached all the files again. ( I am really really sorry for the inconvenience) 

Attachments:

OK, that's very easy.

Imagine Lists out of the excel file (or a DataTree: let's called it: info). Assuming that building (shape file > footprint > curves: let's call them buildings) indices correspond to info indices (if not there's absolutely no way to match onions with sardines). Then any query on info (sort VS year made etc etc) could yield the related info indices as well and .... since indices from info are 1:1 to indices from buildings ... blah blah.

Another more "consolidated" approach is to create a DataTree where the main dimension is the building index and the second dimensions are related with the columns on the info DataTree ... meaning that you have a "kind" or RDBMS with regard any building. Then you "scan" that DataTree and sample any combo imaginable (sort VS age and then sort VS height and then sort VS type and then sort VS ... anything).

Say queryList = queryList.OrderBy(x => x.Age).ThenBy(x =>x.Height).ThenBy ....

This means that when you use a query on heights you can extrude the building footprint etc etc.

BTW: Is column 4 the building index?

more soon

Hmm ...

1. The TT ToolBox Excel reader of mine it doesn't work (but I don't care) > used the LunchBox reader (you must have the xls file loaded in Excel).

2. BEFORE finishing this (with any imaginable query combo) check the indices correspondence > see the query for "Stadium" for instance. I don't think that things are OK (or the indices column in xls is some "other" ???)

3. Excel rows are more than curves count > ????

4. Use this excel attached.

Attachments:

The coulmn 4 was in index i had created. The GIS did not export the building index it orignally used. So i modified your excel file and added a new index which matched the index of buildings and it worked perfectly. 

Rows matches the curves. 

This is exactly what i wanted. Hope to learn a lot from you. 

I don't know how much can i thank you. I really appreciate it. 

Thank you so much. 

Well ... pass the modified excel > some WOW things may occur

BTW: Do you speak C#?

BTW: Found a couple of minutes more for that one:

Good news: I'm working on it

Bad news: xls file is wrong (but this is not the big issue).

Ugly news: Curves MUST been sampled in Trees. Study this pic and get the gist of the problem:

In plain English: we have inner and outer Loops on that thingy ... but no info about them (only a Curve Tree can address this).

More Ugly news: what about this?

In the mean time have some fun more with the attached V2

Note: used primitive "filters" instead of "weird"/freaky LINQ queries in case that you want to get your hands dirty with the code.

BTW: the thread's name is wrong: Query Breps and not Sorting is the right one.

Attachments:

Hey Peter, 

I am attaching the xls file. But then i figured the issue why the curves are not matching. 

This is hapenning because when i had created the GIS file i had merged few curves to form a single polygon. Now in GIS it does not matter since all those curves come under same polygon but however when it is imported in Grasshopper it seperates out the curves, giving us more curves than the rows.

I am not sure if we can fix that here. Because in this case it is 10 extra curves which i can probably identify  and can be merged but what would happen in case there are million curves. It would be hard to recognize which curves had been merged.  

Good part is i can fix it in GIS easily and send you a revised SHP file.  for now attaching the xls file. 

also to answer your previous question. I do speak a bit of C++. at Beginner level i would say. I did understand what you did in it. But would take time to reach to a level where i can start doing it. But i am learning it and improvising. 

Attachments:

Well ... there's rather simple ways to find if this engulfs that ... and therefor this is the outer Loop and that is the inner Loop. Same for overlaps.

For million/zillion/gazillion curves ... well ... that's why boffins invented the // processing, he he.

Anyway get the usual update (added some checks more [invalid this, valid that] AND handled the critical column input matter: as it was > too exposed to stupid actions). Added the official emblems et all as well (in dark Grey background).

C++ : good news > the Dark Side (the only side) wants you: we have cookies and free Jack Daniels for all.

best, Lord of Darkness

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