Message 1 of 6
Apprentice Camera Save As JPG - Error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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);