View Full Version : Help w/ A2005 Tables

2005-02-18, 12:22 AM
I'm looking for a little help on populating a table after reading other tables and getting the text out. I want to read the text from X number of tables and count all the like text values. I'm wanting to pobulate another table w/ that information and create a Bill of Materials. I've been able to do everything I need to so far, but I've hit a wall when it comes to getting the values out, counting them and putting them in the BOM. Any help would be appreciated.

Here is what I have so far.

Sub Table_Count()

Dim MyPaperSpace As IAcadPaperSpace2
Set MyPaperSpace = ThisDrawing.PaperSpace
Dim pt As Variant
Dim prompt1 As String
Dim MyTable As AcadTable
Dim sstext As AcadSelectionSet
Dim FilterType(1) As Integer
Dim FilterData(1) As Variant
Dim tblText As String

Set sstext = ThisDrawing.SelectionSets.Add("SelSet001")
FilterType(0) = 0
FilterData(0) = "ACAD_TABLE"
FilterType(1) = 8
FilterData(1) = "PARTLABEL"
sstext.Select acSelectionSetAll, , , FilterType, FilterData

prompt1 = vbCrLf & "Enter the top left corner point of the table: "
pt = AcadApplication.ActiveDocument.Utility.GetPoint(, prompt1)

Set MyTable = MyPaperSpace.AddTable(pt, 2, 2, 0.244, 1)

For Each AcadTable In sstext

MyTable.InsertRows 0, 0.244, sstext.Count - 1

MyTable.SetColumnWidth 0, 0.75
MyTable.SetColumnWidth 1, 0.5
Dim sysVarName As String
Dim varData As Variant
sysVarName = "DIMSCALE"
varData = ThisDrawing.GetVariable(sysVarName)
MyTable.ScaleEntity pt, varData
MyTable.SetText 0, 0, "PART #"
MyTable.SetText 0, 1, "QTY."
MyTable.SetText 1, 0, sstext.Item(ACAD_TABLE).ObjectName
MyTable.SetText 1, 1, sstext.Count


End Sub