Ish Posted October 26, 2019 Posted October 26, 2019 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 Quote
marko_ribar Posted October 26, 2019 Posted October 26, 2019 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)... Quote
devitg Posted October 26, 2019 Posted October 26, 2019 The main fact is that is not any ACADTABLE . it are lines and text arranged like a TABLE, but not an ACADTABLE 1 Quote
BIGAL Posted October 27, 2019 Posted October 27, 2019 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. 1 Quote
Ish Posted October 27, 2019 Author Posted October 27, 2019 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? Quote
Ish Posted October 27, 2019 Author Posted October 27, 2019 3 hours ago, BIGAL said: I have it somewhere trying to find. hope you will find sir, thanks. Quote
hosneyalaa Posted October 27, 2019 Posted October 27, 2019 Try thiS LISP Export-Table-to-excel _ LispBox .LSP 2 Quote
hosneyalaa Posted October 27, 2019 Posted October 27, 2019 AND THIS COT_Convert_Old_TableV1.6a.lsp 1 Quote
Ish Posted October 27, 2019 Author Posted October 27, 2019 4 hours ago, hosneyalaa said: Try thiS LISP Export-Table-to-excel _ LispBox .LSP 18.75 kB · 6 downloads 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 Quote
hosneyalaa Posted October 27, 2019 Posted October 27, 2019 Works well on AutoCAD 2016 Sheet101.xlsx Sheet102.xlsx 1 Quote
devitg Posted October 27, 2019 Posted October 27, 2019 Works well for me at acad 2018 from tbltoex.xlsx 1 Quote
hosneyalaa Posted October 27, 2019 Posted October 27, 2019 the lisp COT_Convert_Old_TableV1.6a work Converts the table inside AutoCAD Then export it to Excel COORDINATE TABLE__convert (1).dwg 1 Quote
Ish Posted October 27, 2019 Author Posted October 27, 2019 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 Quote
hosneyalaa Posted October 27, 2019 Posted October 27, 2019 I hope to help you but I don't have enough experience THANKS 1 Quote
devitg Posted October 27, 2019 Posted October 27, 2019 (edited) 3 hours ago, Ish said: Never mind , I see your text screen copy Edited October 27, 2019 by devitg Quote
hanhphuc Posted October 28, 2019 Posted October 28, 2019 (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 October 28, 2019 by hanhphuc vl-filename-mktemp "table.csv" 2 Quote
Ish Posted October 28, 2019 Author Posted October 28, 2019 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 Quote
Ish Posted October 28, 2019 Author Posted October 28, 2019 6 hours ago, BIGAL said: Works 2020 very impressed ! NOW FOR ME I ALSO WORKING Export-Table Text-to-Excel.lsp PERFECTLY. THANKS ALL Quote
Ish Posted October 28, 2019 Author Posted October 28, 2019 THANKS ALL MY TEAM MEMBER TO SUPPORT ME. ANOTHER MY BIG ISSUE SOLVED BY YOU. THANKS ALL Quote
Recommended Posts
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.