1) Open Cad program

2) Open Visual LISP Console Editor : Command VLIDE

3) Open lsp file

4) Click File > Make application > New Application Wizard…

5) Select Expert > next

6) Click Browse

7)Find a directory > click OK

8)Fill name of FAS file > click next

9).Select Separate namespace > next

10) Click Add > select a file lsp > click next

11) Click add > select a file lsp > click open

12) Click next

13) Click next

14) Click Finnish

Or use this lisp:

;;; CADALYST 11/07 http://www.cadalyst.com/code
;;; Tip 2256: complisp.lsp Convert LISP to FAS (c) 2007 Jim Dee

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Purpose: Compiles a directory of lisp files to FAS in another folder.
; Note: Be sure to change the lspfolder & fasfolder variables below.
;
; Written by Jim Dee at http://www.caddee.com
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:l2p ( / file compdate lspfolder fasfolder filelst itm)
(princ "\n***Written by Jim Dee at http://www.caddee.com***")
(setq lspfolder "c:\\temp\\") ;Modify the path in quotes for the location of your uncompiled LSP files.
(setq fasfolder "c:\\temp\\") ;Modify the path in quotes for the location of the compiled FAS files.

(initget "All Modified")
(setq compwhat (getkword "\nCompile All/Modified: "))
(if (= compwhat "All")
(vl-file-delete (strcat lspfolder "compile.upd"))
);if

;;;;;;get date of previous compile begin
(if (not (findfile (strcat lspfolder "compile.upd")))
(progn
(setq file (open (strcat lspfolder "compile.upd") "w"))
(write-line "0" file)
(close file)
);progn
);if
(setq file (open (strcat lspfolder "compile.upd") "r"))
(setq compdate (read-line file))
(close file)
;;;;;;get date of previous compile end

(textscr)
(Alert "ALERT:\n\nAfter the Visual LISP editor launches, you will need to click on the AutoCAD program window to begin compiling.\n\n\t\t\t Written by Jim Dee at http://www.caddee.com")
(princ "***Click here to begin compiling.***")
(c:vlide)
(setq filelst (vl-directory-files lspfolder "*.lsp" 1))
(foreach itm filelst
(if (> (ConvertFileDate (vl-file-systime (strcat lspfolder itm))) compdate)
(if (not (vlisp-compile 'st (strcat lspfolder itm) (strcat fasfolder (substr itm 1 ( - (strlen itm) 4)) ".fas")))
(princ (strcat "\n" itm " failed."))
)if
);if
);foreach
(setq file (open (strcat lspfolder "compile.upd") "w"))
(write-line (rtos (getvar "cdate") 2 6) file)
(close file)
(princ)
);defun

(defun ConvertFileDate (DateList / )
;Converts list containing [Year, Month, Day of Week, Day of Month, Hours, Minutes, Seconds] to a string like that returned by (rtos (getvar "cdate") 2 6)
(strcat
(rtos (nth 0 DateList) 2 0)
(RTOSAddLeadingZero (nth 1 DateList) 2)
(RTOSAddLeadingZero (nth 3 DateList) 2)
"."
(RTOSAddLeadingZero (nth 4 DateList) 2)
(RTOSAddLeadingZero (nth 5 DateList) 2)
(RTOSAddLeadingZero (nth 6 DateList) 2)
);strcat
);defun

(defun RTOSAddLeadingZero (numb digits / strnumb)
;converts a number to a string adds leading [digits] number of zeros to the left end.
(setq strnumb (rtos numb 2 0))
(while (< (strlen strnumb) digits)
(setq strnumb (strcat "0" strnumb))
);while
strnumb
);defun
(c:l2p)
 

Advertisements