.NET

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

Lock Document

400 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,125
Registered: ‎04-29-2006
Message 2 of 3 (387 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 (379 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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.