mine Posted July 28, 2009 Share Posted July 28, 2009 Hi I can't find the way how to insert data from vba script to existig table in acad 2008. I'm looking for some advise przemek Quote Link to comment Share on other sites More sharing options...
mine Posted July 29, 2009 Author Share Posted July 29, 2009 Maybe i'll write some more about my problem... I'm a civil enginer and i use tables in autocad and i wonder haw to use logic functions like "if" in cells (like in excel) and only way, I found out, is to calculate sth in vba using logic functions and to put this integer to cell in existing table in modelspace , but I can,t menage to write it. please help:oops: Quote Link to comment Share on other sites More sharing options...
SEANT Posted July 29, 2009 Share Posted July 29, 2009 I’m not exactly sure the full extent of what you need but the response I made in this thread was based on the code below. A table was already preset with the header information and I did modify the code a bit when processing the right side of the parabola. Nonetheless, it does give an example of VBA coding some Table modifications. http://www.cadtutor.net/forum/showthread.php?t=38670 Option Explicit Sub PutPtCoors2Table() Dim entTable As AcadTable Dim entArc As AcadArc Dim i As Integer, j As Integer Dim intCount As Integer Dim intCode(0) As Integer Dim varData(0) As Variant Dim colSS As AcadSelectionSet Dim ent As AcadEntity Dim varpt As Variant Dim varCen As Variant, varSt As Variant, varNd As Variant With ThisDrawing intCode(0) = 0: varData(0) = "Arc" intCount = SoSSS(intCode, varData) - 1 If intCount > 0 Then .Utility.GetEntity ent, varpt, "Select a Table: " If TypeOf ent Is AcadTable Then Set entTable = ent Else Exit Sub End If Set colSS = .SelectionSets.Item("TempSSet") For i = 0 To intCount Set entArc = colSS(i) varCen = entArc.Center varSt = entArc.StartPoint varNd = entArc.EndPoint For j = 0 To 2 entTable.SetText i + 4, 1 + j, CStr(Round(varCen(j), 5)) entTable.SetText i + 4, 4 + j, CStr(Round(varSt(j), 5)) entTable.SetText i + 4, 7 + j, CStr(Round(varNd(j), 5)) Next Next End If End With End Sub Quote Link to comment Share on other sites More sharing options...
SEANT Posted July 30, 2009 Share Posted July 30, 2009 Oops, just realized that I didn’t include all the supporting functions. Include this with the code from my previous message. Sub SSClear() Dim SSS As AcadSelectionSets On Error Resume Next Set SSS = ThisDrawing.SelectionSets If SSS.count > 0 Then SSS.Item("TempSSet").Delete End If End Sub Function SoSSS(Optional grpCode As Variant, Optional dataVal As Variant) As Integer Dim TempObjSS As AcadSelectionSet SSClear Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet") 'pick selection set If IsMissing(grpCode) Then TempObjSS.SelectOnScreen Else TempObjSS.SelectOnScreen grpCode, dataVal End If SoSSS = TempObjSS.count End Function Quote Link to comment Share on other sites More sharing options...
mine Posted July 30, 2009 Author Share Posted July 30, 2009 Thanks a lot for help and that you took this trouble, I've just started to think out this function..., but it seems to work in my drawing Quote Link to comment Share on other sites More sharing options...
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.