Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get preview image of a view in Bitmap

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1054 Views, 3 Replies

Get preview image of a view in Bitmap

Hello,

 

I would like to get a good view of an element in a document in Bitmap format. How would I go about doing this? I need it in Bitmap format because I would like to put it in winforms, showing a preview of the element.

 

I've checked out doc.ExportImage but that does not return a Bitmap and instead saves the file somewhere else. 

I've also looked at elemType.GetPreviewImage, but the element I am looking at has no preview image. 

 

Thanks in advance.

Labels (1)
3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: Anonymous

Since the two methods you mention are what is currently offered by the Revit API, I would suggest performing some research to find out how you can use them. It might be a long time before any other options crop up.

 

You could use ExportImage and then process to resulting file to retrieve a bitmap from that.

 

Alternatively, you could research how to ensure that GetPreviewImage does indeed return a suitable result.

 

Here are some examples showing how it can be used:

  

  



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

Message 3 of 4
Anonymous
in reply to: jeremytammik

Alright got it thanks.

 

Since those are the only two options, I'll export the image into a temporary location, then load them into Bitmap. 

Message 4 of 4
jeremytammik
in reply to: Anonymous

Way to go!

 



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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report