Message 1 of 3
CreateExtensionDictionary to blockreference

Not applicable
09-25-2006
12:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create an extension dictionary for a blockreference but autocad tall me eNoDatabase
here is the code
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim newBtrId As ObjectId = CreateEmployeeDefinition()
Dim br As BlockReference = New BlockReference(New Point3d(10, 10, 0), newBtrId)
Dim brExtDict As DBDictionary
Dim name As Xrecord = New Xrecord
Dim salary As Xrecord = New Xrecord
Dim division As Xrecord = New Xrecord
name.Data = New ResultBuffer(New TypedValue(DxfCode.Text, "Earnest Shackleton"))
salary.Data = New ResultBuffer(New TypedValue(DxfCode.Real, 7200))
division.Data = New ResultBuffer(New TypedValue(DxfCode.Text, "Sales"))
' Se cae al tratar de crear el diccionario para el blockreference
br.CreateExtensionDictionary()
the last line is where crash the code,
any help it's good recived
here is the code
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt.Item(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim newBtrId As ObjectId = CreateEmployeeDefinition()
Dim br As BlockReference = New BlockReference(New Point3d(10, 10, 0), newBtrId)
Dim brExtDict As DBDictionary
Dim name As Xrecord = New Xrecord
Dim salary As Xrecord = New Xrecord
Dim division As Xrecord = New Xrecord
name.Data = New ResultBuffer(New TypedValue(DxfCode.Text, "Earnest Shackleton"))
salary.Data = New ResultBuffer(New TypedValue(DxfCode.Real, 7200))
division.Data = New ResultBuffer(New TypedValue(DxfCode.Text, "Sales"))
' Se cae al tratar de crear el diccionario para el blockreference
br.CreateExtensionDictionary()
the last line is where crash the code,
any help it's good recived