.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
*Simon
eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
1164 Views, 5 Replies
06-08-2005 05:36 AM
Hi,
I am getting the following error "An unhandled exception of type
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional
information: eLockViolation" when trying to draw (using the sample in Lab3)
from a form button command. I couldn't get a normal windows app to reference
autocad so I added a form to a class library then show it from autocad. The
eLockViolation occurrs when I get to the line Dim bt As BlockTable =
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when
it is started from the command prompt but when started from a button on the
form the error happens.
Does anyone have any idea how to cure this. I can read data fine from other
button commands on the form so it is addressing the drawing OK.
Cheers,
Simon
Public Function CreateEmployee()
Dim db As Database = HostApplicationServices.WorkingDatabase()
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Try
ERROR HERE>>>>>>>Dim bt As BlockTable = trans.GetObject(db.BlockTableId,
OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace),
OpenMode.ForWrite)
'Create the block reference...use the return from CreateEmployeeDefinition
directly!
Dim br As New BlockReference(New Point3d(10, 10, 0),
CreateEmployeeDefinition())
btr.AppendEntity(br) 'Add the reference to ModelSpace
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it
trans.Commit()
Finally
trans.Dispose()
End Try
End Function
I am getting the following error "An unhandled exception of type
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional
information: eLockViolation" when trying to draw (using the sample in Lab3)
from a form button command. I couldn't get a normal windows app to reference
autocad so I added a form to a class library then show it from autocad. The
eLockViolation occurrs when I get to the line Dim bt As BlockTable =
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when
it is started from the command prompt but when started from a button on the
form the error happens.
Does anyone have any idea how to cure this. I can read data fine from other
button commands on the form so it is addressing the drawing OK.
Cheers,
Simon
Public Function CreateEmployee()
Dim db As Database = HostApplicationServices.WorkingDatabase()
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Try
ERROR HERE>>>>>>>Dim bt As BlockTable = trans.GetObject(db.BlockTableId,
OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace),
OpenMode.ForWrite)
'Create the block reference...use the return from CreateEmployeeDefinition
directly!
Dim br As New BlockReference(New Point3d(10, 10, 0),
CreateEmployeeDefinition())
btr.AppendEntity(br) 'Add the reference to ModelSpace
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it
trans.Commit()
Finally
trans.Dispose()
End Try
End Function
Re: eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-08-2005 06:24 AM in reply to:
*Simon
Try locking the document before opening the block table for write.
*Laurence Skoropinski
Re: eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-08-2005 06:45 AM in reply to:
*Simon
Is it not something to do with Document.LockDocument() method. see LAB 6
Laurence
"Simon" wrote in message
news:4868495@discussion.autodesk.com...
Hi,
I am getting the following error "An unhandled exception of type
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional
information: eLockViolation" when trying to draw (using the sample in Lab3)
from a form button command. I couldn't get a normal windows app to reference
autocad so I added a form to a class library then show it from autocad. The
eLockViolation occurrs when I get to the line Dim bt As BlockTable =
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when
it is started from the command prompt but when started from a button on the
form the error happens.
Does anyone have any idea how to cure this. I can read data fine from other
button commands on the form so it is addressing the drawing OK.
Cheers,
Simon
Public Function CreateEmployee()
Dim db As Database = HostApplicationServices.WorkingDatabase()
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Try
ERROR HERE>>>>>>>Dim bt As BlockTable = trans.GetObject(db.BlockTableId,
OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace),
OpenMode.ForWrite)
'Create the block reference...use the return from CreateEmployeeDefinition
directly!
Dim br As New BlockReference(New Point3d(10, 10, 0),
CreateEmployeeDefinition())
btr.AppendEntity(br) 'Add the reference to ModelSpace
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it
trans.Commit()
Finally
trans.Dispose()
End Try
End Function
Laurence
"Simon"
news:4868495@discussion.autodesk.com...
Hi,
I am getting the following error "An unhandled exception of type
'Autodesk.AutoCAD.Runtime.Exception' occurred in acdbmgd.dll Additional
information: eLockViolation" when trying to draw (using the sample in Lab3)
from a form button command. I couldn't get a normal windows app to reference
autocad so I added a form to a class library then show it from autocad. The
eLockViolation occurrs when I get to the line Dim bt As BlockTable =
trans.GetObject(db.BlockTableId, OpenMode.ForWrite). This all runs OK when
it is started from the command prompt but when started from a button on the
form the error happens.
Does anyone have any idea how to cure this. I can read data fine from other
button commands on the form so it is addressing the drawing OK.
Cheers,
Simon
Public Function CreateEmployee()
Dim db As Database = HostApplicationServices.WorkingDatabase()
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Try
ERROR HERE>>>>>>>Dim bt As BlockTable = trans.GetObject(db.BlockTableId,
OpenMode.ForWrite)
Dim btr As BlockTableRecord = trans.GetObject(bt(btr.ModelSpace),
OpenMode.ForWrite)
'Create the block reference...use the return from CreateEmployeeDefinition
directly!
Dim br As New BlockReference(New Point3d(10, 10, 0),
CreateEmployeeDefinition())
btr.AppendEntity(br) 'Add the reference to ModelSpace
trans.AddNewlyCreatedDBObject(br, True) 'Let the transaction know about it
trans.Commit()
Finally
trans.Dispose()
End Try
End Function
Re: eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-08-2010 05:32 AM in reply to:
*Simon
Hi,
I'm starting programing with autocad and vb.net and I'm getting the same error in the same situation.
And my question is: Did you resolve this problem? I've been serching for a solution, but I cannot find anything about "elockViolation" error.
I really apreciate your answer, thanks.
Jordi J.
I'm starting programing with autocad and vb.net and I'm getting the same error in the same situation.
And my question is: Did you resolve this problem? I've been serching for a solution, but I cannot find anything about "elockViolation" error.
I really apreciate your answer, thanks.
Jordi J.
Re: eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-08-2010 11:38 AM in reply to:
*Simon
Welcome to the forum 
See post #2 from there:
http://discussion.autodesk.com/forums/thread.jspa? messageID=6235293?
~'J'~ Edited by: hallex on Mar 8, 2010 7:38 PM
See post #2 from there:
http://discussion.autodesk.com/forums/thread.jspa?
~'J'~ Edited by: hallex on Mar 8, 2010 7:38 PM
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
C6309D9E0751D165D0934D0621DFF27919
Re: eLockViola tion when trying to draw from a command on a form
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-26-2010 03:10 AM in reply to:
*Simon
I had similar problem with the same error by using modeless dialog in my application.
Dolument.LockDocument()
before opening BlockTable solved my problem
Dolument.LockDocument()
before opening BlockTable solved my problem
