Apprentice Camera Save As JPG - Error

Apprentice Camera Save As JPG - Error

ianjwellings
Contributor Contributor
893 Views
5 Replies
Message 1 of 6

Apprentice Camera Save As JPG - Error

ianjwellings
Contributor
Contributor

I'm trying to save a camera view of a model as a jpg. 

I've used these articles to produce my code:

https://modthemachine.typepad.com/my_weblog/training-material/

https://modthemachine.typepad.com/my_weblog/2013/09/working-with-cameras-part-2.html

But I keep getting this error:

Unspecified error (Exception from HRESULT: 080004005 (E_FAIL)

This is my code, any help would be greatly appreciated:

Inventor.ApprenticeServerComponent oApprentice;

Inventor.ApprenticeServerDocument oApprenticeDoc;

Inventor.Camera oCamera;

oApprentice = new Inventor.ApprenticeServerComponent();

oApprenticeDoc = oApprentice.Open(@"C:\Inventor\eye004.ipt");
                   
oCamera = oApprentice.TransientObjects.CreateCamera();

oCamera.SceneObject = oApprenticeDoc.ComponentDefinition;
                    
oCamera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation;
                                        
oCamera.Fit();
                    
oCamera.ApplyWithoutTransition();
                    
oCamera.Apply();
                    
TransientObjects oTo = oSvr.TransientObjects;
                    
Inventor.Color oTopColor = oTo.CreateColor(255, 0, 0);

Inventor.Color oBottomColor = oTo.CreateColor(255, 255, 255);
                    
oCamera.SaveAsBitmap("C:\\Temp\\eye004.jpg", 800, 600, oTopColor, oBottomColor);
0 Likes
894 Views
5 Replies
Replies (5)
Message 2 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@ianjwellings,

 

At glance, it shows that error is due to incompatibility of platform (x86). I am guessing that code is built on x86 platform. As Inventor 2019 removed to support for 32 bit platform, it is advised to use x64 bit platform to build code. Hoping that attached changes(64 bit.png) might help to fix the issue.

 
 

Please feel free to contact if there are any queries.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 6

sundaram1087
Advocate
Advocate

Hi

 

I try to Export image using Apprentice method. As suggested i have update the X64 in the compile option

 

Still am not able to get the image using that method

 

Am getting the following error

 

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

 

Regards

Shunmugasundaram

 

 

0 Likes
Message 4 of 6

Anonymous
Not applicable

Hi

 

I have the same error, attached image of the code

 

regards

0 Likes
Message 5 of 6

ls-4453
Enthusiast
Enthusiast

This still happens in Inventor 2022. Is there any solution?

0 Likes
Message 6 of 6

ls-4453
Enthusiast
Enthusiast

Bump. Can someone from Autodesk reply?

0 Likes