Jump to content

Text to excel


Wesley_Amsterdam

Recommended Posts

Hi all,

 

I have a drawing with z-coordinates in it as text.

I would like to export all the text-objects with their x- and y-coordinates, and use the text content for the z-coordinate.

 

Find the example attatched.

 

I couldn't find anything with a websearch.

Text2excel.dwg

Link to comment
Share on other sites

Try this .

 

(defun c:Test (/ ss f o)
 ;;    Tharwat 05.11.2014             ;;
 ;;    Export Texts' values to Excel    ;;
 (princ "\n << Select Texts to export to Excel : >>")
 (if (and (setq ss (ssget '((0 . "TEXT")
                           )
                   )
          )
          (setq f (getfiled "Save as :" (getvar 'DWGPREFIX) "csv" 1))
     )
   (progn
     (setq o (open f "w"))
     (write-line
       "X-coordinate of text;Y-coordinate of text;Z-coordinate of text value"
       o
     )
     ((lambda (i / sn p e)
        (while (setq sn (ssname ss (setq i (1+ i))))
          (write-line
            (strcat
              (rtos
                (car (setq p (cdr (assoc 10 (setq e (entget sn))))))
                2
              )
              ";"
              (rtos (cadr p) 2)
              ";"
              (cdr (assoc 1 e))
            )
            o
          )
        )
      )
       -1
     )
     (close o)
   )
 )
 (princ)
)

Edited by Tharwat
Link to comment
Share on other sites

I miss the x- and y-coordinates in the list.

 

Are you talking about the X and Y of the Text location ?

 

Show the outcome of the program as best as you looking for to allow me to write it for in one go .

Link to comment
Share on other sites

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...