Grasshopper

algorithmic modeling for Rhino

I have a triangulated mesh and I am searching for indexes of all three neigbhours of any face of the mesh. Does anybody knows how to do it?

Views: 2337

Replies to This Discussion

Hello Alexander,

Sandbox has mesh topology components with indexes output.

edit. chcked the components does not seem to have what you are after right out of the box

cheers

alex

Private Sub RunScript(ByVal Msh As Mesh, ByRef A As Object) 
If Msh Is Nothing Then Return
Dim N As New datatree(Of Integer)
For i as int32 = 0 To Msh.Faces.count - 1
N.addRange(Msh.Faces.AdjacentFaces(i), New gh_path(i))
Next
A = N
End Sub

Attachments:

i was wrong. sandbox outputs these indexes.

 ng5 Alex  Thanks, it works!

 Daniel González Abalde

I don't work in vb but i learn c# a bit, tried to translate but it doens't work (there is something wrong in addRange, propably with gh_path but I am not sure). Could you help?

private void RunScript(Mesh Msh, ref object A)
{

List<int> N = new List<int>();
for (int i = 0;i < (Msh.Faces.Count - 1);i++)
{
N.AddRange(Msh.Faces.AdjacentFaces(i), new gh_path(i));
}
A = N;

}

DataTree<int> N = new DataTree<int>();
for (int i = 0;i < (Msh.Faces.Count - 1);i++)
{
N.AddRange(Msh.Faces.AdjacentFaces(i), new GH_Path(i));
}
A = N;

Mesh(+) has this now too as well as labeling components.  Sandbox, however, also works with BReps in addition to meshes. Starling works too but is based around plankton meshes so it's a little more obtuse to use...

 Daniel González Abalde 

already done it in c#, but thanks!

when are you old heads gonna start using the text buttons so i can translate your work without hunting for every little picture?  :)

Can you give me a quick explanation on how to use the index values that come out of the F-F-angle component, matching them with the indices of the edges-midpoint component?

I don't know enough about mesh information ordering to know what I'm looking at.

I resemble that remark... I went the way of DR and jumped on the picture band wagon. It's more compact (or so the theory goes).

I've played around a bit more with all of these add-ons. I think m+ is pretty slick, but if you have faces w/ more than 4 sides it's a non-starter because of mesh limitations (until everybody starts writing components for Plankton meshes which can do n-gons).

Sandbox is the way to go to stick with BReps (but I copied the way m+ does labels).

And now to answer your questions:

OK YOU ARE GREAT!

The second half of that quick question:  by which process would one then use those indices to tag those edge midpoints with the angle measurements?   Or, how do you determine which text those labels are displaying (instead of index numbers).

Or, in other words-- how do I match the structure of the data coming out of the edge-midpoint component with the structure of that list of angles?

If you think I'm going to get it anyway, feel free not to answer.   Young ones must sometimes learn hard way.

or, does that indexing of faces match what you get if you "deconstruct mesh" ?

m+ plankton edition on its way... hopefully before 2017

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service