.NET

Reply
Distinguished Contributor
164 Posts
6 Kudos
Registered: ‎04-12-2005
Post 1 of 3
Accepted Solution

Lock Document

421 Views, 2 Replies
09-11-2013 09:52 AM

I am using AutoCAD 2014 and vb.net 2010 and coverting code from 2010 to 2014.

 

This like does not work anymore.

 

Using locked As Autodesk.AutoCAD.ApplicationServices.DocumentLock = ThisDrawing.LockDocument()

 

Any clue as to why?

 

These are the lines for ThisDrawing

 

Public ReadOnlyProperty ThisDrawing() AsDocument

       

Get

           

ReturnApplication.DocumentManager.MdiActiveDocument.GetAcadDocument()

       

EndGet

   

EndProperty

Dim ThisDrawing As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Using locked As Autodesk.AutoCAD.ApplicationServices.DocumentLock = ThisDrawing.LockDocument()
'' Do something here
End Using

 

*Expert Elite*
2,141 Posts
254 Kudos
Registered: ‎04-29-2006
Post 2 of 3

Re : Lock Document

09-11-2013 10:51 AM in reply to: cadcamm99

Hi,

 

It looks like you are confusing COM and .NET APIs.

 

This Drawing is AcadDocument type which is a COM object that do not have a LockDocument() method.

The .NET Document class has a this method.

Gilles Chanteau
Distinguished Mentor
787 Posts
80 Kudos
Registered: ‎02-25-2013
Post 3 of 3

Re: Lock Document

09-11-2013 11:02 AM in reply to: cadcamm99
Dim ThisDrawing As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument

Using locked As Autodesk.AutoCAD.ApplicationServices.DocumentLock = ThisDrawing.LockDocument()

     '' Do something here

End Using

 



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!