New Member
Posts: 1
Registered: ‎11-27-2006
Message 1 of 3 (108 Views)

Field not found

108 Views, 2 Replies
11-27-2006 04:22 PM
System.MissingFieldException: Field not found: 'Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.ModelSpace'.

What wrong with this code? It work in 2006.

Private Sub ADDPlotstyle(ByVal PS As String)
Dim db As Database = HostApplicationServices.WorkingDatabase()
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim docLock As DocumentLock = Application.DocumentManager.MdiActiveDocument.LockDocument()
Dim btr As BlockTableRecord

Dim bt As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim btrId As ObjectId = bt(btr.ModelSpace)
btr = trans.GetObject(btrId, OpenMode.ForWrite)

Dim center As New Point3d(10, 10, 0)
Dim text As New MText
text.Contents = "Plot Style"
text.Location = center

text.PlotStyleName = PS

trans.AddNewlyCreatedDBObject(text, True)

Catch ex As Exception
End Try

Posts: 17
Registered: ‎01-27-2005
Message 2 of 3 (108 Views)

Re: Field not found

12-08-2006 08:28 AM in reply to: John
Have you been able to figure out what is causing this? I am having exactly the same problem. It appears that the model space block it not recognized in the .net wrappers?!
Posts: 19
Registered: ‎05-15-2007
Message 3 of 3 (108 Views)

Re: Field not found

05-12-2008 05:19 AM in reply to: John
anyone else managed to solve this? its driving me crackers.

my code works fine in 2007+ but wont work in 2006
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.