Message 1 of 4
Generate bitmap from part file using apprentice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!