.NET

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

Field not found

118 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)

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

text.PlotStyleName = PS

trans.AddNewlyCreatedDBObject(text, True)
text.Erase()

Catch ex As Exception
End Try

docLock.Dispose()
trans.Commit()
trans.Dispose()
Contributor
flongsworth
Posts: 17
Registered: ‎01-27-2005
Message 2 of 3 (118 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?!
Contributor
Dakuan
Posts: 19
Registered: ‎05-15-2007
Message 3 of 3 (118 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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