The reason this method is on a view is because you can have multiple views
open at a time and this is a way to specify which view. You've probably
also found that when you save a bmp it captures everything in the view.
I've written a small routine that resizes the view and zooms in on the sheet
so that the view only displays the sheet. It then writes out the bmp file.
I have an argument that specifies the desired resolution of the output in
pixels per inch. Hopefully this is what you need.
' Saves the active sheet as a bmp.
' Resolution - Specifies the output resolution of the bitmap in pixels per
inch.
' Filename - Specifies the output filename. It should have a .bmp
extension.
Public Sub SaveDrawingAsBMP(Resolution As Long, Filename As String)
' Get the active view.
Dim oView As View
Set oView = ThisApplication.ActiveView
' Determine if a drawing is active.
If Not oView.Document.DocumentType = kDrawingDocumentObject Then
MsgBox "A drawing must be active when running this macro."
Exit Sub
End If
' Get the drawing document and the active sheet.
Dim oDoc As DrawingDocument
Set oDoc = oView.Document
Dim oSheet As Sheet
Set oSheet = oDoc.ActiveSheet
' Change the size of the window so it has the same aspect ratio
' as the sheet. It changes the view such that it becomes smaller.
oView.WindowState = kNormalWindow
Dim dSheetAspectRatio As Double
dSheetAspectRatio = oSheet.Width / oSheet.height
Dim dViewAspectRatio As Double
dViewAspectRatio = oView.Width / oView.height
If dSheetAspectRatio > dViewAspectRatio Then
oView.height = oView.Width / dSheetAspectRatio
Else
oView.Width = oView.height / dSheetAspectRatio
End If
' Get the camera and use it to zoom in so only the sheet is seen.
Dim oCamera As Camera
Set oCamera = oView.Camera
oCamera.Target =
ThisApplication.TransientGeometry.CreatePoint(oSheet.Width / 2,
oSheet.height / 2, 0)
oCamera.Eye =
ThisApplication.TransientGeometry.CreatePoint(oCamera.Target.X,
oCamera.Target.Y, 1)
Call oCamera.SetExtents(oSheet.Width, oSheet.height)
oCamera.ApplyWithoutTransition
' Determine the number of pixels wide the output needs to be
' to result in the desired resolution.
Dim lWidth As Long
lWidth = (oSheet.Width / 2.54) * Resolution
' Save the bitmap.
Call oView.SaveAsBitmap(Filename, lWidth, 0)
End Sub
--
Brian Ekins
Autodesk Consulting Services
Discussion Q&A: http://www.autodesk.com/discussion
"arrakisman" wrote in message
news:31064762.1100111881980.JavaMail.jive@jiveforum1.autodesk.com...
> Does any one know how to control the resolution of a bmp when exporting an
sheet. I found how to do it with a view but I need the entire sheet.