Grasshopper

algorithmic modeling for Rhino

hello,

 

i guess there is a way to generate branches from same x values for example. lets say we have 10 points ordered like pins in bowling. now every row has the same x value and i want a list which has 4 branches for every row but the items within each branch will vary from 4 to 1. can someone tell me how to accomplish this please?

 

thx!

Views: 9821

Replies to This Discussion

I would use the Create Set and Member index in conjunction with the Replace Branches Component to achieve this.

EDIT: the Jitter is just to demonstrate that it can be applied to any flat list of random points 

Attachments:

Hey Danny,

 

Why is the jitter neede here?

 

And how do you like this solution? Its combined by Davids resort2D and your pathmapper.

 

Best Regards

 

DeDackel

Attachments:

I realised this would be confusing so I added the EDIT comment

the Jitter is just to demonstrate that it can be applied to any flat list of random points

With your method you could have used the Flip Matrix Component instead of the Path Mapper that way you can change the data structure without having to edit the Path Mapper.

Unfortunately it only really works with this example using the Divide Surface, because it has the basic path structure already present to manipulate. I don't think you would get the same results with a flat list of points.

Sorry if this sounds harsh. 

Hi Gised

 

This should work

You first get the point coordinates, generate a set o unique X values, graft them and evaluate all the points X coordinate against every unique X value testing for equality. With that it's just a matter o culling.

 

Bye

Great sollution! THX a lot

I have a similar Problem, maybe someone can help.

I have a huge amount of points with a clear defined ID pattern. I have to sort the points out by their Obeject ID (this script works) and connect the points in sequence. 

The pattern is a surface name (from 000 to 999) and a corner (from 00 to 003) f.ex.; P1-ERDR-F-450-001

I leave the script uncomplete, as I tried so many combinations and I gave up now.

as the files are not uploading, find attached the public link

https://dl.dropboxusercontent.com/u/51129150/glass%20test.3dm

https://dl.dropboxusercontent.com/u/51129150/objectname.ghx

You're still using 0.9.0014 so you won't be able to open my file. You probably don't have the [Tree Statistics] component either, but you can use the [Param Viewer] to the same effect.

I made your VB script a bit bigger. Since you already had one I figured it doesn't count as cheating. The code is now:

Private Sub RunScript(ByVal ID As Guid, ByRef N As Object, ByRef S As Object, ByRef C As Object)
  Dim rhObject As New ObjRef(ID)

  Dim name As String = rhObject.Object.Attributes.Name
  Dim fragments As String() = name.Split("-".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)

  N = name
  S = Convert.ToInt32(fragments(3))
  C = Convert.ToInt32(fragments(4))
End Sub

There's no need a Try...Catch block, scripts already run in a safe environment. Also, don't use the weird DBNULL constant but Nothing instead. I removed that entirely because if the script throws an exception than the outputs will be Nothing anyway.

Once I have the surface ID (which is an integer luckily) and the Corner index, I graft both the original pointdata and the corner data. Then by replacing the default grafting paths {0;0}, {0;1}, {0;2} etc. with the surface integers, I can create a datatree which uses the surface ID as the paths.

At this point we have all corners that belong together in individual lists. However they are still unsorted. By also grafting and replacing the Corner numbers we can then sort the remaining points using the corners to achieve the final result.

--

David Rutten

david@mcneel.com

Tirol, Austria

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service