Jump to content

Recommended Posts

Posted

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

Posted

Please check the built-in DATAEXTRACTION command. Apply it only for text entities and retain the Position X, Position Y and Value properties.

Posted (edited)

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
Posted

Hi Tharwat,

 

Thanks for the tool!

 

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

 

Regards,

Wesley

Posted

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 .

Posted

Hi Tharwat,

 

The outcome should look like this.

 

outcome of tool.JPG

 

Thnx

Posted

Thnks Tharwat!

 

Works great!

 

Regards,

Wesley

Posted
Thnks Tharwat!

 

Works great!

 

Regards,

Wesley

 

You're welcome .

 

Happy to help :)

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