With autolisp, is there a way to extract a certain attribute and place it in an Excel spreadsheet. Also, is there a way to determine which field in Excel the value can be placed??
Yes, by using the tag strings in the attributes. I'm not really good with macros, but ours looks like this:
Assembly:
'RowNum = 2
For Each elem In mspace
With elem
If StrComp(.EntityName, "AcDbBlockReference", 1) = 0 Then If .HasAttributes Then Array1 = .GetAttributes RowNum = RowNum + 1 For Count = LBound(Array1) To UBound(Array1) 'excelSheet.Cells(RowNum, Count + 1).Value = Array1(Count).textstring ' The following lines will save the value of each arrays textstring and _ write it to the selected row and column. To put this macro back to the way _ it was originally, just comment the following lines and un-comment _ the above single line.(k.a. 1-15-98) mknum = Array1(0).TextString tagstring = Array1(Count).tagstring If tagstring = "PART/DWG" Or tagstring = "DWG#" Then 'Found the Title Block RowNum = RowNum - 1 GoTo 15 End If If tagstring = "TAG" Then ' found a Machine Mark Block RowNum = RowNum - 1 GoTo 15
Our Excel sht headers match the tags in the attributes of the bill of materials. I can send you the entire excel file with the macro if you'd like. Just let me have your e-mail. Maybe you can look at it and tell more. HTH
In fact, doing this need ActiveX, so former AutoLISP can not do it. but Visual LISP can do. you may go to www.ikzomos.com to download OAsis-XLS and try the API. A very simple way in data exchange between Visual LISP & Excel