How to Set Up Program Environment

This is a test posting. (July 16, 2006 by Takaya Iwamoto)
All the AutoLISP application programs downloadable from this site have been originaly written for AutoCAD. But slight modification have been added later for those who use other CAD program which can handle AutoLISP (there is one the author knows). In case CAD program other than AutoCAD is being used, follow the next step.
     (setq ICAD 1)
There are still a few warning messages during the program execution, but the execution will go through to the end. Please accept the author's excuse that it is not easy to make a program run perfectly the same way on two different platforms. These warning messages will eventually be taken care of in the future.

Step 1: Download the general utility routine file

The name of this file is my_tools.lsp. Place this file in the program's support file path.

Step 2: Initialize layer names and line types.

From command line: type init_mytools

This will create layer names layer1,layer2,..,layer**
where ** is the number for AutoCAD color code. 1 for red , 2 for yellow,etc.
It also loads 15 standard line types ("continuous", "dashed", "hidden2" etc)

Step 3: Create a few icons for easier operations.

Create bitmap icons for frequently used commands like init_mytools and refresh_all.
These 2 commands will be used many times in the future, so it is nice to have.
But if you do not mind typing them, then this step is not necessary.

For details of creating icons, refer to the User's Manual of CAD program .

How to make animation

There may be many ways to do this task, but this is the way the author does.

Step 1: Set the CAD screen to the desired size

From command line, type SCREENSIZE.
This system variable gives information Hor x Ver size.
The author normally sets this to 400 x 400
This variable is READONLY, which means that to set the screensize at 400 x 400
you need a very steady control of your mouse.

Step 2: Activate jpg file creation function

There are 2 functions defined in my_tools.lsp,which make the process of
making animation easier,i.e. jpg_setup and make_jpg.
;;;Utility routine for making jpg file when JPG_YES flag is on
;;;jpg_filename		JPG OUTPUT FILENAME
;;;jpg_count		jpg file sequence number
;;;JPG_YES		flag set 1 before jpgout option is enabled
;;;all the above variables user defined.
(defun make_jpg	()
  (if (= JPG_YES 1)
      (command "_.jpgout"
	       (strcat jpg_filename "_" (itoa jpg_count))
      (setq jpg_count (+ 1 jpg_count))
  )					;end of IF
;;;jpgout case
;;;initialize jpgout option by specifying file name and setting counter to 1
(defun jpg_setup (output_filename)
  ;;***jpgfile save***
;;;jpgfile name assigned
  (setq	jpg_filename output_filename
	jpg_count    1
In order to make jpg files in sequential order, 2 things have to de done.
2.1. Set JPG_YES flag on, by typing the following in the command line.
     (setq JPG_YES 1)

This will activate (make_jpg) call AutoCAD command "JPGOUT",
and assign the sequential counter to the output file name and save.
2.2. call (jpg_setup) function
       (jpg_setup "filename")  

where filename is the user provided output file name.
This call initializes jpg file counter jpg_count defined globally.
jpg_count is incremented by one everytime (make_jpg) is called.
So the resulting jpg file names are filename_1.jpg, filename_2.jpg , filename_3.jpg, etc.

Step 3: Run Jasc Paint Shop Pro's Animation wizard

The author chose the following settings.
time interval between frames = 50 ~ 100 ms
number of repetition = 2
All the other options are default setting. Output is a GIF file.Use this in html file.
Now you have an animation !!


There are many books written about AutoCAD, and many web sites with huge amount of informations about AutoCAD customization.Besides 3 manuals from Autodesk, Users' Manual, Command Reference and Customization Guide (Books and On Line Help), the author recommends the following.

  1. Smith,Joseph and Gesner,Rusty: Maximizing AutoLISP. New Riders Publishing, Indiana, USA. 1992.

Go to   Fun_Math Content Table

All comments/suggestions should be sent to Takaya Iwamoto

Last Updated Aug 10-th, 2006

Copyright 2006 Takaya Iwamoto   All rights reserved.