Guiboard Posted August 19, 2010 Posted August 19, 2010 Hi everyone, I would like to read a table that would be linked with block attributes. Like a table (either AutoCAD or Excel) of fluids with pressure, temperature, flowrate... that I would link to attributes. I tried to insert a field in the attribute, but what I've found in fields are properties like Color/Layer/Column/Rows ... Anyone could help? Guiboard Quote
ReMark Posted August 19, 2010 Posted August 19, 2010 Isn't there a DATAEXTRACTION command in 2009? This command extracts data and sends it to a table or an external file such as an Excel spreadsheet. Quote
Guiboard Posted August 20, 2010 Author Posted August 20, 2010 (edited) I know about Data extraction, which extracts block attributes into Excel/AutoCAD table. But is the opposite possible? Extracting data from a table into blocks via fields? Edit: I found it by myself! It had to insert a field; Field category - Object // Field names: Formula. There are 4 buttons: Average/Sum/Count/Cell . Using cell I could pick an AutoCAD table cell. But I still have 1 question, Is there a way to link via an Excel table? Edited August 24, 2010 by Guiboard Quote
divekark Posted February 16, 2011 Posted February 16, 2011 hi there i am also intrested in the same. i have made a VBA code to import data from excel which can be extended for the required purpose Sub markdupfromxl() Dim xlApp As Object Dim xlFileName As String Dim getval(), getval1() As String Dim obj, entRef As AcadBlockReference Dim instPt() As Double Dim a, b As Integer xlFileName = "C:\Documents and Settings\divekark\Desktop\test duplicates.xls" Set xlApp = CreateObject("Excel.Application") xlApp.Visible = False Set xlbook = xlApp.workbooks.Open(xlFileName) Set xlSheet = xlbook.Sheets(1) a = xlSheet.UsedRange.Rows.Count ReDim getval(a), getval1(a) For b = 0 To a - 2 Set myrng = xlSheet.Range("A1") getval(b) = myrng.Offset(b + 1, 0).Value getval1(b) = myrng.Offset(b + 1, 1).Value Set obj = ThisDrawing.HandleToObject(getval(b)) instPt = obj.InsertionPoint Set entRef = ThisDrawing.ModelSpace.InsertBlock(instPt, "flage2", 1#, 1#, 1#, 0) If entRef.HasAttributes Then Dim AttList As Variant ' Build a list of attributes for the current block. AttList = entRef.GetAttributes ' Cycle throught the list of attributes. For j = LBound(AttList) To UBound(AttList) If AttList(j).TagString = "FLAGTEST" Then AttList(j).TextString = getval1(b) End If Next End If Next xlbook.Close xlApp.Quit Set xlbook = Nothing Set xlSheet = Nothing ThisDrawing.Activate End Sub if you tell me some thing more may be i can help you. Quote
Guiboard Posted February 16, 2011 Author Posted February 16, 2011 I had a similar post on this forum, which I got an answer. http://www.cadtutor.net/forum/showthread.php?53799-Link-table-data-Via-field Thanks for the VBA routine, but I've been using an add-on for solving my problem. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.