Grasshopper

algorithmic modeling for Rhino

I'm stuck trying to match two sets of data so I can output data in the data structure I want... again :(

I have a tree of 6 branches each with 2 curves. so {0} to {5} N=2

I also have a tree of 6 x 17 x 2 lines.{0,0} to {5,16} N=2

I want to intersect each pair of the first 17 pairs of lines with the first pair of curves,

each pair of the second 17 pairs of lines with the second pair of curves,

each pair of the third 17 [airs of lines with the third pair of curves...

etc

and end up with 6 x 17 x 4  - {0,0} to {5,16} N=4 - points that I can draw closed polylines through to have 6 x 17 polylines - {0,0} to {5,16} N=1

Is this just not possible or am I just going about this the wrong way?

Views: 634

Attachments:

Replies to This Discussion

This is a problem for which I've not found an elegant solution with native components. (But there's a big gap in my knowledge of the dark voodoo involved in modifying/managing trees with native components).

The solution I'm using uses a C# component that repeats a branch by an n-amount of leftmost matching branches.

In your case:

you want to repeat branch {0} from tree 1 for each first leftmost matching branch in tree 2.

Thus:

Copy branch {0} for the following paths:

{0;0;..}

{0;1;..}

...

{0;16;..}

And branch {1}

{0;0;..}

{0;1;..}

...

{0;16;..}

etc.

This gives you two sets of curves for each line. (times two lines = 4 curves). From there your intersect trick will work.

Attachments:

Thank you! That's awesome!

I was hoping there would be a nice simple solution, but I think I am also missing something about data structures and how to do things the way GH intended with native components.

Here's a Native Component method:

Attachments:

Thanks. I won't share the entire definition because it's long winded and people probably have better things to do than work out what the hell i was trying to do, but there is almost certainly a better way of doing what I'm doing so that I wouldn't need to deal with the data structures I seem to end up with.

It feels like I need some kind of strategy for managing data so that I don't have to resort to something like your example above to be able to do what I want. Or is it just the nature of the GH beast and I am going to have to be able to come up with data manipulating skills like this because every problem is different and GH data structure is very flexible, if not necessarily intuitive?

If anyone knows any links to resources on honing GH data structure skills then please share!

get this as well

Attachments:

Nice!

Scripting like this is a bit beyond me at the moment but it's good to see how this approach is done.

Thanks for your time!

If anyone wants a gold star for replying my original aim was to work out the "Region Union"(?) of these curves and lines so i would end up with closed curves consisting of 2 vertical lines with curves between them at the top and bottom instead of closed polylines with straight lines between the top and bottom of the vertical lines.

(after plugging lines and curves into Region Union, Region Difference etc and changing inputs to every combination of graft, flatten, simplify I couldn't get anything other than an empty output so gave up and went down the polyline route! :)

Have you got a definition or image for what the final result should be?

Well, it works so I'm happy really, but the way I have done the last bit that I got help with above is a bit lame... I'm sure I could have done what I'm doing to the waffled sections before laying them out flat.

and... If you look at the rectangular (nearly) cut-outs that I created (as above), they are formed from lines in the Y direction intersecting curves in the X direction but I joined the intersections with lines to make polylines whereas I originally intended to make them from the intersecting sections of the lines and curves so the bits marked in red would be from the original offset curve instead of constructed lines. I thought this could be done with Region Union or Region Difference.

The end result is a wine rack that i want to make from lasercut plywood!

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service