I'm having a strange issue with a drawing file when adding a table (very simple table) to modelspace. After the command runs and I run an audit on the drawing, it returns an error related to the new table that was generated...
AcDbTable(10199A4) BTR Id invalid
AcDbTable(10199A4) was not repaired.
however, as soon as I move the table at all within the modelspace, the error goes away. Anyone ever have this issue, know what is going on? The below code is how I am generating a table, for test purposes. Very simple way of adding a table, but it generates the above error each time. I don't understand how the error BTR Id invalid occurs when the table is first generated, but when it is moved at all, the error fixes itself?
<CommandMethod("tabletest")>
Public Sub tabletest()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Dim pr As PromptPointResult = ed.GetPoint("Enter insertion point: ")
If pr.Status = PromptStatus.OK Then
Dim tb As New Table()
tb.TableStyle = db.Tablestyle
tb.NumRows = 1
tb.NumColumns = 1
tb.SetRowHeight(3)
tb.SetColumnWidth(15)
tb.Position = pr.Value
tb.SetTextHeight(0, 0, 1)
tb.SetTextString(0, 0, "test")
tb.SetAlignment(0, 0, CellAlignment.MiddleCenter)
tb.GenerateLayout()
Using tr As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim btr As BlockTableRecord = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
btr.AppendEntity(tb)
tr.AddNewlyCreatedDBObject(tb, True)
tr.Commit()
End Using
End If
End Sub