Is there a maximum integer value of an element id in Revit?

Is there a maximum integer value of an element id in Revit?

Anonymous
Not applicable
10,141 Views
3 Replies
Message 1 of 4

Is there a maximum integer value of an element id in Revit?

Anonymous
Not applicable

when I am handling Revit element Id (integer value) in c++ which gives a 8 or 9 digit number when I try to add or multiply a number with that element id for further operation I am facing an issue. It returns negative value because it exceeds c++ maximum integer value limit. If there is any fixed range integer value of element id in Revit it will be helpfull to write code in c++. Kindly let me know if there is a maximum integer value of element id in Revit.

0 Likes
Accepted solutions (1)
10,142 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

That kind of information is basically totally irrelevant, since it makes no sense for you to add or multiply Revit element ids, from the Revit API point of view. However, if you insist, I think you can safely assume that they are 32 bit signed integers.

 

Look at the Revit API documentation, e.g., the ElementId.IntegerValue property:

 

https://www.revitapidocs.com/2020/f7074647-9521-0f64-d2e2-eb2401aace85.htm

 

The integer value is represented by a .NET int:

 

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-typ...

  

int -2,147,483,648 to 2,147,483,647 Signed 32-bit integer System.Int32

   



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

0 Likes
Message 3 of 4

Anonymous
Not applicable

Hi @jeremytammik ,Thank you so much for your response. I use to multiply wall's element id integer by 100 and add layer index just to keep tracking each layer's elements.

Example:

wall element id: 2444567

list of layers-

244456701 for layer 1,

244456702 for layer 2 

 

So during this process I faced issues because after adding or multiplying with large integer value ,it exceeds the limit and returns negative value. But Yes I can use unsigned int,long int,unsigned long int in C++ to solve this issue. But I am just making sure what will be the maximum limits.

 

if  2,147,483,647 Signed 32-bit integer is the maximum limit then I can modify the code so that it wont exceeds this limit.This will help.

Thank you so much once again 🙂

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation. My pleasure.

 



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

0 Likes