hello everybody
Autodesk.AutoCAD.Runtime.Exception : 'eNotInDatabase
this is a part of topic ; insert a symbol in a table
When i lunch my application for the first time, the block is inserting at the place i want .ok
the problem occurs when i ran my application for the second time
and i got this message
Autodesk.AutoCAD.Runtime.Exception : 'eNotInDatabase
How to fix it
thank you
the code below
DrawRect(acBlkTblRec, acTrans, 0, 0, 5, 5)
Public Sub DrawRect(ByRef acBlkTblRec As BlockTableRecord, ByRef actrans As Transaction,
ByVal origPtx As Double, ByVal origPty As Double, ByVal Base As Double, ByVal Haut As Double)
Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim acLyrTbl As LayerTable
acLyrTbl = actrans.GetObject(acCurDb.LayerTableId,
OpenMode.ForRead)
Dim LCadre As String = "Armat"
Dim bt As BlockTable = DirectCast(actrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btr As BlockTableRecord = New BlockTableRecord()
If Not bt.Has("Ceramic") Then
bt.UpgradeOpen()
btr.Name = "Ceramic"
bt.Add(btr)
actrans.AddNewlyCreatedDBObject(btr, True)
End If
Dim acPoly As Polyline = New Polyline()
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.15, origPty + Haut - 0.1), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.12, origPty + Haut + 0.05), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + Base + 0.1, origPty + Haut - 0.05), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + Base, origPty), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx, origPty), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx, origPty + Haut), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.1, origPty + Haut - 0.1), 0, 0.005, 0.005)
acPoly.Layer = LCadre
'acBlkTblRec.AppendEntity(acPoly)
'actrans.AddNewlyCreatedDBObject(acPoly, True)
btr.AppendEntity(acPoly)
actrans.AddNewlyCreatedDBObject(acPoly, True)' [b][color=red]problem is here![/color][/b]
End Sub