TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: lamarn on December 30, 2009, 09:28:33 AM

Title: Write Excel cells to attributes
Post by: lamarn on December 30, 2009, 09:28:33 AM
Is it possible to write the content of Excel cells to attribute values?
Does anyone have a workaround?
Title: Re: Write Excel cells to attributes
Post by: Lee Mac on December 30, 2009, 11:28:46 AM
Yes, I believe this could be ahchieved, but it would be easier to read from either txt or csv.  :-)
Title: Re: Write Excel cells to attributes
Post by: gile on December 30, 2009, 02:44:36 PM
Hi,

I do agree with Lee Mac AutoLISP provides built in functions to read or write ascii files (txt, csv...).

Reading (or writing) an xls files will always be a slower process, but you can built some LISP functions using ActiveX.

You can get some inspiration (or directly use) Terry Miller's GetExcel.lsp (http://web2.airmail.net/terrycad/LISP/GetExcel.lsp)

You can also try the .NET defined LISP functions gc-XlRead and gc-XlWrite (http://www.theswamp.org/index.php?topic=31441.0)
Title: Re: Write Excel cells to attributes
Post by: Lee Mac on December 30, 2009, 02:55:33 PM
Nice one Gile, I was going to recommend your gc-XlRead/Write - great work  ;-)
Title: Re: Write Excel cells to attributes
Post by: fixo on December 30, 2009, 03:18:48 PM
Is it possible to write the content of Excel cells to attribute values?
Does anyone have a workaround?

It's possible but need to see the structure of
your Excel file
Try posting it in an attachment

~'J'~
Title: Re: Write Excel cells to attributes
Post by: lamarn on December 30, 2009, 03:22:35 PM
Thanks for replying.
The reason why I want this routines is to replace attributes from one block to another (drawing header).
The TAG name's are the same but the properties and the places are not.
This routine is useful but it doesn't do the job with attribute definitions.

http://www.theswamp.org/index.php?topic=31397.0

So, i think the only way to do this is if i place it in an excel file or txt file first..
Will try to put a code together..


Title: Re: Write Excel cells to attributes
Post by: fixo on December 30, 2009, 03:46:36 PM
Thanks for replying.
The reason why I want this routines is to replace attributes from one block to another (drawing header).
The TAG name's are the same but the properties and the places are not.
This routine is useful but it doesn't do the job with attribute definitions.

http://www.theswamp.org/index.php?topic=31397.0

So, i think the only way to do this is if i place it in an excel file or txt file first..
Will try to put a code together..
Sorry in this case I can't help you without your sample drawing
with blocks and Excel file

~'J'~