AUTOLOADER© HTML Programming

4.207 | Tutorials and Samples
write requests to: takehiko@mit.edu
original: 1996/10/18 by Takehiko Nagakura last revised : 2005/02/30 by Takehiko Nagakura

AUTOPLOADER© Set Up


tutorial

When you start making your own web page that you intend AutoLOADER to download your Lisp file and load to AutoCAD, please note that

  1. your html file and AutoLISP file must reside in your Athena account and in a directory path,

    your_athena_home_directory/www/4.207/

    If you are using a PC in the studio or the PC classroom, your_athena_home_directory is mapped to H: drive. www should be in there by default and you need to make 4.207 directory by yourself.

    As an entry point, please make sure to place a file named index.html there as is pointed by the list of the students in the 4.207 project page.

  2. When you access your page with Internet Explorer, you should use the URL of the web server of this course, instead of web.mit.edu server. We have set it up so that above directory path corresponds to

    http://cat2.mit.edu/4.207/projects/athena/your_account_name/

    If you use http:/web.mit.edu/~your_account_name/www/4.207/ , you can still see this page on a browser, but AutoLOADER will not work.

Also, please make sure that the name of your AutoLISP file is less than 21 character long excluding .lsp suffix. A longer filename may fail to load under some operating system versions.

The following is an example of how you can use this utility software to make a web based presentation that interact with AutoCAD.
The AutoLISP file, stool_01.lsp, provides a lisp routine to draw variations of a simple stool.

stool_01.lsp: show code

Clicking above link will show the code in another browser window. (If you have another browser window open behind the current one or minimized in the task bar, it may have showed up in there.) To show the text code of the program file, make a copy of the lisp file with .txt suffix and reference to it. Here is the actual HTML code used above.

< a href="stool_01.txt" target="browser" > stool_01.lsp < /a > : show code

This program defines the following functions.

(stool xpos ypos rot tank_width tank_height)
(c:demo)
Now, after you have set up AutoLOADER, clicking the button below will start AutoCAD if it is not yet running, and load the file, stool_01.lsp from this Web page directly to AutoCAD. You will see AutoCAD prompt line to type out a few lines and the last one says C:DEMO.

stool_01.lsp: click this to load the file to AutoCAD
In HTML, you can make this button simply by linking the text with the lisp file. Here is the actual HTML code for this.

< a href="stool_01.lsp" > stool_01.lsp < /a >

Now, why did I not make this to draw some graphics when you clicked the file to load? As is typically the case with an add-on program module, the file, stool_01.lsp, only defines new functions and does not include a line to execute these functions. If you see the AutoLISP code in the file, its last line is a commented line that says ;(C:demo). If you take this semi-colon out, the demo function will actually run when you load the file. But here, I am instead expecting the user to execute a new function in one of three ways after loading the AutoLISP file to AutoCAD.
One of the functions defined by this program is C:demo. For instance, let's think about executing this function, (c:demo).

1.
First way is simple. Just type the function in AutoCAD as in
demo
or
(c:demo)
2.
Second way is also simple. Make another lisp file which just includes the execution command such as (c:demo), and load it with LISPLOADER©.
3.
In the third way, you can use the CGI script, lispdispatch.cgi, to send a small lisp command such as (c:demo). For instance, try clicking the lines below.

dispatch (c:demo)
dispatch (command "erase" "all" "")
dispatch (stool 150 120 -35 100 40)

To make a button like those above, your HTML line should look like

< href="/cgi-bin-4203/lispdispatch.cgi?xxx"> yyy < /a >

For your own code, all you need to fill in are xxx and yyy. Here, yyy is obviously the text to be displayed on the page. xxx is the AutoLISP command to be dispatched by the CGI, lispdispatch.cgi, which exists in a directory, cgi-bin-4203. (Thus you must type the full /cgi-bin-4203/lispdispatch.cgi.) Make sure to place ? mark just before xxx and include no space.
When you place your lisp command in xxx, there are following rules and ristrictions to be taken care of.

1. replace every space with | (the vertical line character).
2. replace every double-quotation with ^ (the hat character).
3. + character cannot be included.
For instance, the HTML lines for the three examples above are

< a href="/cgi-bin-4203/lispdispatch.cgi?(c:demo)">
(c:demo)
< /a >

< a href="/cgi-bin-4203/lispdispatch.cgi?(command|^erase^|^all^|^^)">
(command "erase" "all" "")
< /a >

< a href="/cgi-bin-4203/lispdispatch.cgi?(stool|150|120|-35|100|40)">
(stool 150 120 -35 100 40)
< /a >

example

Here is a set of standard buttons used throughout my AutoLISP tutorial pages. Feel free to look at the HTML source code and use the image files for these buttons.

stool_01.lsp

(c:demo)

AutoCAD Standard Utilities


common problem in updating your lisp file already linked in a HTML page

Suppose you have an AutoLISP file, test.lsp, sent to AutoCAD via LISPLOADER© as by

< a href="test.lsp" >

If you change the content of this AutoLISP file, test.lsp, you probably need to reload the file into the local machine in order your change to be reflected. In Internet Explorer, you can do one of the followings.

0.
The following setting will likely to prevent this problem automatically.
Go to Internet Options item under Tools menu and click Settings for Temporary Internet files item. Then choose Automatically option for Check for newer versions of stored pages.

1.
If it does not work, try reloading the page via Refresh button.

2.
If it still does not work, reload the page while pressing SHIFT key.

3.
If it still does not work, go to Internet Options item under Tools menu and clear the Temporary Internet files by Delete Files button.


Education | Research | Who we are | Gallery | Bookmarks

Copyright © 1995 Takehiko Nagakura
Massachusetts Institute of Technology