Using layoutlist with ScriptPro

Discussion in 'AutoCAD' started by tomk_rlba, Nov 2, 2004.

  1. tomk_rlba

    tomk_rlba Guest

    Greetings,

    I've looked long and hard through the discussion groups but I can't seem to find the scenario similar enough to help me with my problem.

    I'm trying to create a LISP routine to export the Layout Tab Names to a text file. I can't get the (layoutlist) to work in any acceptable manner.

    So far:

    (setq Layouts (vl-remove "Model" (layoutlist)))
    (setq DD (rtos (getvar "CDATE") 2 6))
    (setq YEAR (substr DD 3 2) MONTH (substr DD 5 2) DAY (substr DD 7 2))
    (setq MONTH (itoa (atoi MONTH)))
    (setq DAY (itoa (atoi DAY)))
    (setq TT (strcat (getvar "DWGPREFIX") ";" (getvar "DWGNAME" ---LAYOUT NAMES HERE---)))

    (setq FN (strcat "X:/Drawing Logs/" MONTH "-" DAY "-" YEAR ".txt"))

    (setq F0 (open FN "a"))

    (if F0
    (progn
    (write-line TT F0)
    (close F0)
    )
    )

    My goal is to use ScriptPro to run this on a slew of files. IDEALLY I'd love to see the tabs delimited by a semi colon instead of quotes so the resulting file can be imported into excel. I (obviously) don't know enough about LISP to capture/manipulate/use the resulting data from the (layoutlist) call.

    There's a lot of people on here who have helped others with their layoutlist problems, and I hope someone will be able to help me as well.

    Thank you!

    Thom K.
     
    tomk_rlba, Nov 2, 2004
    #1
  2. tomk_rlba

    ECCAD Guest

    Try this inlay:
    --------------------------
    (setq Layouts (vl-remove "Model" (layoutlist)))
    (setq laynames ""); init
    (foreach lay Layouts
    (setq laynames (strcat laynames lay ";"))
    ); foreach
    (setq DD (rtos (getvar "CDATE") 2 6))
    (setq YEAR (substr DD 3 2) MONTH (substr DD 5 2) DAY (substr DD 7 2))
    (setq MONTH (itoa (atoi MONTH)))
    (setq DAY (itoa (atoi DAY)))
    (setq TT (strcat (getvar "DWGPREFIX") "," (getvar "DWGNAME") "," laynames))
     
    ECCAD, Nov 2, 2004
    #2
  3. tomk_rlba

    tomk_rlba Guest

    Bob,

    You are a Super Genius!

    That Rocks! That is EXACTLY what I was looking for. You've made my cold, windowless day all the better.

    Thank you again!

    Thom K.
     
    tomk_rlba, Nov 2, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.