Camera.SaveAsBitmap Method

Camera.SaveAsBitmap Method

Anonymous
Not applicable
1,151 Views
3 Replies
Message 1 of 4

Camera.SaveAsBitmap Method

Anonymous
Not applicable

 

Hi,

 

I'm currently writing a C# application using the InventorApprentice library and I had a question with regards to the parameters of the SaveAsBitmap method.

 

The parameter list is (filename, width, height, topColor, bottomColor).

 

The two colors are defined as objects, but I've yet to figure out how to get them to pass successfully. I'm assuming they are used to overwrite the background/foreground colors. I would like to be able to force the background (bottomColor) to White if possible.

 

Does anyone have any suggestions?

 

Thanks,

Jon

0 Likes
1,152 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

 

Does  anyone know where I can get documentation on the Camera.SaveAsBitmap method? The generic type of "Object" for the top and bottom color is not giving me much to go on.

 

I'm able to pass null successfully, but I would actually like to specify the color objects if possible.

 

Thanks,

- Jon

 

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

I have YET to have a SINGLE question answered on this forum. Yet another example of a simple question being completley ignored... WHAT IS THE OBJECT TYPE AND ENUM FOR PASSING COLOR IN THE SaveAsBitmap parameters?

 

so far:

 

Inventor.Color bgColor = InvApp.TransientObjects.CreateColor(255, 255, 255);

 

this does nothing when passed into the method.

 

Then again - i might as well be talking to a wall on this forum anyway....

 

FYI - in documentation - ByRef topColor As [optional] VARIANT, ByRef bottomColor As [optional] VARIANT means abosultye zero with no table for variant descriptions....

0 Likes
Message 4 of 4

Vladimir.Ananyev
Alumni
Alumni

The TopColor and BottomColor arguments take a Color object.  

Public Sub CreateImageTest()
    Dim v As View
    Set v = ThisApplication.ActiveView
    
    Dim cam As Camera
    Set cam = v.Camera

    'Red color
    Dim top As Color
    Set top = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
    'Green color
    Dim bottom As Color
    Set bottom = ThisApplication.TransientObjects.CreateColor(0, 255, 0)
    
    'gradient background (red to green)
    Call cam.SaveAsBitmap("C:\Temp\Test.png", _
                v.Width, v.Height, top, bottom)
End Sub

Test.png 

Hope this helps.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network