.NET

Reply
Valued Contributor
btillman
Posts: 68
Registered: ‎07-25-2012
Message 1 of 3 (688 Views)

VB.NET Code to Close AutoCAD

688 Views, 2 Replies
07-31-2012 08:12 AM

I am having some difficulty in finding information on how to close AutoCAD from my VB.NET code. I open it, create a drawing, save and close the drawing, and now I need to close AutoCAD.

 

I'm using VB 2010 Express and here is the code which launches AutoCAD.

 

        Dim vAcadApp As AutoCAD.AcadApplication
        Dim vAcadDoc As AutoCAD.AcadDocument
        vAcadApp = New AutoCAD.AcadApplication
        vAcadApp.Visible = True

 After the drawing is closed I need some way of closing down AutoCAD.

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 3 (682 Views)

Re: VB.NET Code to Close AutoCAD

07-31-2012 08:57 AM in reply to: btillman

Have you tried

 

vAcadApp.Quit

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
btillman
Posts: 68
Registered: ‎07-25-2012
Message 3 of 3 (676 Views)

Re: VB.NET Code to Close AutoCAD

07-31-2012 10:26 AM in reply to: Hallex

Hallex,

 

Thank you for your reply. That worked, but I think I must find another location to place it because the LISP program which prepares the drawing did not seem to finish before AutoCAD shutdown. Or at least when I opened it up the drawing was missing quite a few lines which would normally have been there.

 

I tried using System.Threading.Thread.Sleep(10000) and that seemed to have helped but one of the blocks which gets inserted is all out of scale. I will have to play around with this some more but many thanks for your reply.

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!