AddRaster method example

  
Sub AddRaster_Example()
'This example adds a raster image to the drawing and determines its properties.
    Dim insPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage
    ' Select the image. Modify following as required
    ' to match an exitsing raster file on your computer
    imageName = "C:test.jpg"
    insPoint(0) = 4: insPoint(1) = 2: insPoint(2) = 0
    scalefactor = 1
    rotationAngle = 0
    ' Add the image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insPoint, scalefactor, rotationAngle)
    rasterObj.Update
    ThisDrawing.Application.ZoomExtents
    ' Determine properties of the image
    MsgBox "The property .ImageFile is: " & rasterObj.ImageFile
    MsgBox "The property .ImageHeight (in drawing units) is: " & rasterObj.ImageHeight & _
    Chr(13) & "The property .ImageWidth (in drawing units) is: " & rasterObj.ImageWidth
    MsgBox "The property .Height (in pixels) is: " & rasterObj.height
    MsgBox "The property .Width (in pixels) is: " & rasterObj.width
    MsgBox "The property .ImageVisibility is: " & rasterObj.ImageVisibility
End Sub

© Bricsys NV. All rights reserved.