Clustering items according to some criteria

Hi everyone!

I have a Brep that represent a building stock composed of about 1270 buildings. I obtained that Brep extruding the shp.
I would like to know if there is a way to split that Brep in groups acording to the year of construction of each building. I have tried with sort list and then split list, but i doesn’t worked.

One of the solutions would be to import several shapefile and make the extrusions separetely, but i would like to know if it’s possible to do it dividing just one extrusion.

Thanks for your help!
Patricia

Hi Pborges,

it is possible to sort the objects. But you need some information to split the list into several other lists.
If you have a list with the construction dates of every objects, you could easily construct a index-tree and use them to sort your objects. It would be easier, if you provide some more information or definition.

greetings,
Bumaye

1 Like

If you have related (i.e. building year in this case) building info associated with the extrusion curves used that’s rather easy: that’s a entry level clustering task. Clustering means: make “groups” of objects according some criteria. Clustering could be hard (an item belongs to only one “group”) or soft (an item may belong to more than one “group”).

Plus if your building info data contain other information as well (height, environmental rating, usage/type etc etc) … then that’s a medium level clustering task (also easy to do) done via sequential queries: say … get the buildings done in 60’s and then further subclassify according this type of info … then further subclassify according that type of info … etc etc. This nested clustering is called HAC (H for hierarchy).

The easiest way to do that is to use a List of a custom type (say: a BuildingInfo class) and then perform any query imaginable.

BTW: If you want a simple demo (C# only, not components) on all the above, notify.

1 Like

I have two kinds of information the Shapefile importation and an excel file with several information related to the buildings. I attach an image

But my question is, How can I associate the excel information to the extrusion to do the clustering task?

Thanks for your help!

Yes please if it is possible I would like a simple demo :grinning:!

OK, I’ll try to remove complex stuff/freaky classes etc and I’ll post the simplest demo (i.e. Flat Hard Clustering) possible soon (Do you speak C#?) using, say, some basic arbitary criteria (randomly assigned to a curve List) as follows: Year, FootprintArea, Height, Usage. This means either cluster by year OR by year AND footprint OR by year AND footprint AND height … blah, blah. Cluster means: get the things into a Brep DataTree.

BTW: I do that sort of stuff every day: I run a practice (AEC market sector) and building design these days … is … er … making queries and asking stupid questions 10000 times per day (is this design ugly enough to qualify as a great thing? is this material OK? is that client rich enough to pay the zillions? are we running out of espresso?)

And do you know if it is possible to do it without coding?

Yes, but i will need your data and will need a day or so since i’m out of the office at the moment. Peters solution will provide more options and flexibility with less overall learning.

I have no idea (I do stuff only via coding). Found some time to work on that one (in fact to remove a lot of things in one of my internal C#'s) … but it could be handy if you can provide a wish list for the clustering criteria: otherwise things should been modified after the demo. Shown a test result (on a random collection of curves and a random assignment of year, hight and usage) using a simple year based clustering. Text Dots would been added soon for identifying the buildings that belong in a given cluster.

Given a min-max build year Interval the var resolutionYears controls the amount of clusters (it divides the Interval in “periods” and then classifies the buildings accordingly).

And a combined Search test result (as shown all 4 criteria used: find buildings from/to year, from/to area, from to height from/to type):

BTW: While Search is easy to get the gist of it (From all Ducatis, Find the red ones, Then the Panigale ones, Then the ones not crashed, Then the ones that start when it rains => obviously a null collection [due to the latter filter]) … the hierarcy in HAC Clustering requires a full knowledge of DataTrees with many dimensions (where each added classification rule yields another dimension).

So the 1M question is: are you 100% OK with trees? (a kind of Dictionary of Lists) If not I would exclude nested Clustering from the demo.

Tip: Change the thread title ASAP: this case is NOT about splitting anything … is about clustering items according to some criteria.

Yes you are right!:ok_hand::ok_hand:

First of all thank you very much for your help and for the time you are dedicating to solve this doubt!

Then for your last question yes i’m ok with trees, but not very much with coding… but I will try to do my best!

The thing is that i have my data (my data tree is in this moment (1,0,0)) and what i want is to obtain 5 groups from this one correponding to diferent intervals of years and with that obtain 5 breps instead of 1.

Could it be possible to you send me the file with the example that you show me before to see the code inside the clusters?

OK, get the demo … BUT (trust the Lord) HAC Clustering is removed for the moment: as it is the C# does flat clustering with regard ONLY build year (but the Search is using all the options). Reason for that simplification is that I need some specific rules from you with regard nested clustering (for instance clustering by year, then by area then by something else IS NOT the same as clustering by area then by year … etc etc). As I said use resolutionYears to control the N of clusters. If that is 1 (has no meaning: why cluster all things in one cluster ? who does that ?) then the value of 2 is taken instead.

So there’s 2 modes available. Cluster (see Info Panel):

and Search (where the filtering criteria/progress are reported as well):

Nothing is internalized (I never do that): Load R file for the profiles

Clusters_ViaCustomClass_WIP_V1.gh (135.4 KB)
Clusters_ViaCustomClass_V1.3dm (91.0 KB)

BTW: I did nothing special: just removed a lot of restricted - to public - things (cross fingers that it works)

Added an optional visual indication (TextDots) and a test Tree emulating the real future BrepInfo Tree (from Excel when time comes).

IF that tree contains the right data , then is used meaning that no random stuff is made inside the C# ( Info panel informs you about that).


Clusters_ViaCustomClass_WIP_V1A.gh (139.0 KB)
Clusters_ViaCustomClass_V1A.3dm (127.2 KB)

IF you disable the related parameter then the random result goes on.

BTW: That’s just the prelude: when is tailored to your Excel … nothing from what it would do is achievable via components (not even in a million years).