Grasshopper

algorithmic modeling for Rhino

Currently i have a GH python component setup to evaluate surface points on a selected surface, that creates polyline cells and centroids of the U / V grid in an organized data tree.
i have two task i trying  to complete :
  • creating a toggle to cycle through the different cells to identify its 4 neighbors
  • create (building) masses out of those polyline cells or from the centroid so i can extrude them with geometry and control the Z.   the goal is to achieve something similar to the image below
Any comments or direction you can offer would be appreciated

Views: 3670

Attachments:

Replies to This Discussion

Hi John,

If you are doing it for a Cartesian grid, and you want to keep it 2D then just do distance calculation from the center point of each cell to all the other center points, and sort them. The first 4 with minimum distances are your neighbors. You can do a vector angle analysis afterward to find which one is on what direction. You will face special cases for edge conditions though.

A better way I think is to extrude all your geometries for the same heights, and for each side surface trace a ray from the center of the surface, and find the intersection with other geometries. The first geometry that intersects with the ray is the neighbor on that side. If you get no intersection, you are testing an edge surface.

Well... another way that I can think of is to make a mesh from the points and then use: Rhino.Geometry.Collections.MeshFaceList.AdjacentFaces

...

Hope it helps,

Mostapha

Thanks Mostapha, in the attached jpg is a attempt to achieve what i wanted with on 2D but it doesnt seem to work out, i agree the better test would be to test the heights of each neighbor 

Attachments:

Hey John... Do you want to attach your grasshopper file too? It would be easier to check the code then.

see attached files

Attachments:

Hi John,

So I did write a small script to help you keep going. I didn't solve all of the problems and the script won't work for all the cases but it shows how to sort your points based on distance or angles.

Hope it helps,

Mostapha

Attachments:

John,  

As Mostapha suggested there are several ways to do this (mesh topology, distance, etc.) Your process is built off of a surface which has uv coordinates that you use to organize and create the grid.  This same logic can be used to organize the neighboring cells. Attached is an example.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service