Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get vertices of a revit edge along with unique id for each vertex?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Chintan.Shah
2401 Views, 3 Replies

How to get vertices of a revit edge along with unique id for each vertex?

Hello,

 

I am trying to query the end points i.e. vertices of an edge in revit.

 

I tried using edge.AsCurve().GetEndPoint(0/1), which is returning the correct endpoints as an object of XYZ class.

 

But I also want a unique identifier of each vertex so that I can eliminate the overlapping vertices from my processing while creating Boundary Represenation of a revit body.

 

I tried using Edge.GetHashCode() which works good for Revit Edges i.e the hash code for an edge queried from one face is same when we get the same edge in another face.

But XYZ.GetHashCode() is not returning same code for end points that are common for different edges/faces.

 

Am I querying the end points correctly?

Is there any other way to query a unique identifier for the revit vertices and even edges?

 

Thanks & Regards,

Chintan

3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Chintan.Shah

Dear Chintan,

In general, defining any kind of stable identifier for geometry that is dynamically generated and can change at any time is very hard.

In the Revit API, you can request so-called references to geometry objects. To do so, you set ComputeReferences to true when querying an element for its geometry.

These references can be converted to a stable string representation for storage and later retrieval using the Reference.ConvertToStableRepresentation method.

I suggest a much simpler approach here that may be of interest to you, creating your own key based on geometric location:

http://thebuildingcoder.typepad.com/blog/2012/03/great-ocean-road-and-creating-your-own-key.html#2

That will obviously not be stable either, but it might provide what you need.

I hope this helps.

Cheers,

Jeremy


Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4
Chintan.Shah
in reply to: jeremytammik

Hi Jeremy,

 

Using Dicionary for assigning unique ids to curve endpoints (XYZ) worked for me.

 

Thanks a lot!!!

 

~Chintan

Message 4 of 4
jeremytammik
in reply to: Chintan.Shah

Dear Chintan,

 

Thank you for your confirmation and marking the issue as solved.

 

I recapitulate our discussion on The Building Coder for future reference:

 

http://thebuildingcoder.typepad.com/blog/2015/03/state-of-the-view-and-data-api-va3c-and-edge-ids.ht...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report