This is an script I wrote with a custom VB component that aims to perform subdivision of rectangles. Think of Mondrian paintings, perhaps. My friend needs to subdivide a regular frame to accommodate supports that is located in random manner. I performed the subdivision purely by mathematical methods, not geometrical means, thus the logic is quite stupid.

I wrote a custom VB class that holds the geometry as a 2D line, which is either x or y direction. I wrote custom functions for that class. Which is my first script in GH VB that plays with OOP to this degree. If you are interested in finding an example to learn custom classes in GH VB, this might be a good reference.

The inputs are all numbers because the logic are mathematical as mentioned, they are mostly logics that checks whether a coordinate is within a certain bound, and seeks the left and right closest bound. The component loop through all the points in the cell and add x lines and y lines alternatively until all points have 2 lines passing through them.

The input took the rectangular area as two domain bound, and took the x,y coordinates of the points in that area and performs the subdivision. The first part of the script prepares the data that is fed to the VB component, there is a part that sort out the points which lies within the cell, and those points are fed to the VB.

I guess some of you might be looking for something similar. Note that this is not referencing any of Mondiran’s work (I guess his subdivision principles are more complicated/ or artistic), but I just think they look similar.

My friend is intending to use the subdivision lines as structural elements, so I did an offset version.