Author Topic: Convert alls lsp file to fas file  (Read 6077 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
Convert alls lsp file to fas file
« on: March 02, 2007, 04:10:06 AM »
Hi Alls,
if you got trouble to convert or compile from lsp file to fas file,it not one by one,but alls your file in one folder,look this code
Code: [Select]
; cltf is stand for Convert Lsp To Fas
;        Design by  : Adesu <Ade Suharna>
;        Email      : mteybid@yuasabattery.co.id
;        Homepage   : http://www.yuasa-battery.co.id
;        Create     : 02 March 2007
;        Program no.: 0552/03/2007
;        Edit by    :
;        Idea from  : Jim Dee at www.caddee.com
;        Remark     : before run this program,you sould prepare folder for
;                     destination object
(defun c:cltf (/ lsp fas lst)
  (setq lsp (dos_getdir "Browse for folder" " " "Select a folder as source" t))
  (setq fas (dos_getdir "Browse for folder" " " "Select a folder as destination" t))
  (setq lst (vl-directory-files lsp "*.lsp" 1))
  (if
    lst
    (progn
      (foreach x lst
(vlisp-compile
  'st
  (strcat lsp x)
  (strcat fas (substr x 1 ( - (strlen x) 4)) ".fas")
  )
)       ; foreach
      )         ; progn
    (alert "There is not contained file")
    )           ; if
  (princ)
  )             ; defun 

terrycadd

  • Guest
Re: Convert alls lsp file to fas file
« Reply #1 on: March 02, 2007, 10:08:15 AM »
Adesu,
I am very interested in trying your program, so I tryed to modify your version to run on AutoCAD 2006 as follows.  I don't have "dos_getdir" so I used a "getfiled" variation.  Then I found out that I also don't have "vlisp-compile".  (no function definition: VLISP-COMPILE)  I am using AutoCAD 2006.  Is this a new add on for 2007?
Code: [Select]
(defun c:cltf (/ lsp fas lst)
  (if (setq lsp (getfiled "Select a file in source folder" "" "lsp" 2))
    (progn
      (setq lsp (vl-filename-directory lsp))
      (if (setq fas (getfiled "Select a file in destination folder" (strcat lsp "\\") "" 2))
        (setq fas (vl-filename-directory fas))
      );if
    );progn
  );if
  (if (and lsp fas)
    (progn
      (setq lst (vl-directory-files lsp "*.lsp" 1))
      (foreach x lst
        (vlisp-compile 'st (strcat lsp x) (strcat fas (substr x 1 ( - (strlen x) 4)) ".fas"))
      );foreach
    );progn
  );if
  (princ)
);defun

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Convert alls lsp file to fas file
« Reply #2 on: March 02, 2007, 10:22:12 AM »
VLISP-COMPILE is native to the AC2006 Lisp API
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Chuck Gabriel

  • Guest
Re: Convert alls lsp file to fas file
« Reply #3 on: March 02, 2007, 10:24:47 AM »
In my experience, you have to open the VLIDE at least once in the current AutoCAD session before vlisp-compile will work.

Adesu

  • Guest
Re: Convert alls lsp file to fas file
« Reply #4 on: March 04, 2007, 11:19:41 PM »
Hi Terry,
if you have not "Doslib",visit it
www.mcnell.com
it's free down load include for acad 2007.



CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
Re: Convert alls lsp file to fas file
« Reply #5 on: March 06, 2007, 04:24:10 AM »
i have another soloution without doslib
the fas files will be converted in the same directory like the lsp are
Code: [Select]
(defun c:lsp2fas (/ lsp lst)
  (if
    (member "acetutil.arx" (arx))
     (progn
       (setq lsp (acet-ui-pickdir))
       (setq lst (vl-directory-files lsp "*.lsp" 1))
       (foreach x lst
         (if (null
               (findfile (strcat lsp "\\" (vl-filename-base x) ".fas"))
               ) ;_ end of null
           (vlisp-compile 'st (strcat lsp "\\" x))
           ) ;_ end of if
         ) ;_ end of foreach
       ) ;_ end of progn
     ) ;_ end of if
  (princ)
  ) ;_ end of defun
Gruß
CADwiesel
Besucht uns im CHAT