.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CreateExtensionDictionary to blockreference

2 REPLIES 2
Reply
Message 1 of 3
jae_irc
430 Views, 2 Replies

CreateExtensionDictionary to blockreference

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
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: jae_irc

I've not tested but think that you must add br to btr before br.CreateExtensionDictionary()
Message 3 of 3
jae_irc
in reply to: jae_irc

Thanks a lot i thonk the same during the night 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost