.NET

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

Lock Document

377 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,114
Registered: ‎04-29-2006
Message 2 of 3 (364 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 (356 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
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!