Results 1 to 2 of 2

Thread: Table Export Lisp Help

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2011-07
    Posts
    1
    Login to Give a bone
    0

    Default Table Export Lisp Help

    I have the following lisp which is great for exporting csv tables from drawings. The issue is that I need the table to be named with the layout tab as a suffix. For example 123-Lyout.csv but I cannot figure out how to get the paper space layout tab name to list. Any help would be greatly appreciated.



    (defun c:-TableExport (/ start end x xx ss x1 x2 xx1 xx2 en eo trim fname f row col val str)
    (command ".zoom" "e")
    (setq start (list 0.0 0.0 0.0)
    end (list 20.0 11.4556 0)
    x 20
    xx -20
    ss (ssget "w" start end))
    (while (/= ss nil)
    (setq x1 (+ (car start) x)
    x2 (+ (car end) x)
    start (list x1 0 0)
    end (list x2 11.4556 0)
    ss (ssget "w" start end)
    )
    (cond
    ((equal ss nil)
    (setq xx1 (+ (car start) xx)
    xx2 (+ (car end) xx)
    start (list xx1 0 0)
    end (list xx2 11.4556 0)
    en (ssget "w" start end '((0 . "ACAD_TABLE")))
    )
    )
    )
    )
    (setq eo (vlax-ename->vla-object (ssname en 0)))
    (if (not (eq (vla-get-ObjectName eo) "AcDbTable"))
    (progn
    (princ "Object selected is not a table.")
    (setq eo nil)
    )
    )


    (if (and (setq trim ".dwg"
    fname (strcat (vl-string-right-trim trim (vla-get-fullname (vla-get-activedocument (vlax-get-acad-object)))) ".csv"))
    (setq f (open fname "w"))
    )
    (progn
    (setq row -1)
    (while (< (setq row (1+ row)) (vla-get-Rows eo))
    (setq col -1 str "")
    (while (< (setq col (1+ col)) (vla-get-Columns eo))
    (cond
    ((/= (vl-string-search "\"" (vla-gettext eo row col)) nil)
    (setq val (strcat (vla-GetText eo row col) "\""))
    (setq str (strcat str ",\"" val "\""))
    )
    ((setq str (strcat str ",\"" (vla-GetText eo row col) "\"")))
    )
    )
    (princ (substr str 2) f)
    (princ "\n" f)
    )
    (close f)
    (princ "\nTable sucsessfully exported.")
    )
    )
    (princ)
    )

  2. #2
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Table Export Lisp Help

    Your current tab will be (getvar "ctab")

Similar Threads

  1. Export table to CSV
    By georgii_daneliya720261 in forum AutoLISP
    Replies: 0
    Last Post: 2017-02-22, 09:55 AM
  2. Export to Table
    By z_ayri788300 in forum AutoLISP
    Replies: 4
    Last Post: 2012-11-22, 01:37 PM
  3. 2012: Table d'export dwg
    By fabrice.bon in forum Revit Architecture - General
    Replies: 2
    Last Post: 2011-06-21, 06:06 AM
  4. table export help
    By dougaking-ss in forum AutoLISP
    Replies: 0
    Last Post: 2009-03-04, 08:04 PM
  5. Export .ctb to table?
    By curtisj in forum AutoCAD Customization
    Replies: 3
    Last Post: 2007-08-09, 06:09 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •