.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Close a drawing using VB.net

4 REPLIES 4
Reply
Message 1 of 5
muckmailer
3174 Views, 4 Replies

Close a drawing using VB.net

How you close a AutoCAD single drawing in vb.net?

I would like to keep the AutoCAD editor open but remove the drawing from AutoCAD

 

Thank you,

 

4 REPLIES 4
Message 2 of 5
muckmailer
in reply to: muckmailer

I am using VS 2010 with AutoCAD 2013.

Is it possable to close (Save and close) a drawing using VB.net code???

I have spent all week searching the net on this and I have come up with nothing that works.

 

Message 3 of 5
muckmailer
in reply to: muckmailer

I have look at CloseAndDiscard or CloseAndSave methods  but I can find any good code examples using these methods.

Thank you,

Message 4 of 5
Keith.Brown
in reply to: muckmailer

This example took about 2 minutes to find using google.  Its in C# which most code for AutoCAD .NET is in.  You can easily convert it to VB.NET using one of the readily available online converters.

 

http://through-the-interface.typepad.com/through_the_interface/2007/03/closing_all_ope.html

 

 

Message 5 of 5
mzakiralam
in reply to: muckmailer

Hi,

Below code will be helpful to close all the drawing in AutocAD 2013 -2014

 

 Public Shared Sub CloseAllOpenDrawing()
        'close all opened drawing
        Dim docs As DocumentCollection = Application.DocumentManager
        For Each doc As Document In docs
            doc = Application.DocumentManager.MdiActiveDocument
            'get dwgtitled variable
            Dim obj As Object = Application.GetSystemVariable("DWGTITLED")
            'get DBMOD variable
            Dim isMod As Integer = System.Convert.ToInt32(Application.GetSystemVariable("DBMOD"))
            If doc.IsReadOnly Then
                DocumentExtension.CloseAndDiscard(doc)
            ElseIf System.Convert.ToInt16(obj) = 0 Then
                DocumentExtension.CloseAndDiscard(doc)
            Else
                If isMod = 0 Then
                    DocumentExtension.CloseAndDiscard(doc)
                ElseIf isMod <> 0 Then
                    DocumentExtension.CloseAndSave(doc, doc.Name)
                End If
            End If
        Next
    End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost