Using tr
Dim TableStyleId As ObjectId = acCurDb.Tablestyle
Dim acTableStyleTbl As DBDictionary = tr.GetObject(acCurDb.TableStyleDictionaryId, OpenMode.ForRead)
For Each id As DBDictionaryEntry In acTableStyleTbl
If id.Key Like "Ведомость углов поворота прямых и кривых" Then
acCurDb.Tablestyle = id.Value
GoTo linetable
End If
Next
Dim db1 As Database = New Database(False, False)
db1.ReadDwgFile(PutchStyle & "НСТПР_Шаблон Civil_1.dwt", System.IO.FileShare.Read, True, "")
acTableStyleTbl = tr.GetObject(db1.TableStyleDictionaryId, OpenMode.ForRead)
Dim TableStyleD As ObjectIdCollection = New ObjectIdCollection
For Each id As DBDictionaryEntry In acTableStyleTbl
If id.Key Like "Ведомость углов поворота прямых и кривых" Then
TableStyleD.Add(id.Value)
Exit For
End If
Next
If TableStyleD.Count > 0 Then
Dim destDb1 As Database = acDoc.Database
Dim destDictId1 As ObjectId = destDb1.TableStyleDictionaryId
Dim iMap1 As IdMapping = New IdMapping()
destDb1.WblockCloneObjects(TableStyleD, destDictId1, iMap1, DuplicateRecordCloning.Replace, False)
'проверяем
acTableStyleTbl = tr.GetObject(acCurDb.TableStyleDictionaryId, OpenMode.ForRead)
For Each id As DBDictionaryEntry In acTableStyleTbl
If id.Key Like "Ведомость углов поворота прямых и кривых" Then
TableStyleId = id.Value
acCurDb.Tablestyle = id.Value
Exit For
End If
Next
End If
linetable:
'===============================================================================================
Dim bt As BlockTable = tr.GetObject(acCurDb.BlockTableId, OpenMode.ForWrite)
Dim ms As BlockTableRecord = tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim pPtRes As PromptPointResult
Dim pPtOpts As PromptPointOptions = New PromptPointOptions("")
pPtOpts.Message = vbLf & "Укажите точку вставки таблицы: "
pPtRes = acDoc.Editor.GetPoint(pPtOpts)
Dim ptStart As Point3d = pPtRes.Value
Dim tb As Autodesk.AutoCAD.DatabaseServices.Table = New Autodesk.AutoCAD.DatabaseServices.Table()
tb.TableStyle = acCurDb.Tablestyle
tb.SetDatabaseDefaults()
ms.UpgradeOpen()
ms.AppendEntity(tb)
tb.Position = ptStart
tb.SetSize(3, 24)
tb.SetRowHeight(5)
tr.AddNewlyCreatedDBObject(tb, True)
tr.Commit()
End Using