Text from selection to excel

Text from selection to excel

Philip-John
Advocate Advocate
10,518 Views
44 Replies
Message 1 of 45

Text from selection to excel

Philip-John
Advocate
Advocate

txt2excel.png

I have some texts (top and bottom) in my drawing as above. I just need to have these in excel.

After selection of the top texts (point 01 - 08) it should go in first column of excel file and after selection of bottom texts (23.65 - 22.10) it should go in second column of excel file.

 

0 Likes
Accepted solutions (4)
10,519 Views
44 Replies
Replies (44)
Message 41 of 45

Travis.Biddle
Advocate
Advocate

Perfect, thank you so much for all your help!!!

0 Likes
Message 42 of 45

rajuksk_piping
Explorer
Explorer

1. Can this code be updated for selecting text or mtext also

2. while exporting text is seperating with column i dont to seperate the text

 

can anyone help me to update this lisp 

0 Likes
Message 43 of 45

rajuksk_piping
Explorer
Explorer

I need some update in this lisp, can anyone help me

 

1. selection of text & mtext also

2. text or mtext while exporting to excel should be seperated by column

 

pls help me 

0 Likes
Message 44 of 45

rajuksk_piping
Explorer
Explorer
(defun c:RTC ( / _sortsel _dxf fc csvfile opf row collection _comma ); Row to column
(defun _sortsel	(sel cl)
  (mapcar 'cdr
	  (vl-sort
	    (mapcar '(lambda (e)
		       (redraw e 3)
		       (list (_dxf 10 e) (_dxf 1 e) e) )
		    (vl-remove-if 'listp (mapcar 'cadr (ssnamex sel))) )
	    '(lambda (a b) (< (caar a) (caar b)))
	  )
  )
)
(defun _Dxf (d e)(cdr (assoc d (entget e))))
(setq collection nil inc 0
      _comma (lambda (s)(strcat s ","))
 )
  
(While
  (progn
      (princ (strcat "\nSelect text for column "
		     (itoa (setq inc (1+ inc))) " "
	     )
      )
      (setq fc (ssget '((0 . "TEXT")))))
  (setq collection (Cons (_sortsel fc inc) collection))
  )

(if  (setq collection (reverse collection))
  (progn
    	(setq csvfile (strcat (getvar 'dwgprefix)
			  (vl-filename-base (getvar 'dwgname)) ".csv"))
	(setq opf (open csvfile "w"))
	(while (and (Car collection)
		    (setq data (mapcar 'car collection))
	       )
	  (setq row (apply 'strcat (mapcar '_comma (mapcar 'car data))))
	  (write-line row opf)
	  (foreach itm (mapcar 'cadr data) (redraw itm 4))
	  (setq collection (mapcar 'cdr collection))
	)
    	(close opf)
    	(startapp "explorer" csvfile)
    )
  )
  (princ)
)
0 Likes
Message 45 of 45

rajuksk_piping
Explorer
Explorer

Code is given above 

 

rajuksk_piping_0-1717683863224.png