Help for export to Excel

Discussion in 'AutoCAD' started by ECCAD, Nov 28, 2004.

  1. ECCAD

    ECCAD Guest

    See the other post.

    Bob
     
    ECCAD, Nov 28, 2004
    #1
  2. ECCAD

    Majid Guest

    HI Bob ,
    Thanks for that code , but
    wish we could export ONLY the texts we want .
    I said for example all texts that comtains POS , and ofcourse WITHOUT those extra information such as :Romantic10...or some thing like that . I want that ONLY export for example :
    POS1 PL100x100x15x5 (line 1)
    POS2 IPE180x2100x7 (line2)
    ...
    ofcourse if we could print in cell (1,1) "POS1" in cell (1,2) "PL" in cell (1,3) "100" in cell(1,4) "100" in cell(1,4) "15" and... was GREAT !!!
    that was long I know but I am a begginer in programming and I want to know more and more...
    Thanks a lot
     
    Majid, Nov 28, 2004
    #2
  3. ECCAD

    ECCAD Guest

    Cut, paste this into original code:
    ;;
    ;; Output to .csv file
    ;;
    ;; POS1 PL100x100x15x5 (line 1)
    ;; POS2 IPE180x2100x7 (line2)

    (defun parse_string ()
    (setq k (strlen S1) index 1 temp S1)
    (setq c1 "" c2 "" c3 "" c4 "" c5 ""); blank cells
    (setq c 1); char counter start at 1
    (repeat k
    (setq ch (substr temp c 1)); get each character
    ;; look for seperator characters.
    (if (or (= ch "x")(= ch " ")(= ch ""))
    (progn
    (setq ch "")
    (setq index (+ index 1)); next field
    ); progn
    ); if
    (if (= index 1)
    (setq c1 (strcat c1 ch)); stack cell 1
    ); if
    (if (= index 2)
    (progn
    (if (or (= ch "0")(= ch "1")(= ch "2")(= ch "3")(= ch "4")
    (= ch "5")(= ch "6")(= ch "7")(= ch "8")(= ch "9"))
    (setq index (+ index 1)); place number in cell 3
    (setq c2 (strcat c2 ch)); stack cell 2
    ); if
    ); progn
    ); if
    (if (= index 3)
    (setq c3 (strcat c3 ch)); stack cell 3
    ); if
    (if (= index 4)
    (setq c4 (strcat c4 ch)); stack cell 4
    ); if
    (if (= index 5)
    (setq c5 (strcat c5 ch)); stack cell 5
    ); if
    ); repeat
    (setq S1 (strcat "" c1 "," c2 "," c3 "," c4 "," c5 "")); new string with commas
    ); function


    (defun add_to_list ()
    (setq temp S1)(parse_comma)(setq S1 temp)
    (if wcmatch S1 "POS")
    (progn
    (parse_string); break up into cells (add ,)
    (setq O "")
    (setq O (strcat O (chr 34) S1 (chr 34) ",,"));Value of Mtext + ,,
    (write-line O ofil); write it to file
    ); progn
    ); end if
    (princ)
    ); end function add_to_list
    ;;
    ;; *** begin main segment of program ***
     
    ECCAD, Nov 28, 2004
    #3
  4. ECCAD

    Majid Guest

    Hi ,
    I want to export not all texts exist in the drawing,
    I want to select a windows and for example all texts that contains "PL" in
    that selection export to excel .
    I don't know couls I explain that ?!
    Thanks
     
    Majid, Nov 28, 2004
    #4
  5. ECCAD

    Majid Guest

    Hi Bob,
    Thanks a lot
    But Please give me your e-mail address , the routine does not work correctly and I want to contact with you for more information and explain more what I want...
    Thanks a lot again
     
    Majid, Nov 29, 2004
    #5
  6. ECCAD

    ECCAD Guest

    Majid,

    (remove the nospam and ".")
    Bob
     
    ECCAD, Nov 29, 2004
    #6
  7. ECCAD

    ECCAD Guest

    Mjid,
    Based on your sample file, I sent you a new .lsp to
    break up the Mtext into excel fields you specified.
    Let me know if it works OK for you.

    Bob
     
    ECCAD, Nov 29, 2004
    #7
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.