Jump to content

Recommended Posts

Posted

Dear Team member,

 

I have a lisp for export cad text / table in excel. when i run this lisp for export, i got below error.

<bad argument type: 2D/3D point: (nil nil 0.0)>

 

i hope it will solve by cad tutor team.

my Autocad  version 2020.

I attached cad and lisp here.

 

thanks 

COORDINATE TABLE 1.dwg TE_TableExport.lsp

Posted

What do you get with TABLEEXPORT command... You could specify file format of export as *.csv (it must not always be native *.xls or *.xlsx)...

Posted

The main fact is that is not any ACADTABLE . it are lines and text arranged like a TABLE, but not an ACADTABLE 

  • Like 1
Posted

Ok if its actually column of text then need something like pick column of text I have it somewhere trying to find. It sorts the selected text based on y value. Can have multiple columns.

 

Needs a rewrite original 2004.

 

 

  • Like 1
Posted
10 hours ago, devitg said:

The main fact is that is not any ACADTABLE . it are lines and text arranged like a TABLE, but not an ACADTABLE 

what will be the solution. Sir?

 

Posted
3 hours ago, BIGAL said:

I have it somewhere trying to find.

 

hope you will find sir,

 

thanks.

Posted
4 hours ago, hosneyalaa said:

 I GOT BELOW ERROR.

AFTER APPLOAD THE LISP. I GOT THE BELOW ERROR.

------------------------------------------------------------------------------------------------------

Command: AP
APPLOAD Export-Table Text-to-Excel.lsp successfully loaded.


Command:
Exportý Autocad Drawn Table to Excel
©2014

Averbuh Igal Software
type 'tbltoex' to execute.; error: Automation Error. Add method of Workbooks class failed

 

 

 

Posted

Export-Table Text-to-Excel.lsp 

THIS IS GOOD FOR ME BETTER THAN COT LISP,

ANY POSSIBILITIES TO SOLVE BELOW ERROR SIR. 

type 'tbltoex' to execute.; error: Automation Error. Add method of Workbooks class failed.

MY AUTOCAD 2020.

 

THANKS

Posted

I hope to help you but

I don't have enough experience

 

THANKS

  • Like 1
Posted (edited)
3 hours ago, Ish said:

 

Never mind  , I see your text screen copy 

Edited by devitg
Posted (edited)
15 hours ago, Ish said:

Export-Table Text-to-Excel.lsp 

THIS IS GOOD FOR ME BETTER THAN COT LISP,

ANY POSSIBILITIES TO SOLVE BELOW ERROR SIR. 

type 'tbltoex' to execute.; error: Automation Error. Add method of Workbooks class failed.

MY AUTOCAD 2020.

 

THANKS

 

 

If the error persists, or try this shorter routine as an alternative without using COM API.

Its just a simpler algorithm merely sorting each row of TEXT from top to bottom.

since it does not collect line coordinates and the output just a normal 'csv' file, so don't expect auto cell formatting, column size, alignment etc..  

however you still can format cell easily in EXCEL sheet & rename as .xls.

 

 

(defun c:tt (/ *error* foo ss fn f a b l ls l1 lst) ;hanhphuc 28.10.2019
  
  (defun *error* (msg)
    (if (and f (= (type f) 'FILE))
      (close f)
      (setq f nil)
      )
    )
  
  (and (setq foo '((a b) (cdr (assoc a (entget b)))) 
             ss  (ssget '((0 . "TEXT") (8 . "Text")))
             )
       (setq l (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) ; (acet-ss-to-list ss)
       (setq fuzz (* 0.25 (foo 40 (car l)))
             ls   (mapcar ''((x) (cons (foo 1 x) (foo 10 x))) l)
             )
       (setq fn (vl-filename-mktemp "table.csv") )
       (setq f (open fn "w"))
       (setq l  nil
             sl (vl-sort ls
                         ''((a b)
                            (if
                             (equal (caddr a) (caddr b) fuzz)
                             (< (cadr a) (cadr b))
                             (< (caddr a) (caddr b))
                             )
                            )
                         )

             a  (caddar sl)
             )

       (foreach x sl
         (if (equal a (setq b (caddr x)) fuzz)
           (setq l1 (cons x l1)
                 a  b
                 )
           (setq l1 (vl-list* x nil l1))
           )
         (setq a b)
         ) ;_ end of foreach
       (foreach x (progn (foreach x l1
                           (if x
                             (setq l (cons x l))
                             (setq lst (cons l lst)
                                   l   nil
                                   )
                             )
                           )
                         (setq lst (cons l lst))
                         (reverse (vl-remove nil lst))
                         ) ; progn
         (write-line (apply 'strcat (mapcar ''((x) (strcat x ",")) (mapcar 'car x))) f)
         )
       (progn (if f
                (close f)
                )
              (vl-cmdf "start" fn) ; or (vl-cmdf "shell" fn) doesn't work if same filename opened i.e:locked for editting
              ;(startapp "notepad" fn) ; recommand to use this for mutiple files
              )
       ) ;and
  (princ)
  )

(or
  (wcmatch (strcase (getvar 'dwgname)) "*COORDINATE TABLE 1*")
  (alert
    "\nThis routine only tested in 'COORDINATE TABLE 1.dwg',
    \nPlease download at \nhttps://www.cadtutor.net/forum/topic/68979-export-cad-text-table-in-excel-get-error/"
    )
  )
(princ)

 

p/s: In case you have any blank cell in Table,  just replace it with "-" or any TEXT!

i.e. TEXT in each Cell in a Row must have content & aligned horizontally in WCS, otherwise texts merge from first column to next

Edited by hanhphuc
vl-filename-mktemp "table.csv"
  • Like 2
Posted
2 hours ago, hanhphuc said:

 

 

If the error persists, or try this shorter routine as an alternative without using COM API.

Its just a simpler algorithm merely sorting each row of TEXT from top to bottom.

since it does not collect line coordinates and the output just a normal 'csv' file, so don't expect auto cell formatting, column size, alignment etc..  

however you still can format cell easily in EXCEL sheet & rename as .xls.

 

 


(defun c:tt (/ *error* foo ss fn f a b l ls l1 lst) ;hanhphuc 28.10.2019
  
  (defun *error* (msg)
    (if (and f (= (type f) 'FILE))
      (close f)
      (setq f nil)
      )
    )
  
  (and (setq foo '((a b) (cdr (assoc a (entget b)))) 
             ss  (ssget '((0 . "TEXT") (8 . "Text")))
             )
       (setq l (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) ; (acet-ss-to-list ss)
       (setq fuzz (* 0.25 (foo 40 (car l)))
             ls   (mapcar ''((x) (cons (foo 1 x) (foo 10 x))) l)
             )
       (setq fn (vl-filename-mktemp "table.csv") )
       (setq f (open fn "w"))
       (setq l  nil
             sl (vl-sort ls
                         ''((a b)
                            (if
                             (equal (caddr a) (caddr b) fuzz)
                             (< (cadr a) (cadr b))
                             (< (caddr a) (caddr b))
                             )
                            )
                         )

             a  (caddar sl)
             )

       (foreach x sl
         (if (equal a (setq b (caddr x)) fuzz)
           (setq l1 (cons x l1)
                 a  b
                 )
           (setq l1 (vl-list* x nil l1))
           )
         (setq a b)
         ) ;_ end of foreach
       (foreach x (progn (foreach x l1
                           (if x
                             (setq l (cons x l))
                             (setq lst (cons l lst)
                                   l   nil
                                   )
                             )
                           )
                         (setq lst (cons l lst))
                         (reverse (vl-remove nil lst))
                         ) ; progn
         (write-line (apply 'strcat (mapcar ''((x) (strcat x ",")) (mapcar 'car x))) f)
         )
       (progn (if f
                (close f)
                )
              (vl-cmdf "start" fn) ; or (vl-cmdf "shell" fn) doesn't work if same filename opened i.e:locked for editting
              ;(startapp "notepad" fn) ; recommand to use this for mutiple files
              )
       ) ;and
  (princ)
  )

(or
  (wcmatch (strcase (getvar 'dwgname)) "*COORDINATE TABLE 1*")
  (alert
    "\nThis routine only tested in 'COORDINATE TABLE 1.dwg',
    \nPlease download at \nhttps://www.cadtutor.net/forum/topic/68979-export-cad-text-table-in-excel-get-error/"
    )
  )
(princ)

 

p/s: In case you have any blank cell in Table,  just replace it with "-" or any TEXT!

i.e. TEXT in each Cell in a Row must have content & aligned horizontally in WCS, otherwise texts merge from first column to next

THANKS SIR, WORKING NICELY.

THANK YOU

Posted
6 hours ago, BIGAL said:

Works 2020 very impressed ! 

 

NOW FOR ME I ALSO WORKING  Export-Table Text-to-Excel.lsp PERFECTLY.

THANKS ALL 

Posted

THANKS ALL MY TEAM MEMBER TO  SUPPORT ME.

ANOTHER MY BIG ISSUE SOLVED BY YOU.

 

THANKS ALL💝

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...