Tap into rendering pipeline - draw a simple rectangle over the viewport

Tap into rendering pipeline - draw a simple rectangle over the viewport

DanielKP2Z9V
Advocate Advocate
490 Views
5 Replies
Message 1 of 6

Tap into rendering pipeline - draw a simple rectangle over the viewport

DanielKP2Z9V
Advocate
Advocate

I'm building a command to list issues on a project that are located in the model, but I don't want to create new objects (e.g. text symbols) due to various reasons (they can be accidentally printed, they can be slow to hide/show), so I want to display them as overlays in the revit viewport. By overlays I mean something as simple as a rectangle showing where an issue is located - the issue description, date etc. may be displayed in a separate window.

 

Has anyone tapped into revit's rendering pipeline to draw such custom effects directly in the viewport? For a test I just want to display a rectangle.

 

I saw a few interesting demos of DirectContext3D API - would that be the right approach?

0 Likes
491 Views
5 Replies
Replies (5)
Message 2 of 6

eN27
Contributor
Contributor

Yup, there is no other option. DirectContext3D API is quite rough in use but is very performant, one downside there is no support for rendering text.

Message 3 of 6

DanielKP2Z9V
Advocate
Advocate

Interesting, thanks for confirming that. Yeah, I didn't expect any fancy "immediate mode" GUIs (although that would be cool), but a simple rectangle/point to locate an issue in 3D would suffice.

 

Do you know any existing plugins using this API already? I'd be keen on checking some sample projects.

0 Likes
Message 4 of 6

eN27
Contributor
Contributor

There is only one small open-source project worth checking and it is located in Revit SDK under name DuplicateGraphics.

I have used this API for highlighting things in Revit model in a few plugins, but they are not open-sourced:

c.gif





0 Likes
Message 5 of 6

jeremy_tammik
Alumni
Alumni

You can also search for more DirectContext3D samples and documentation on The Building Coder:

  

https://www.google.com/search?q=DirectContext3D&as_sitesearch=thebuildingcoder.typepad.com

  

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

Moustafa_K
Collaborator
Collaborator

I usually use   ITemporaryGraphicsHandler ...

it is very useful... at least for me to handle such cases, the draw back of this class, it is available from 2023

 

hope this helps

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes