Revit API

Reply
Active Contributor
grahamcook
Posts: 42
Registered: ‎06-18-2012
Message 1 of 4 (245 Views)

Revit Server API - Thumbnails

245 Views, 3 Replies
11-28-2012 03:25 AM

I have a Revit Server App on the go and part of it is retrieving thumbnails of the models held on the servers.  The Revit Server 2013 API Reference does give a brief explanation of the thumbnail query on page 20 but falls short of giving a code example.  So reading through some of the more general REST forums I came up with the code below specifically on how to extract the Image from the response.  But it Errors out on the commented line.  Anyone any sample code or ideas why it might be erroring?  Other types of query (contents, directoryInfo, etc) work OK.

 

Cheers

 

Graham

 

// Create request (model in root folder MyModels/Sector)
WebRequest request = WebRequest.Create(	
"http://serverName/RevitServerAdminRESTService2013/
AdminRESTService.svc/MyModels|Sector|model01.rvt/t...
");
request.Method = "GET"; // Add the request headers request.Headers.Add("User-Name", "Test"); request.Headers.Add("User-Machine-Name", "Test-PC") request.Headers.Add("Operation-GUID", Guid.NewGuid().ToString()); // Read the response // Next line fails // Error 500 Internal Server Error - The server encountered an unexpected condition which
// prevented it from fulfilling the request. WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
return new Bitmap(stream);

 

ADN Support Specialist
mikako.harada
Posts: 51
Registered: ‎08-26-2007
Message 2 of 4 (230 Views)

Re: Revit Server API - Thumbnails

11-29-2012 02:52 PM in reply to: grahamcook

Hi Graham,

 

While I never used this specific call, I asked a Revit Server engineer, thinking that I can request a sample code. He says that there is no problem in your code. The code is working at his side.

 

He also says that  “500 Internal Server Error” normally means this is because that the server/model gets into an abnormal state. You may want to take a look at AdminRESTService.log.

 

He also suggests to check whether the code work on other models.  Also to check whether other APIs work. (which I think you are saying that other API works with the same model above?) 

 

I hope this gives you some idea to look further.

 


Mikako Harada
Developer Technical Services
Autodesk Developer Network

Active Contributor
grahamcook
Posts: 42
Registered: ‎06-18-2012
Message 3 of 4 (227 Views)

Re: Revit Server API - Thumbnails

11-29-2012 03:29 PM in reply to: grahamcook

Thanks for that Mikako, much appreciated.  Your information was enough to figure out what was wrong.  I attach the AdminRESTService.log file from one of the servers which suggests that the Revit.Thumbnail20.dll file cannot be loaded (module).  Why i don't know yet.  It was a standard revit server install.  I'll look at it in the morning.  You've put me on the right path anyway!

 

Cheers

 

Graham

Active Contributor
grahamcook
Posts: 42
Registered: ‎06-18-2012
Message 4 of 4 (213 Views)

Re: Revit Server API - Thumbnails

12-04-2012 08:07 AM in reply to: grahamcook

I have now tested this on several sites and several servers and get the same error in the respective AdminRestService.log regarding Revit.Thumbnail20.dll (see attachment in previous post).  Even when i try re-registering the dll an error popup says:

 

"The Module Revit.Thumbnail20.dll failed to load.  Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.  The specified module could not be found."

 

All other aspects of my program work well without any problems so i suspect there is an issue with Revit.Thumbnail20.dll that needs fixing.  The file version is 2.0.0.0 dated 21 Feb 2012 9:28pm.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube