.NET

Reply
Distinguished Contributor
cadcamm99
Posts: 160
Registered: ‎04-12-2005
Message 1 of 3 (358 Views)
Accepted Solution

Lock Document

358 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*
_gile
Posts: 2,106
Registered: ‎04-29-2006
Message 2 of 3 (345 Views)

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
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 3 of 3 (337 Views)

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
Need installation help?

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