anyone have ideas on what would be the most efficient way of transferring data between autocad, such as reading layer data from autocad & writing it into excel.
I'm working on a routine to do this, & it initially seemed that since i was iterating the layer records & viewport records to extract the layer data, I may as well populate each XL cell with the corresponding data. This actually takes a huge amount of time.
That is fine if that is the quickest way of doing it, but I was wondering if maybe reading all the data first & storing it in an array or two, or using a custom data structure (a class of strings and booleans etc for layer name, and on/off, etc), and then populating the cells from that might be quicker.
Also I've read a little about filling many cells at once from arrays & it seems this might be really quick. If this is the best way, & I'm using a custom data structure, should I try to create arrays from it (iterate through it to create an array of layernames, do it again for ON/OFF state, etc). If that is the case maybe I shouldn't bother with my custom class & just make a bunch of arrays to begin with. It just seems that my data class will help keep things organized & clean.
One way: store the data in an object 2 dimensional array and, in a Range with a number of rows and columns equal to the array, set the array as Range.Value2 property.
Other way: store the data in a single string separated with tabulations and new lines, copy the string to the clipboard and paste it in an Excel cell.
You can also get the ExcelStreamLateBinding.dll assembly from here, containing ExcelReader and ExcelWriter classes which are helpers to read and write Excel workbooks. The ExcelWriter provides a WriteRange() and a PasteFromClipboard() methods.
Attached: ExcelStreamLateBinding help file
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.