AddRaster Method

Back to Methods Reference

Creates a new raster image based on an existing image file.


VBA : RetVal = object.AddRaster(ImageFileName, InsertionPoint,
                         ScaleFactor, RotationAngle)

VL : RetVal = (vla-AddRaster object ImageFileName InsertionPoint
                       ScaleFactor RotationAngle)

(vla-AddRaster mspace "c:/AfraLisp.jpg" (vlax-3d-point IP) 1.0 0.0)

  • Object : ModelSpace Collection, PaperSpace Collection, Block
    The object or objects this method applies to.

  • ImageFileName : String; input-only
    The full path and file name of the image.

  • InsertionPoint : Variant (three-element array of doubles); input-only
    The 3D WCS coordinates in the drawing where the raster image will be created.

  • ScaleFactor : Double; input-only
    The raster image scale factor. The default image scale factor is 1. The scale factor must be a positive number. You can set the scale of the image to the scale of the geometry created in the AutoCAD drawing.

  • RotationAngle : Double; input-only
    The rotation angle in radians for the raster image.

  • RetVal : Raster object
    The newly created Raster object.


Images placed through the AddRaster method are not actually part of the drawing file. The raster image is linked to the drawing file through a path name or document ID. Linked image paths can be changed or removed at any time by using the SupportPath property. By attaching images using linked image paths you place images in your drawing without increasing the file size of the drawing.

You can add the same raster image file to your drawing file multiple times. Each instance has its own clip boundary and its own settings for brightness, contrast, fade, and transparency. A single image can be cut into multiple pieces that can be rearranged independently in your drawing.

Example :

(defun c:al-addRaster ()


(setq mspace (vla-get-modelspace 

(setq IP (getpoint "\nInsertion Point: "))

;remember to substitute the path to your image.
(setq theraster (vla-AddRaster mspace 
                        (vlax-3d-point IP) 1.0 0.0))



The AutoLisp/Visual Lisp/VBA Resource Website
Search the WWW Search AfraLisp

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website