ernestkwarteng Posted July 27, 2016 Share Posted July 27, 2016 Please the attached cad contains a drawing and a table with text and below is some reference id .My problem now is how to extract the text in the table and the reference number at the bottom right to csv.please can anyone help me with a script to do dat .i have several dwgs which i would like the script to loop through that folder and extract them to individual csv .thanks . text.dwg Quote Link to comment Share on other sites More sharing options...
YZ Posted July 28, 2016 Share Posted July 28, 2016 What have you tried so far? Have you got a method at all that can write something to a dwg? I'd start by trying to write one piece of text to csv and then build from there, rather than trying to do several different pieces of info on several drawings straight away. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 28, 2016 Share Posted July 28, 2016 A couple of things it not a "Table" its lines around text, try to use correct wording for objects makes it easier to provide a response. This should be pretty close. It does have an extra step sort on Y in excel but it was done in 2004 ; converts column of text to comma seprated file with text value and y value ; put in excell and sort by y value ; by Alan H Nov 2004 (setq x 1) (while (/= x 4) (setq howmany (rtos x 2 0)) (setq fileto (strcat "c:/temp/setout" howmany)) (princ fileto) (setq fout (open fileto "w")) (while (not (setq ss (ssget )))) (princ "wow") (while (setq en (ssname ss 0)) ; Entity type (setq entyp (cdr (assoc 0 (entget en)))) (princ "wow") (if (= entyp "TEXT") (progn (setq xyz (cdr (assoc 10 (entget en)))) (setq txtht (cdr (assoc 1 (entget en)))) ;write file out here (setq textout (strcat txtht "," (rtos (cadr xyz) 2 3))) ;write (write-line textout fout) (princ textout) ) ) ; Delete each measured entity from set (ssdel en ss) ;end while ) (close fout) (setq x (+ x 1)) ) ;end if loop 3 times (princ) Quote Link to comment Share on other sites More sharing options...
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.