Grasshopper

algorithmic modeling for Rhino

Hey there,

I would like to know if anyone there did not already solved my problem of getting an unique "name" (text label) for a couple of points (segment).

Starting from a segment which is basically a couple of points (x, y, z), I would like to obtain a string that it can be used to identify this segment. In other words, if two segments share the same name this means that they are identical.

Thanks in advance

Jerome

Views: 914

Replies to This Discussion

... a segment which is basically a couple of points...

Er ... what exactly this means?

Other than that ... HashCode(s) is a way to get some [item-ID] "combo" ... but play with the tryMe slider and observe that these "unique" codes are assigned on the fly (GH objects NOT rhino objects) each time that any component (or the C#) executes.

Load R file for the demo data.

For "text labels" I've used textDots.

PS: There's issues in the Forum currently prohibiting attaching anything: in case of failure I'll try later on.

Attachments:

Hi Peter,

Thanks for your reply.

I see you are using C# component to access grasshopper API .. As a Rhino/Grasshopper beginner I am not familiar with such advanced component but I will investigate this way.

I did try to use edge points (start and end which are for me sufficient) but since segment AB is the same as BA the resulting ID should be independent of this order and I can figure out to manage this.

Thanks

If "segments" are made via GH ... well ... segment AB (a Line, that is) IS NOT the same as BA.

If you want to get rid of the "same" Lines Kangaroo1 has a related component (ditto for Points).

Other than that HashCodes well ... since they are "unique" per item (even if this  - for the one reason or the other - is created at the same location with that) I barely can see how one can use them in order to get rid if "equal" items (Lines in this occasion).

On the other hand ... well ... using HashSets sampling the Line center and testing length and direction ... well ... this works but why bother? > if you are not doing business with code (thus you need this "check" internally) > use the Kangaroo1 component.

That said the topic of "equality" is rather huge and most people are confusing a lot of things on that matter: for instance a point not equal to another ... well ... that's rather simple but a brep "not equal" with some else ... this is not that easy (if it's solvable).

Well, in my case, I have a geometrical point of view, where two points with the same x, y, z coordinates represente the same "object".

My goal is to find common pair of edges of adjacent faces. Geometrically, there is only one edge between adjacent faces (each face share an egde). I want to use this information in my design.

For this, hashCode won't do the job, if each face edge has its own ID I cannot use this information unless faces share the same instance of edge.

As I said HashCode does things but not the things that you want.

But wait ... are we talking connectivity matters? (if yes HashCodes are 1B miles off-topic) For instance get some breps and find what is connected with what (vertices, edges, faces [BrepFaces, that is], cats, dogs etc etc). Since we have 3 "classes" the possible combinations are 9 (if v = vertex, e = edge, f = face  >> trees of "type":  vv, ve, vf, ev, ee, ef, fv,fe,ff).

If you have "graphs" in 3d space Sandbox does that type of stuff as well. Same story for meshes, mind.

If this is the case ... I have code that does this ... and the good news are that there's (case breps) a GH component that also does this (Brep Topology) but in order to use it you must know what connectivity trees are (not to mention data trees, he he).

My goal is to explode a 3D model into its planar faces (using orient component) and decorate each exploded edge with some annotation in order to help assembly of the 3D model after cutting each piece.

Each common edge of adjacent faces should be marked with the same ID in order to know that these borders have to be joined such in papercraft patterns.

This is rather elementary I'm afraid using (properly) connectivity trees.

If I could attach a thing (or two) I could easily provide a demo on that matter. But well ... in this noble Forum the attachment capability works rather randomly.

If you want the demo ASAP go there and get the stuff related with my latest reply:

http://www.grasshopper3d.com/forum/topics/move-brep-face

Truth is that this is pure C# (and thus useless to you) but the good news are that you can do the "same" things with native components as well.

But ... er ... hmm ... fully mastering connectivity trees ... well .. it's a must.

Plan Z: Skype

Thanks Peter for your time, I need to continue to learn Grasshopper components especially data trees ones.

 

...especially data trees...

Indeed

BTW: Get this very entry level thingy attached that although uses code for doing the job... well ... the demo added (using native components) can give you some clues with regard the mysterious DataTrees and especially the ominous connectivity DataTrees

Oops > the same story again > no attachment posiible

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service