nah, I only know how to export to a text (ascii) file.
Registered forum members do not see this ad.
Hi,
Does anyone know how I could export a table that contains co-ordinates and levels from a drawing I am working on and import it in to Excel so that it can be manipulated.
Thanks in advance.
Primal.![]()
nah, I only know how to export to a text (ascii) file.
Yeah thats okay to Alan!!
Okay, I have written a lisp program that will take any text (table text) and export it to a ascii text file. If you want it, just yell.
Yeah, that would be great thanks Alan.
Can I have it?![]()
Stand by, I'll set it up. Have you ever tried to anything serious with a bloody Viking breathing down your neck? I have to get Tiger away for a bit. She's still going on about Rays????![]()
Oh, the intro should explain how it works, I hope. Otherwise, get back to me.
Okay, I found it, here you go:
Code:;;--------------------------------------------------------------------------- ;; TXT2ASCI.LSP OUTPUT SELECTED TEXT TO ASCII TEXT FILE ;;=========================================================================== ;; DESCRIPTION: ;; This routine will write out an ascii text file of the selected text ;; ;; The text lines are sorted by either: ;; 1. as to their vertical location, and are then ;; placed in paragraph form, the text line with the highest 'y' value will ;; be the first line, followed by the text line with the next highest 'y' ;; value, and so on... ;; 2. sorted by order of text line selection. ;; ;; Start Command: txtout ;; ;; ;; Written by: Alan Cullen July 1998 ;; ;;--------------------------------ERROR HANDLER------------------------------ (defun clerr (s) (if (/= s "Function cancelled") (if (= s "quit / exit abort") (princ) (princ (strcat "\nError: " s)) ) ) (command "_.UNDO" "_BACK") (setq a nil) (setq ss1 nil) (setvar "CMDECHO" ocmd) (if olderr (setq *error* olderr)) (princ "\nERROR...CONSOLE BREAK...ALL TEXT CHANGES HAVE BEEN UNDONE...") (princ) ) ;;-----------------------------MAIN PROGRAM------------------------------ (defun c:txtout ( ) (setq ocmd (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq olderr *error* *error* clerr) ;; Set new error handler (princ "\n EXPORT SELECTED TEXT TO ASCII TEXT FILE - July 1998 - Alan CULLEN") (princ "\n Select text lines in the order required for output file line number") (print) (setq outname (getstring "\n Enter name of OUTPUT FILE (include extension).....: ")) (setq dwgpath (getvar "dwgprefix")) (setq outname (strcat dwgpath outname)) (setq output (open outname "w")) (setq sstxt (ssget '((0 . "TEXT"))) ) (setq n (sslength sstxt)) (setq index 0) (repeat n (setq entname (entget (ssname sstxt index))) (setq txtgrp (assoc 1 entname)) (setq txt (cdr txtgrp)) (write-line txt output) (setq index (+ 1 index)) ) (close output) (princ (strcat "\nText has been placed in file \""outname"\"")) (setvar "CMDECHO" ocmd) (setq *error* olderr) ;; Reset old error handler (princ) (princ) )
Life doesn't suck, although we all go through periods when it may be easier to think that, than to discern the solution to whatever problem is the most formidable
at the moment in one's personal UCS.
Go to PLAN view instead. - Dadgad
Is the breathing heavy?
Thanks Alan, thats great!!




Bookmarks