Revit Element.Location Seriallization

Revit Element.Location Seriallization

Ahmed_AbdElbary
Explorer Explorer
1,095 Views
8 Replies
Message 1 of 9

Revit Element.Location Seriallization

Ahmed_AbdElbary
Explorer
Explorer

Hello,

 

May anyone help me with this issue.

I need to copy/serialize an elements location from a Revit document to another[documents in different Revit versions]. I know that I can use data extraction for a location point or a location curve. But here I am talking about some elements which has neither location point nor curve [Like railings, floors, ...]. 

So I am thinking about using serialization to transfer this location object from document to another [documents in different Revit versions].

Anyone has a relative experience in this regard?

Thanks in advance.

0 Likes
1,096 Views
8 Replies
Replies (8)
Message 2 of 9

jeremytammik
Autodesk
Autodesk

The Revit API only supports LocationPoint and LocationCurve values for the Location property.

 

Afaik, no other values can be obtained.

 



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

Message 3 of 9

Ahmed_AbdElbary
Explorer
Explorer

Thanks @jeremytammik  for your fast support.

I am trying to verify that the element is in the same position in both of documents.

May you tell me if you have any approach to get such a location or even to compare elements location from a document and another.

In my case I have tried to extract element's geometry and its centroid to compare it with the values from the other document but, unfortunately, it did not work.

I have also tried to get the boundingbox and compare the max and min point values [as an aprx. solution] but I had huge values inaccuracies/variations [may be due to the difference in how is the bounding box computed in different versions] which made this approach not reliable also.

 

I will be very glade if you can help with this regard or kindly suggest another approach and I will proceed in testing it and get back to you.

 

Many thanks.

0 Likes
Message 4 of 9

TripleM-Dev.net
Advisor
Advisor

Hi,

 

Don't know what you're going to do with it in the lower Revit version.

Think about how it's done in the UI and find a similar method in the API, for Railings it's GetPath and use Create Railing

But doing this for each type of element would be huge...

 

Do you need to edit the content in the lower version, maybe try a IfcExport and import or open in the lower version.

Won't be perfect, but maybe enough?

 

- Michel

0 Likes
Message 5 of 9

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

The three approaches you mention are basically all I can suggest:

 

  • Bounding box
  • Location (point or curve)
  • Geometry vertices, or their centroid

 

I do not see why these should fail, except for elements that provide none of the three.

 



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

0 Likes
Message 6 of 9

Ahmed_AbdElbary
Explorer
Explorer

Thanks @TripleM-Dev.net,

For instance, I am trying to verify that element is in its exact location after document upgrade. Unfortunately the lower version, 2012, did not have neither a railing class nor any functionality to get its path. I am also obtaining a generic solution to be applied for multiple categories which does not have location point/curve. This also includes model-in-place families.

Thanks for your support.

0 Likes
Message 7 of 9

TripleM-Dev.net
Advisor
Advisor

Ok, upgrade check....

 

Maybe start with Schedules and compare quantities

Can also easily be done by API, export to Excel, don't know if ElementId/UniqueId's stay thesame after a upgrade but could be used to isolate differences.

 

Then depending on required accuracy export the R2012 to 3D dwg and compare that globally against the upgraded version for positions.

Or does it involve a lot of models, then maybe navisworks could be a solution?

0 Likes
Message 8 of 9

Ahmed_AbdElbary
Explorer
Explorer

Aha, this is the case, I have already compared the majority of schedules and most of elements locations.

But my case I had unequal schedules values for [for example] railings and this document contains +2000 railing, I would like to have an effective troubleshooting to determine which elements have been moved/corrupted. That's why I was approaching for a positioning reference comparison.

0 Likes
Message 9 of 9

TripleM-Dev.net
Advisor
Advisor

If it's a once in a time check, export only the railings to a 3D DWG (Maybe both versions?)

Link the 2 dwg's in AutoCAD (export dwg's to all ByLayer) and give both a different color (Red and Green).

 

Differences visually quick discovered unless small differences which would be acceptable?

 

- Michel

0 Likes