CreateExtensionDictionary to blockreference

CreateExtensionDictionary to blockreference

Anonymous
Not applicable
507 Views
2 Replies
Message 1 of 3

CreateExtensionDictionary to blockreference

Anonymous
Not applicable
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
0 Likes
508 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I've not tested but think that you must add br to btr before br.CreateExtensionDictionary()
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks a lot i thonk the same during the night 🙂
0 Likes