Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Eglauer, Armand
Message 1 of 8 (1,857 Views)

Lisp to export a table to excel

1857 Views, 7 Replies
04-19-2000 04:40 PM
I have a drawing that has a table of coordinates for many points. For each
point, there is a description, N, E, Elev. I wish to export this data (some
250 points) to Excel. Is there a lisp routine somewhere that could help me
with this?

Not sure if this matters, but there are a few points that do not have
elevations listed.

Thanks!
--
Using AcadR14, WinNT

Armand
*CADENTITY.COM
Message 2 of 8 (1,857 Views)

Re: Lisp to export a table to excel

04-19-2000 05:04 PM in reply to: *Eglauer, Armand
>Armand Eglauer wrote in article
...
> I have a drawing that has a table of coordinates for many points. For
each
> point, there is a description, N, E, Elev. I wish to export this data
(some
> 250 points) to Excel. Is there a lisp routine somewhere that could help
me
> with this?
>
> Not sure if this matters, but there are a few points that do not have
> elevations listed.


Are these points, blocks with Attributes?


---
www.Cadentity.com
Automation is Imagination
Providing Practical Utilities for Productive Solutions
Coming Soon.... Under Construction.
Free Block Swap Utility - Download Today.
*Dotson, Terry W.
Message 3 of 8 (1,857 Views)

Re: Lisp to export a table to excel

04-19-2000 05:49 PM in reply to: *Eglauer, Armand
Armand Eglauer wrote:
>
> I have a drawing that has a table of coordinates for many points. For each
> point, there is a description, N, E, Elev. I wish to export this data (some
> 250 points) to Excel. Is there a lisp routine somewhere that could help me
> with this?

If you were to consider third party software, please read on.

ToolPac 5.0 contains several Text Export routines. Export text in the
order selected or simply window off the text and choose the 'topdown'
option. The most elaborate routine allows you to simply window off a
table of text in the drawing, as per your example. It determines the
number and order of the rows/columns of text objects automatically and
exports the information to a comma delimited file that can be opened up
directly in Excel.

Thanks, Terry

o---------------------------------------------o
| ToolPac 5.0, a 500+ function collection |
| of Power Tools for all AutoCAD users. |
| Visit http://www.dotsoft.com for details. |
o---------------------------------------------o
*Eglauer, Armand
Message 4 of 8 (1,857 Views)

Re:

04-20-2000 07:32 AM in reply to: *Eglauer, Armand
The entities I wish to export are all DTEXT .... I guess my original post
was a bit ambiguous, sorry. THe drawing has a tabular text layout
describing each of the points in the drawing. The layout gives the Point #,
a brief description, N, E, and Elev (all as text entities).

"CADENTITY.COM" wrote in message
news:01bfaa5c$5dcea480$1b09a8c0@mail.whainc.com...
> >Armand Eglauer wrote in article
> ...
> > I have a drawing that has a table of coordinates for many points. For
> each
> > point, there is a description, N, E, Elev. I wish to export this data
> (some
> > 250 points) to Excel. Is there a lisp routine somewhere that could help
> me
> > with this?
> >
> > Not sure if this matters, but there are a few points that do not have
> > elevations listed.
>
>
> Are these points, blocks with Attributes?
>
*Tanzillo, Tony
Message 5 of 8 (1,857 Views)

Re:

04-20-2000 11:12 AM in reply to: *Eglauer, Armand
Attached to this is CSVOUT.LSP, which will do what you want
(export tabular text to CSV format, automatically detecting
columns and numeric values).

Armand Eglauer wrote:
>
> The entities I wish to export are all DTEXT .... I guess my original post
> was a bit ambiguous, sorry. THe drawing has a tabular text layout
> describing each of the points in the drawing. The layout gives the Point #,
> a brief description, N, E, and Elev (all as text entities).
>
> "CADENTITY.COM" wrote in message
> news:01bfaa5c$5dcea480$1b09a8c0@mail.whainc.com...
> > >Armand Eglauer wrote in article
> > ...
> > > I have a drawing that has a table of coordinates for many points. For
> > each
> > > point, there is a description, N, E, Elev. I wish to export this data
> > (some
> > > 250 points) to Excel. Is there a lisp routine somewhere that could help
> > me
> > > with this?
> > >
> > > Not sure if this matters, but there are a few points that do not have
> > > elevations listed.
> >
> >
> > Are these points, blocks with Attributes?
> >

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
*Eglauer, Armand
Message 6 of 8 (1,857 Views)

Re:

04-26-2000 01:52 PM in reply to: *Eglauer, Armand
Tony,

Unless I have done something wrong, I can't seem to get the lsp routine to
work. I type CSVOUT to invoke the lsp routine, then select the text items
(I tried a few one by one and tried a bunch with a window), but either way
it doesn't seem to work. I am using R14, if that makes the difference, or
is there some other setting that I should/shouldn't have set?

When I first tried to window text items, I got this (this was what I tried
first):
Command: csvout
Initializing...
Select objects: Other corner: 120 found
Select objects:
null function*Cancel*

When I try to execute the command with several text items selected
individually, I got this:
Select objects: 1 found (still selecting objects here!)
Select objects:
error: null function
(VL-SORT (MAPCAR (QUOTE (LAMBDA (VAL) (CONS VAL (SETQ I (1+ I))))) INPUT)
(QUOTE (LAMBDA (A B) (APPLY FUNC (MAPCAR (QUOTE CAR) (LIST A B))))))
(MAPCAR (QUOTE CDR) (VL-SORT (MAPCAR (QUOTE (LAMBDA (VAL) (CONS VAL (SETQ I
(1+
I))))) INPUT) (QUOTE (LAMBDA (A B) (APPLY FUNC (MAPCAR (QUOTE CAR) (LIST A
B)))))))
(LIST-INDEX KEYLIST _COMPAREKEY)
(SS-INDEX SS (QUOTE (LAMBDA (ENAME) (CDR (ASSOC 10 (ENTGET ENAME))))) (QUOTE
COMPARE-POINTS))
(SETQ INDICES (SS-INDEX SS (QUOTE (LAMBDA (ENAME) (CDR (ASSOC 10 (ENTGET
ENAME))))) (QUOTE COMPARE-POINTS)))
(C:CSVOUT)
*Cancel*

I got the same error the second time I tried to window text. Thanks

Armand

"Tony Tanzillo" wrote in message
news:38FF4878.F647A8C@worldnet.att.net...
> Attached to this is CSVOUT.LSP, which will do what you want
> (export tabular text to CSV format, automatically detecting
> columns and numeric values).
>
*Tanzillo, Tony
Message 7 of 8 (1,857 Views)

Re:

04-27-2000 05:37 AM in reply to: *Eglauer, Armand
Sorry, I didn't notice that you're using R14.

Attached is a revised copy that should work with R14:

Armand Eglauer wrote:
>
> Tony,
>
> Unless I have done something wrong, I can't seem to get the lsp routine to
> work. I type CSVOUT to invoke the lsp routine, then select the text items
> (I tried a few one by one and tried a bunch with a window), but either way
> it doesn't seem to work. I am using R14, if that makes the difference, or
> is there some other setting that I should/shouldn't have set?
>
> When I first tried to window text items, I got this (this was what I tried
> first):
> Command: csvout
> Initializing...
> Select objects: Other corner: 120 found
> Select objects:
> null function*Cancel*
>
> When I try to execute the command with several text items selected
> individually, I got this:
> Select objects: 1 found (still selecting objects here!)
> Select objects:
> error: null function
> (VL-SORT (MAPCAR (QUOTE (LAMBDA (VAL) (CONS VAL (SETQ I (1+ I))))) INPUT)
> (QUOTE (LAMBDA (A B) (APPLY FUNC (MAPCAR (QUOTE CAR) (LIST A B))))))
> (MAPCAR (QUOTE CDR) (VL-SORT (MAPCAR (QUOTE (LAMBDA (VAL) (CONS VAL (SETQ I
> (1+
> I))))) INPUT) (QUOTE (LAMBDA (A B) (APPLY FUNC (MAPCAR (QUOTE CAR) (LIST A
> B)))))))
> (LIST-INDEX KEYLIST _COMPAREKEY)
> (SS-INDEX SS (QUOTE (LAMBDA (ENAME) (CDR (ASSOC 10 (ENTGET ENAME))))) (QUOTE
> COMPARE-POINTS))
> (SETQ INDICES (SS-INDEX SS (QUOTE (LAMBDA (ENAME) (CDR (ASSOC 10 (ENTGET
> ENAME))))) (QUOTE COMPARE-POINTS)))
> (C:CSVOUT)
> *Cancel*
>
> I got the same error the second time I tried to window text. Thanks
>
> Armand
>
> "Tony Tanzillo" wrote in message
> news:38FF4878.F647A8C@worldnet.att.net...
> > Attached to this is CSVOUT.LSP, which will do what you want
> > (export tabular text to CSV format, automatically detecting
> > columns and numeric values).
> >

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
*Eglauer, Armand
Message 8 of 8 (1,857 Views)

Re:

04-27-2000 10:51 AM in reply to: *Eglauer, Armand
Thanks very much, Tony. It is just what I needed!

Armand
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.