Grasshopper

algorithmic modeling for Rhino

Organize Points in Grid To Produce Closed Cells

So I produce curves in the UV directions and at their intersections I have points to form a grid. I want to infill these points with closed polylines, making smaller rectangles but everything I attempt will, in fact, make closed polylines but in no particular order or size. I'm thinking I may need to sort my points in order to let gh know how to infill.

I'm essentially attempting to divide a surface without splitting it, only using points and closed polylines. 

Any help will be great!

Views: 1723

Attachments:

Replies to This Discussion

Maybe you mean something like this:

The trick is the Combine components on the left, but there is probably a better way to do that. With the combined data, I tried to create permutations when creating 2 point rectangles...

Oh I've just realized btw, since they are permutations there must be some double occurrences which can be filtered out...(maybe draw diagonals and use removeDuplicateLines from Kangaroo plugin)

Ok, thanks for the reply and I like where this is going, however I'm still getting a random amount of different infill rectangles, not just duplicates and i believe your last statement was meant to answer this but I still can't seem to figure this one out. Let me know if you have any other ideas.

thanks again for the help.

Please recheck the placement of flatten and graft operations once again. If they are not placed correctly, things can become a mess.

Also, I have just installed the TT Toolbox plugin and there is another Remove Duplicate Lines component there.

One thing I remembered later: with the diagonal filtration method, the diagonals of two same rectangles with opposite start/end points will probably not be filtered out, since they have opposite directions. To solve this, you can compare (let's say) the x coordinate value for each start and end point (of a diagonal) and Flip Curve (let's say) if the x value of the end point is smaller than the x value of the start point. As I wrote earlier, there are probably shorter ways to filter them out.

Checking just now, the Remove Duplicate Lines in TT Toolbox looks more useful to my eye, at first glance. It has an "Indexes of the first instance of the duplicate lines" output. I would use it like this: first duplicate all of the rectangles (so that all will have duplicates, because , from what I understand from the description, this output will only work for lines with duplicates), then use the above component and get the indexes of each unique rectangle and use List Item to pick them from the doubled list.

If I didn't miss something, this should do the trick...

Hi Tibbar,

Use the Remove duplicate curves component. It has an option ("plus Flipped") to remove flipped curves too (in your case, those are diagonals with different start/end points). So not only lines, but any other type of curve.

It also outputs the indexes of the duplicate curves.

Hmm...maybe I'm not understanding this method correctly but I've attached a few images; one with my intent, the others are my current results. 

My issue is when i create my cells gh will output what looks like every combination of points to form a rectangle within the given grid, i'll be looking for 28 rectangles and ill get something like 180 instances. (im not sure if this is what you guys mean when you say duplicates or not), I need to somehow set a parameter or pattern so that gh knows what order to infill this grid.

Hope this clears things up, and thanks again for the replies.

Attachments:

Thanks djordje, I didn't know about The Milkbox and Remove duplicate curves.

Wow! You have a very useful component out there! The option to find the ones that are not overlapped is way cool.

And also, again I'm right now realizing :) that the previous diagonal method won't filter out all the duplicates, since there will also be many duplicate rectangles in the final list which are marked with the second diagonal of that rectangle.

HOWEVER using Remove duplicate curves instead, would solve it all without any hassle.

I used it here like this:

I couldn't understand one thing though: The plusFlipped toggle did not create any difference here. At first I thought; this is because the rectangle data has the height and width properties instead of corner points(?), so none of the overlapping rectangles would be flipped(?), BUT the outputs are Polyline Curves, so I'm not sure what's going on. I cannot read code but I think I saw that duplCrvs transforms the input into nurbs curves in the beginning(?) but it makes less sense if that's the case.

Also just as a second note to the o.p., the outputs are polyline curves here but you can transform them into rectangles if that is what you need. And, onlyOverlapped should be toggled on in case there may be some same size rectangles elsewhere.

Thanks again djordje and have a nice day!

Hi Tibbar,

Do not worry about the "Polyline curve". It's what you get when you cast the rectangles to curves.

About flipping: I attached an example of two rectangles: one original, and one flipped (used Rhino command "Flip").
You can see the difference between these two by running Rhino "Dir" command. Or you could for example evaluate both rectangles at some value (in this case at normalized 0.1). Or even just fit a planes from those rectangles in grasshopper, and you will see the difference:


Check the attached photo bellow:
"Remove duplicate curves" component haven't found any duplicate rectangles, when "plusFlipped" was set to "False":


But when set to "True" it found 1 duplicate rectangle:

In your case it may not worked maybe because "onlyOverlapped" was set to "True".

I added few more cosmetic things to the "Remove duplicate curves" component, so you could replace the old .user file with the new one.


Have a nice day too!

Attachments:

Hi djordje,

Thank you for the explanation and the renewed component.

It was really hard to understand it in the beginning without checking the screenshot on the component topic page. Now it works and looks great!

By the way, I wasn't really worried about the polyline curves but I was thinking like; if the component turns the rectangles into curves in the beginning, when I set them both to true, it should filter out the flipped curves that are also overlapped,and keep the flipped but overlapped ones when set like false and true (like the one in my previous post). That was what made me confused. So I understand now the component does not care if the curves are flipped or not when they are overlapped and the overlapped option is set to true.

Again, this is a great useful component and thank you for creating and sharing it.

Have a nice one.

quote:

So I understand now the component does not care if the curves are flipped or not when they are overlapped and the overlapped option is set to true.

It does.
Check the attached files now - I added another flipped rectangle on top of the original one (left rectangle from previous example):

Let's consider two cases:

a) plusFlipped: False, onlyOverlapped: True


It found no duplicate rectangles - because we required onlyOverlapped, which leaves out the right rectangle. On the left side we have two rectangles, on top of each other (overlapped), but one of them is flipped - therefor it found no duplicates.

b) plusFlipped: True, onlyOverlapped: True

It found one duplicate - again we required onlyOverlapped, so right rectangle is left out. On the left side we had two overlapped rectangles, one of which if flipped - that's ok now, as component threats these two as the same - therefor one of them is duplicate.

Attachments:

OK, then now I understand that a two point rectangle from A to B is not a flipped version of a one from B to A. I was thinking that they would be flipped versions of each other.

I should have understood this from the flipped rectangle drawing in your your previous message.

Thanks for the explanation.

I haven't understood you. The rectangle on the left is the original. Then I made two copies of it - one put on top of the original, the other moved to the right. Then flipped both of these copies. Is that what you were saying?

Sorry for the confusion djordje. I was first writing about the rectangles I created earlier, but then wrote about the rectangles you created.

If we forget about your rectangles for a minute, I was confused about the filtration of the rectangles I created because, amongst those rectangles, there were overlapping 2 point rectangles which were created in reverse orders (like one from point A to B and the other from point B to A) and I thought for some time that they would be flipped versions of each other (like a line from A to B and another from B to A). However, I realized that this is not true, and that was the reason why they were all filtered out of the unique curves list, without plusFlipped having an effect (since they all had the same direction). And I was also thinking that onlyOverlapped option was only filtering out the overlapped 2 point rectangles that had the same start and end points (because of the above misunderstanding), but I understood that direction is not about the order or placement of start/end points. This is all because of my lack of knowledge about rhino, gh and what direction and flipped really means.

When we come back to the rectangles you created, I should have questioned what direction&flipped mean after viewing the picture below, that's why I wrote that I should have understood earlier.

So, it was a lucky wrong approach but correct result situation I guess, and everything about duplCrvs is now clear for me.

It is beginning to look like that I stole this topic. It would be nice to get some feedback from the op if the recommended method worked or not, since I'm also learning this application and want to see if I make any mistakes.

Have a nice day djordje!

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