AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Lisp to HTML

Download wLsp2html.zip (201 kB)

Here's a handy little program that will convert an AutoLisp file into HTML and create the web page. It was written by a gentleman named Mark Duenas.
While you're here, pop along here and have a look at Mark's Guitar site :


wLsphtml.exe is  a windows version of Lsphtml.exe! (an upgrade of sorts) AutoLISP to HTML converter.

  • To use this program double click on wlsphtml.exe to run the dialog

  • Next click on the button next to the input file edit box to choose a single or multiple .LSP files to convert to HTML.

  • Next click on the button next to the output file edit box to choose an output directory.

  • [optional] Next click on the button next to the Background Graphics File edit box to choose a background image for the html file(s).  This is optional so if you don’t have a background to include you may ignore this field.

  • [optional] The ‘Include Visual Lisp Functions’ check box includes the keywords for Visual Lisp (over 1500 of them) in the conversion.  So if you don’t use them and you have many files to convert it would be faster not to check this check box.

  • [optional] The ‘Exit after convert’ just exits the program after converting the file or files.

Questions, Comments, Bugs:

Please let me know how this program could better serve your needs.  Thanks!

Mark Duenas
2698 N. Robie Ave.
Meridian, ID  83642

markduenas@cableone.net


Here's an example of wLsp2html in action :

(defun c:batchpurge ( / CNTR DPATH DWGPATH FILE1 FLAG FLEN FNAME
                        FNAME1 LEN1 MESSAGE NFILES NFILES1 SCRFILE
                        UFILES)

;;;Firstly we need to check if DOSLib is loaded.
	(cond
	  ((= (atoi (substr (getvar "acadver") 1 2)) 13)
	    (if (not (member "doslib13.arx" (arx)))
	      (arxload (findfile "doslib13.arx"))))
	  ((= (atoi (substr (getvar "acadver") 1 2)) 14)
	    (if (not (member "doslib14.arx" (arx)))
	      (arxload (findfile "doslib14.arx"))))
	  ((= (atoi (substr (getvar "acadver") 1 2)) 15)
	    (if (not (member "doslib2k.arx" (arx)))
	      (arxload (findfile "doslib2k.arx"))))
	);cond
;;;This, first checks the version of AutoCAD in use.
;;;It then checks to see if that version of Doslib is loaded.
;;;If it is not, it searches the AutoCAD search path for the
;;;relevant version, and then loads it.


;;;Now, we need to retrieve the names of the files that we would
;;;like to make slides from.

	(setq dwgpath (getvar "dwgprefix"))
	;get the path to the current directory

	(setq ufiles (dos_getfilem "Select Drawings"
	dwgpath "Drawing Files (*.DWG)|*.DWG"))
	;display the file dialogue box

	(if (not ufiles)
	;if no files selected or Cancel
	
		(exit)
		;exit the application

	);

;;;The first item in the list "ufiles" is the directory path
;;;The remaining items are the file names.
;;;First, let's retrieve the directory path.

	(setq dpath (nth 0 ufiles))
	;retrieve the directory path - the first item.

;;;Next, let's get the number of items in the list,
;;;and make sure that the user wants to continue.

	(setq nfiles (length ufiles))
	;get the length of the list

	(setq nfiles1 (itoa (- nfiles 1)))
	;count only the file names and convert to a string

	(setq message (strcat "You have choosen " nfiles1 " files.
			      \nDo you want to continue?"))
	;set up the message

	(setq flag (dos_msgbox message "AfraLisp Batch Purge" 4 4))
	;display the message box

	(if (= flag 6)
	;if Yes selected

	(progn
	;do the following

;;;We'll now open an external file to write our script to.

 	(setq scrfile (strcat dpath "batdir.scr"))
	;add the path to the script file name

  	(setq file1 (open scrfile "w"))
	;open the file to write

	(setq cntr 1)
	;set the counter

;;;We'll now start the loop, format the file names, and add
;;;the commands to the script file.

	(repeat (- nfiles 1)
	;start the loop

		(setq fname (nth cntr ufiles))
		;get the file name

		(setq fname (strcat dpath fname))
		;add the path to the file name.
		;"fname" will be used to open each
		;drawing.

		;(setq flen (strlen fname))
		;get the length of file name

		;(setq len1 (- flen 4))
		;take away the last 4 characters (.DWG)

		;(setq fname1 (substr fname 1 len1))
		;get just the filename without the extension.
		;"fname1" will be used as our slide file name.

;;;write the commands to the script file

		(write-line (strcat "open " fname) file1)
		;open the drawing
		;write it to the script file

		(write-line (strcat "filedia" " 0") file1)
		;switch off dialogues
		;write it to the script file

		(write-line (strcat "purge") file1)
		;purge the drawing
		;write it to the script file

		(write-line (strcat "A") file1)
		;purge ALL
		;write it to the script file

		(write-line (strcat "*") file1)
		;purge EVERYTHING
		;write it to the script file

		(write-line (strcat "N") file1)
		;NO
		;write it to the script file

		(write-line (strcat "filedia" " 1") file1)
		;switch on dialogues
		;write it to the script file

		(write-line "qsave" file1)
		;save the drawing
		;write it to the script file

	
		(setq cntr (1+ cntr))
		;increment the counter

	);repeat

;;;now that we've finished writing the commands to the script
;;;file, we must remember to close it.

        (close file1)
	;close the script file

	(command "script" scrfile)
	;run the script file and sit back and have a beer.

	);progn

	);if

 (princ)

);defun

(princ)
 
The AutoLisp/Visual Lisp/VBA Resource Website

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