Is it possible to retrieve 2D geometric data (e.g., curves, faces, annotations, and hatching) from section views or sheets in Autodesk Revit using the Revit API and C#.

Is it possible to retrieve 2D geometric data (e.g., curves, faces, annotations, and hatching) from section views or sheets in Autodesk Revit using the Revit API and C#.

WuKum
Explorer Explorer
321 Views
4 Replies
Message 1 of 5

Is it possible to retrieve 2D geometric data (e.g., curves, faces, annotations, and hatching) from section views or sheets in Autodesk Revit using the Revit API and C#.

WuKum
Explorer
Explorer

Hi, is it possible to retrieve 2D geometric data (e.g., curves, faces, annotations, and hatching) from section views or sheets in Autodesk Revit using the Revit API and C#.

Such as I want to develop a data conversion module.

0 Likes
322 Views
4 Replies
  • 2D
Replies (4)
Message 2 of 5

longt61
Advocate
Advocate

Yes, it is very much possible.

1. Get all elements in the view using FilteredElementCollector(), the overload that requires a view ID. You might want to utilize Revit filters to get the elements you need.

2. extract geometry from those elements using Element.get_geometry() by creating a recursive method to get all nested geometries until it reaches the ones you need. 

3. Do whatever you want with all the extracted geometries.

Message 3 of 5

WuKum
Explorer
Explorer

Thank you for your suggestions.

As far as I am concerned, in Revit, most “2D” drawings on sheets are actually generated from underlying 3D elements or view-specific detail elements.

For the Geometry Extraction,  does method like the element’s GetGeometry(…) work with appropriate GeometryOptions to retrieve curves and faces from elements included view-specific views?

 

 

0 Likes
Message 4 of 5

WuKum
Explorer
Explorer

Thank you for your advice.

WuKum_1-1742543758331.png

WuKum_2-1742543778074.png

It seems what can I retrieve in sectionView is still the solid information insteand of curves for 2d drawings.

Do you have some ideas to solve that?

WuKum_0-1742543737520.png

 

0 Likes
Message 5 of 5

longt61
Advocate
Advocate

It depends on what you mean by "curves for 2D drawings".
1. If you only want to get the 2D elements, then you should pass the 2D view (such as section view, sheet view, drafting view etc...) to the geometry options instead of active view. Then you can further filter some certain types of element that can only appears on 2D views, such as Detail Curve, Annotation Family instead of 3D elements like Model Curve or Column Family.

2. If you have not reach deep enough to get the primitive geometry such as points and lines, you should continue to call get-Geometry() method in order to get them. Keep in mind that they are still 3D geometry. In order to convert them to 2D geometry, you can project the points and lines on to the sketch plane of the view (end user will call it working plane), or do some extra conversion that suits your needs.

Other than that, I don't see any way to achieve your goal unless you can share the specific detail of your work.

0 Likes