Bug in Revit 2013 - RevisionNumberingSequence

Bug in Revit 2013 - RevisionNumberingSequence

hzamani
Advocate Advocate
195 Views
2 Replies
Message 1 of 3

Bug in Revit 2013 - RevisionNumberingSequence

hzamani
Advocate
Advocate

Just reporting an issue I came across today with seems to be a bug.

 

In Revit 2023 getting the RevisionNumberSeuquenceId of a Revision that's set to None will return -1.

I was using this code in previous versions with no issues but in 2023 the casting will be null in the case mentioned.

 

var revSeqId = revision.RevisionNumberingSequenceId;
var revSeqEl = doc.GetElement(revSeqId) as RevisionNumberingSequence;

 

I haven't tested this in Revit 2024.

 

Thanks.

Hoss

0 Likes
196 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Yes. -1 is an invalid element id:

  

  

This sounds like expected behaviour to me. 

  

Please check the element id you receive and compare it with InvalidElementId before trying to retrieve a corresponding database element.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

hzamani
Advocate
Advocate

Hi Jeremy,

 

It doesn't look normal to me for two reasons. Firstly, if that's expected how come in previous Revit version it behaves differently? 

Secondly, that specific element is needed to set the RevisionNumberingSequence of a Revision. 

Which means if a Revision is originally set to None, you won't be able to programmatically set it to Numeric or Alphanumeric, since you can't retrieve it's RevisionNumberingSequence element.

 

Anyways. Hope it makes sense.

 

Cheers.

Hoss

 

 

0 Likes