Grasshopper

algorithmic modeling for Rhino

Hello World !

Today, I've tried to make a tiny code that could sort faces of a brep according to their normals.

I'll first explain my code and after ask why i'm not already satisfied with it.

1. I deconstruct the Brep to understand which faces are planar which aren't.

2. I get the normal vector of each planar faces.

3. I deconstruct N into its component parts,

4. I put them on absolute values because i need to sort them by their parallelism in space not their actual side.

5. I merge the values together and create a set of only unique elements.

6. Partition the list by the third of its length

7. Flip matrix and concatenate the 3 values to get the unique code of their parallelism.

8. After, with another create set and a sift component i can sort them according to their N or -N direction.

The problem is that i don't want to use a sift pattern because it's not a very parametric way to get data; With it I have to manually change its number of outputs, I need a component that gives me x number of lists of surfaces parallel to one another. Like a "dispatch multiple component" but only with one ouput ?

Also I'm thinking that this code could be much clever if there's a tolerance parameter to put similar surfaces into the same lists even if their not perfectly parallel one to another

Thanks in advance for your help and your time.

Views: 2673

Attachments:

Replies to This Discussion

Well ... the bad news are that I'm losing my touch with native components with an alarming rate.

The good(???) news are that I have what you want.

How it works: for each Brep in the bList (null/invalid stuff is discarded automatically) it creates a "reference" Box according the  planeNormal values (that has 6 faces and 6 normals). For clarity these are displayed as wireframes (in red). Then it classifies each planar BrepFace accordingly (the min normal angle VS these 6 normals). Faces are stored as Breps in a DataTree. On that ... the second dimension corresponds 1:1 to the reference box "faces"/sides.

Use the "how it works" demo part to get the gist of what's happening.

For instance:

Or using Me (with all due modesty) as a List test:

Attachments:

Thanks Peter but I'm kind of totally lost when i see some C code... and I like to understand completely the tools I'm using hehe

Is there a way to have a kind of "Sift" or "Dispatch multiple" component with only one output that gives lists with surfaces with the same parallelism... 

PS: please no more C... I feel so dumb every time i see some...

And I tried to use your code but when I put geometry instead of breps into the inputs it doesn't work... no more C, GRASSHOPPER please

Well ... the bad news are that day in day out I'm more and more away from components (time to take a 5 year break as well?). Let's hope that some good Samaritan can resolve this the other way.

PS: Out of curiosity what sort of "geometry" have you tried? (I do hope not a mesh [besides the thread title states: faces from breps]).  

Those kind ;) breps and surfaces

Can you e-mail (or attach here) this thingy (or some representative portion of it) please? (Curiosity killed the cat)

I don't have your mail... and I'm not putting ongoing projects on forums hehe

Send me your mail I'll be very happy to have a though about my future turkish/bulgarian not isolated toilets !

... I'm not putting ongoing projects on forums ...

Yikes ... you become a real pro then (send me some autograph ASAP) .

Anyway ... due to a very rare crisis of altruism and humanitarianism (things more or less totally unknown to the Merciless Lord of SardineLand) I've added a component solution as well on that V1A attached. Note: the IndexOf component does bananas (replaced with you know what) ... and the last bad thingy is there because I'm out of espresso.

The pasta part works as the C# ("almost", anyway) with boxMode = per Brep (that's the new option).

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service