celds.gh (12.4 MB)
I extracted principal stress isolines from Karamba and subdivided them into smaller segments before applying k-means clustering. To generate cells for each cluster, I used the endpoints of these small segments to compute a convex hull for each cluster. However, the resulting cell boundaries are not consistently shared between adjacent clusters, leading to overlapping or mismatched edges.
I attempted the following approaches:
Convex Hull per Cluster: Created hulls using the endpoints of the segmented isolines, but the adjacent cells ended up with different, non-matching boundaries.
Merging Hull Boundaries: Extracted the edges from each convex hull and tried to use them to define shared borders, which worked for some cells but failed for others.
I also tryed alpha shape but the problem comes when the border have to be shared
Does anyone have a more robust method to ensure that the cells generated for each cluster share exact boundaries with neighboring cells? Any ideas or alternative workflows would be greatly appreciated!
Here is a not nice way.
I extracted many points, because it is too long.
The idea is to have a cell for each point. It is Voronoi here but could be a square …
Each cell has a number so i put it on a branch (I still have problem to find the exact way using Grasshopper component so I use a little C#) . There is a component in Heteroptera by the way “Allocate by index”.
Also Voronoi component has some problem here so I use mine (in Nautilus plugin).
Then region Union
Using a Hull (whatever) with points can’t generate same boundaries.
Thank you for taking the time to look for a solution. It is important that the cluster boundaries follow the isolines of the principal stress because this serves a structural purpose. Additionally, I will eventually need to create joinery between the parts, so having control over the borders is crucial.
If you want to follow iso values you can use some tools inside Nautilus
Mesh Iso Splitting, but you must provide a mesh with values (stress ?) for each vertex.
Sorry, I didn’t communicate it properly. It is important that the cluster boundaries follow the endpoints of the isolines (the colors of the clusters). What I meant is that in your script you have a sort of zig-zag rather than a clean boundary following the endpoints of the cluster wich is what I need. Also the proble with voronoi (that I tried already is that it changes too much the cluster limits.
Here I have the mesh (that I used in karamba) and the principal stress isolines. I thought about clustering to have segments with similar direction in the same cluster and the I had troubles to get smooth frontiers. If this doesn’t work what workflo could allow me to cluster segments with similar directions and clean boundaries? Thank you Mesh + isolines.gh (118.8 KB)
Thank you for taking the time to read this, I’m uploading the file with the internalised data.
I’ll try to explain the whole workflow, maybe it helps you understand better:
The objective of the exercise is to orient an orthotropic material (wood, which is stronger when the fiber is aligned with the direction of the force, i.e., the principal stress).
To achieve this, I extract the principal stress and use smaller isoline segments, which I then cluster into groups based on similar orientation. Once the segments are correctly clustered, the borders should be shared, and I should use the average orientation of each cluster to perform laser cutting along the border lines on a wooden piece with the appropriate fiber direction.
The challenge is that the segments within the same cluster should not vary too much in orientation and should remain within a range of approximately ±7 degrees. If the direction changes significantly, a new cluster should be formed. If you can think of another way of doing it that can be more precise its good too. Mesh + isolines.gh (6.0 MB)
I also need to test this in more advanced software like ANSYS to understand how efficient the clustering is. This is why it is crucial to achieve proper clustering and well-defined borders.
Most of the time helpers have not all the tools you have. I have many plugins but not all. Here I just need some mesh and scalar field or vector field associated with vertex of mesh.
So if you can put a vector component and/or click Internalize, data will be loaded in the vector component.