jpsheader.jpg (29354 bytes)

Back to AutoLisp Tutorial Homepage

Back to AutoLisp Homepage

Back to JefferyPSanders.com

 

 

 

 

D

C

L

 

I

M

A

G

E

 

 

 

 

 

The AutoLisp Tutorial - DCL

Dialog Control Language - Image


Image


Image

  An Image is used to display a vector graphic picture inside a rectangle.  To create the image you can use three different methods. 

  • Vector_image - Draws a single straight line in the current image. 
  • Fill_image       - Draws a filled rectangle in the current image.
  • Slide_image    - Draws an AutoCAD slide in the image.

For this tutorial we will concentrate on the Slide_Image function.  Everyone knows how to create a slide right?  The MSLIDE command.  Okay.  We will assume our image is ready.

  Let's look at the DCL Image definition and the AutoLisp functions required to display the image.


  DCL - You must supply either the width and height or one of these plus an aspect_ratio.

: image {
  key = "sld";
  height = 30;
  width = 30; 

     color = 0;
  is_enabled = false;

  is_tab_stop = false;
}

AutoLisp

;;;--- First we need a slide name
(setq mySlideName "c:/acad/myslide.sld")

;;;--- Second we need the key to the image control
(setq myKey "sld")

;;;--- Next we send the slide name and the key to the update function
(upDateImage mySlideName myKey)

; NOTE: Notice mySlideName becomes sldName and myKey becomes key when passed
;       as parameters to the upDateImage function.

;;;--- Function to update the slide

(defun upDateImage(sldName key)         

  ;;;--- Get the width of the slide
  (setq width (dimx_tile key))

  ;;;--- Get the height of the slide
  (setq height (dimy_tile key))

  ;;;--- Start the slide definition
  (start_image key)

  ;;;--- Wipe out the background
  (fill_image 0 0 width height 0)

  ;;;--- Put the slide in the image area
  (slide_image 0 0 width height sldName)

  ;;;--- Finish the slide definition
  (end_image)

)

  This function can be used over and over to display any slide image in an image control.  Use the upDateImage  function after the new_dialog call and before the action_tile statements.  You can also use this function while the dialog box is displayed in one of your action calls.  We will use this later on in the tutorial so you can see it in action.


Back


AutoLisp Tutorial Home

AutoLisp Home

Home

All questions/complaints/suggestions should be sent to JefferyPSanders.com

Last Updated September 28th, 2008

Copyright 2002-2008 JefferyPSanders.com. All rights reserved.