Grasshopper

algorithmic modeling for Rhino

Hey all,

Currently I am trying to output the nodal connectivities for the above tessellated structure. As can be seen, I have the nodes' number in each vertex. All I want is for the Grasshopper to output such as:

0,1

1,2

2,3

3,4

4,5

5,0

0,76

1,75

75,76

etc

The output should be in a panel ghx function that can be exported to text file. I want to use this information for truss analysis. 

I have been struggling with this for so long. I cannot find a proper tool in ghx to extract this information. Ghx seems to know this connectivities, I just need find a way to extract this. 

Anyone, please help

Thank you in advance. 

Views: 805

Replies to This Discussion

So you have a collection of points and a collection of lines? Or only just lines?

Sandbox is grasshopper plugin that could help you.

cheers

alex

Hello Earth(!)

You can try something like this:

ps. curves and points should be in a simple list (not trees)

Thank you all for replies.

Hey David, its a collection of polyline curves (42 of them) consisting 12 hex, 6 smaller hex, and 24 trapezoids. They somehow cannot be joined into a single curve using the 'join curve' function in ghx, but can be joined into 1 brep and thus have set of edges and points with right amounts I want it (without overlapping points)

@Alex: I will take a look at sandbox 

@nikos: I tried to do what you did but it does not work on my case. The text result you showed is exactly what I wanted. I attached the model and ghx files trying to do what you did. It seems I may do something wrong. 

Please help. 

Thank you again in advance. 

Attachments:

The reason it doesn't work is because I assumed you had lines, but they are actually polylines and so their endpoints are only part of the point list you want. 

In order for the definition to work you just have to explode them first(and flatten) and add a [create set] somponent at the end of the definition (because you have some lines on top of each other):

Attachments:

Thanks alot nikos for the help.

I think I quite get the process and almost there. However, since I used the old version of the grasshopper and rhinoceros 4, I was wondering if there is any tool that can replace the cullPt? 

I was unable to open your file too, so I remake the definition without using the cullpt function and it seems it does not work such that the indexes of the vertices are randomly large and unorganized. 

Would other cull function able to replace the cullpt?

Attachments:

I tried to use dupPt to replace the cullpt for removing the similar points. Although the indexes of the vertices are better now (within range of the number of points =108)But  they are not connected in the order to form the tessellation. 

Attachments:

Ok, lets break this down to simple steps (and simplify this a bit):

1.We have a list of 42 polylines. These have some segments in common (and of course some duplicate points). I am assuming that the order in which these polylines are drawn is not important (correct me if this is not the case).

2. We explode the polylines. This outputs all the line segments and all the endpoints (both groups with duplicates inside them). So we have 204 lines (including duplicates) and 246 points (including duplicates). We flatten both outputs in order to get 2 simple lists.

3. We use [dupPt] to remove all duplicates from the points list. So we get a list of all the nodes with each node contained one time, so we have 108 points.

3a. We can use [pointList] to display the index of each node on screen.

4. For each line segment we find the 2 endpoints and put them together in a list. So we have 204 lists with 2 points each. (We graft the list of lines so that the endpoints of each one will be in a different branch/list)

5. We use [closestPoint] and so for each endpoint we get the index number of the corresponding node. So we have 204 lists with 2 indices each.

6. We get each couple of indices and join them as text with a comma separator. (We flatten the data so that we have a single list with 204 texts)

7. BUT some of these 204 texts are duplicates (because they originate from duplicate lines), so we use [cSet] which returns the unique values from a list. So we end up with a list of 180 texts (one for each unique line). Instead of using [cSet] you could also eliminate duplicate lines using kangaroo's [dupLn] (which is the equivalent of [dupPt] but for lines) before step 4.

Hope it is more clear like this. I am not sure I understand what you mean by "But  they are not connected in the order to form the tessellation.". If you still have problems with the definition please explain this a little better.

cheers, Nikos

Hello Nikos, 

You have been much helpful. Thank you very much for this. 

Usually for element connectivities I have to manually generate the numerical pattern of the element connectivities in matlab, which is cumbersome and quite stupid. But now with this, I feel much much better. Now I can have even extract the element connectivities describing the modules of the tessellation (hex, trapz etc). Very great, Thanks to you. 

Your explanation is very great too. I understand the processes now. 

I guess the only function that I am still unable to understand very well is the 'closest point'. I am not quite clear about the relation between having the set of points to search for (S) and point to search from (P), and outputting the index of closest point. 

Hello Earth (hahaha I feel like Major Tom when saying this),

I'm glad I could help.

The [CP] is indeed the trickiest part of the definition.

The from and to points are actually the same but they are grouped differently:

On one hand (input P) we have 204 lists with 2 points each (the 2 endpoints of each line).

So it looks like this: {point A, point B}, {point B, point C}, {point C, point D}, ....etc

On the other hand (input S) we have a single list with all the points, cleared from duplicates(108 points).

So it looks like this: {point A, point B, point C,...., point n}

What [CP] does is: it takes every single point from P and searches all of S to find the closest point.

Of course it will find the same point that it searched from. That's why the distance (D output) is always 0.

BUT [CP] also has an output i. This is the index(an integer from 0 to 107) of the point in S that was closest to the point from P

So the output i has the data structure of input P but looks like this: {i of point A, i of point B}, {i of point B, i of point C}, {i of point C, i of point D}, ....etc ...and this, when joined into text is the output you want! 

I hope this all makes some sense, it is a bit late here :)

cheers, nikos

Ok I just noticed this: "Now I can have even extract the element connectivities describing the modules of the tessellation (hex, trapz etc)"

Do you mean that you want the index list for each one of the original polylines separately? Because the lines might be scrambled with this definition (they might not follow the original polylines exactly...).

Thanks alot again nikos for the very detail explanation.

Its much clearer now, I appreciate it.

I uses the coordinates from the dupPt. So basicly using your configuration, I have checked the resulted element connectivities in text, when matched with the corresponding coordinates of the nodes from dupPt, it makes all the polygons again (Green lines in the picture below), exactly as the original.

So Im thinking its like reconstructing everything again from the original shape with new relation between coordinates and element connectivities. 

So in this case, eg: 0 1 2 3 4 5 makes the hexagon, 21 20 0 5 to makes the trapz.

Well here it misses the '0' in the end to close the hexagon here, the same with trapz. However the 'string join' and cset somehow close it to 0 1 2 3 4 5 0 to makes the hexagon, and 21 20 0 5 21 for trapz. 

Im very glad now. 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service