I am trying to use this transient camera function in Inventor 2012, but I want to replace SaveAsBitmap with a line to render the image and output to a file instead. Is this possible?
Private Function GetImage(ByVal Filename As String) As Image
' Create an instance of Apprentice.
Dim apprentice As New Inventor.ApprenticeServerComponent
' Open the specified file.
Dim appDoc As Inventor.ApprenticeServerDocument = apprentice.Open(Filename)
' Create a camera.
Dim cam As Inventor.Camera = apprentice.TransientObjects.CreateCamera
' Associate the camera with the part's component definition.
cam.SceneObject= appDoc.ComponentDefinition
' Set the camera to the desired orientation and position.
cam.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation
cam.Fit()
cam.ApplyWithoutTransition()
' Create an image. Can also use SaveAsBitmap to save the image directly to a file in one of several formats.
Dim picDisp As stdole.IPictureDisp
picDisp = cam.CreateImage(1000, 1000)
' Return the image.
Return Microsoft.VisualBasic.Compatibility.VB6.IPictureDispToImage(picDisp)
End Function