algorithmic modeling for Rhino

Hi everyone,

I am looking to solve two problems. I tried different methods but it doesn't work.

1. I have a list of boxes. the boxes are intersecting with each other.

I want to count how many boxes are intersecting with each box in the list.

2. Also I have another list of boxes. the boxes are adjacent to each other.

I want to count how many boxes are adjacent to each box in the list.

any idea how to do that in grasshopper?

Thank you,


Views: 680


Reply to This

Replies to This Discussion


Thank you for your reply,

So, this have to be done with a code?!

Since I never did coding before!

which language I should use? any suggestions!

Any suggestion to learn coding



What I meant was, please post your GH file (or the relevant part of it) so we can play with it.  The image alone doesn't describe the details of your problem.  Attempting to create a model from scratch to answer your question is too much effort and likely a waste of time.

See #3:

3. Attach minimal versions of all the relevant files
If you have a GH/GHX file you have a question about, attach it to the post. Don't expect that people will recreate a file based on a screen-shot because that's a lot of pointless work. It's also a good idea to remove everything non-essential from a GH file. You can use the 'Internalise Data' menu option to cut everything to the left of a parameter:

If you're importing curves or Breps or meshes from Rhino, you can also internalise them so you won't have to post a 3DM file as well as a GH file. If you do attach large files, consider zipping them first. Do not use RAR, Ning doesn't handle it.

It is especially a good idea to post files that don't require any non-standard components if at all possible. Not everyone has Kangaroo or Hoopsnake or Geco installed so if your file relies on those components, it might not open correctly elsewhere.


Thank you for the advice. I will prepare that

Ok here we go. here is the code.

Thank you



I don't understand what this is all about, anyway check attachment. I'm not sure this is what you are after.



What I want to do is:

I want to count for each box in the list how many boxes are surround it?, because I want to want to separate the boxes in the middle in a list and the boxes in the edge in a list.

Because later I want to make a loop that do this:

      A. Delete a random box from main list of boxes but I want to be sure that every time the box             is not located in the middle (not surrounded by boxes from all direction)

      B. I want to repeat this loop X time.

I updated the list and I deleted one of the problem so I have more focus here is the new version

Thank you for your help,


try this.... not sure if there are any bugs in it. Hope you can look at the techniques for manipulating paths which means you get greater processor efficiency.



That is awesome, I am learning GH and now I will spend the next few days studying your code so I can fully understand the technique so I can apply this in my school work. It is doing what I am looking for. Also I liked using colors it makes the model clear and easy to understand..

Thank you for you help

If its beginning to kill your computer when you crank up the box counts, you can disable the box geometry preview and link the colour to the numbers instead.

Technically you don't even need any box geometry or dimensions, its all operating from the path indices. (the boxes you start with may as well be substituted by Cartesian points)

It is also much faster just using adjacent faces as the only checklist input (see screenshot below)... (adding self, edges and corners doesn't give much benefit for how much it slows down the overall calculation)

You are aware of how to use clusters right? You double click them to look inside. (The tall block at an angle is from the cluster.)


No this is my first time to know about cluster in GH. That is really helpful it makes the the work manageable.


OK, just be aware that when you copy a cluster you've made, it is entangled with its change one, and all change that share the same canvas....a blessing but can also be a curse. Remember to disentangle it if you want to edit it without changing other.






  • Add Photos
  • View All

© 2020   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service