Generate bitmap from part file using apprentice

Generate bitmap from part file using apprentice

Raider_71
Collaborator Collaborator
500 Views
3 Replies
Message 1 of 4

Generate bitmap from part file using apprentice

Raider_71
Collaborator
Collaborator

Hi guys something I have never played with but something I would like to do now. I am trying to use apprentice to generate a bitmap in a predefined orientation and saving the bitmap to file. I am using sample code from Brian Ekins' AU handout - CP5605 but the code is just not working.

 

This is what I have so far:

 

' Create an instance of Apprentice. 
        Dim apprentice As New Inventor.ApprenticeServerComponent

        ' Open a document. 
        Dim doc As Inventor.ApprenticeServerDocument
        doc = apprentice.Open("c:\file.ipt")

        ' Create a camera to define an iso view. 
        Dim camera As Inventor.Camera = apprentice.TransientObjects.CreateCamera

        ' Assign the component definition to camera so it knows what it's looking at. 
        'THIS IS WHERE IT FAILS
camera.SceneObject = doc.ComponentDefinition ' Set the orientation, fit the view, and apply it. 'THIS IS WHERE IT FAILS AS WELL
camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopRightViewOrientation camera.Fit() camera.Apply() ' Get an image of what the camera currently sees. Dim cameraResults As stdole.IPictureDisp = camera.CreateImage(300, 300)

Has anyone got some pointers for me?

 

Thanks and cheers!

0 Likes
501 Views
3 Replies
Replies (3)
Message 2 of 4

wayne.brill
Collaborator
Collaborator

Hi,

 

I do not have good news for this. It is a known issue that was discussed by my colleague in this forum post:

http://forums.autodesk.com/t5/inventor-customization/apprentice-server-com-exception-with-inventor-2...

 

I have added a note to the Inventor Engineering ticket that this issue was reported again in this post. I find that the problem still exists in Inventor 2017.

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

Raider_71
Collaborator
Collaborator

Hi Wayne,

 

Thanks for the feedback. Do you think this will be fixed in a service pack at all?

0 Likes
Message 4 of 4

wayne.brill
Collaborator
Collaborator

Hi,

 

We have had several reports of this issue and have let Inventor Engineering know that this problem is a high priority. I am not sure when a fix for this will be provided.

 

Thanks,

Wayne 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes